Hack to make the intial output of rs and rv Ecl compatible.

For cells with swat == 1 Ecl outputs; rs = rsSat and rv=rvSat, in all
but the initial step where it outputs rs and rv values calculated by the
initialization. To be compatible we overwrite rs and rv with the values
passed by the localState. Volume factors and densities needs to be
recalculated with the updated rs and rv values.
This commit is contained in:
Tor Harald Sandve 2017-03-16 10:22:27 +01:00
parent d640a16e5a
commit 6c859836f3
5 changed files with 49 additions and 6 deletions

View File

@ -258,7 +258,7 @@ namespace Opm {
const WellModel& wellModel() const { return well_model_; }
/// Return reservoir simulation data (for output functionality)
const SimulatorData& getSimulatorData() const {
const SimulatorData& getSimulatorData(const SimulationDataContainer&) const {
return sd_;
}

View File

@ -1179,7 +1179,7 @@ namespace Opm {
return values;
}
SimulationDataContainer getSimulatorData () const
SimulationDataContainer getSimulatorData ( const SimulationDataContainer& localState) const
{
typedef std::vector<double> VectorType;
@ -1333,8 +1333,49 @@ namespace Opm {
muOil[cellIdx] = fs.viscosity(FluidSystem::oilPhaseIdx).value();
krOil[cellIdx] = intQuants.relativePermeability(FluidSystem::oilPhaseIdx).value();
}
// hack to make the intial output of rs and rv Ecl compatible.
// For cells with swat == 1 Ecl outputs; rs = rsSat and rv=rvSat, in all but the initial step
// where it outputs rs and rv values calculated by the initialization. To be compatible we overwrite
// rs and rv with the values passed by the localState.
// Volume factors and densities needs to be recalculated with the updated rs and rv values.
if (ebosSimulator_.episodeIndex() < 0 && vapour_active && liquid_active ) {
Rs[cellIdx] = localState.getCellData( BlackoilState::GASOILRATIO )[cellIdx];
Rv[cellIdx] = localState.getCellData( BlackoilState::RV)[cellIdx];
// copy the fluidstate and set the new rs and rv values
auto fs_updated = fs;
auto rs_eval = fs_updated.Rs();
rs_eval.setValue( Rs[cellIdx] );
fs_updated.setRs(rs_eval);
auto rv_eval = fs_updated.Rv();
rv_eval.setValue( Rv[cellIdx] );
fs_updated.setRv(rv_eval);
//re-compute the volume factors and densities.
rhoOil[cellIdx] = FluidSystem::density(fs_updated,
FluidSystem::oilPhaseIdx,
intQuants.pvtRegionIndex()).value();
rhoGas[cellIdx] = FluidSystem::density(fs_updated,
FluidSystem::gasPhaseIdx,
intQuants.pvtRegionIndex()).value();
bOil[cellIdx] = FluidSystem::inverseFormationVolumeFactor(fs_updated,
FluidSystem::oilPhaseIdx,
intQuants.pvtRegionIndex()).value();
bGas[cellIdx] = FluidSystem::inverseFormationVolumeFactor(fs_updated,
FluidSystem::gasPhaseIdx,
intQuants.pvtRegionIndex()).value();
}
}
const size_t max_num_cells_faillog = 20;
if (failed_cells_pb.size() > 0) {
std::stringstream errlog;

View File

@ -273,8 +273,8 @@ namespace Opm {
/// Return reservoir simulation data (for output functionality)
const SimulatorData& getSimulatorData() const {
return transport_solver_.model().getSimulatorData();
const SimulatorData& getSimulatorData(const SimulationDataContainer& localState) const {
return transport_solver_.model().getSimulatorData(localState);
}
/// Return fluid-in-place data (for output functionality)

View File

@ -29,6 +29,7 @@
#include <opm/core/utility/miscUtilities.hpp>
#include <opm/core/utility/parameters/ParameterGroup.hpp>
#include <opm/core/wells/DynamicListEconLimited.hpp>
#include <opm/core/simulator/BlackoilState.hpp>
#include <opm/output/data/Cells.hpp>
#include <opm/output/data/Solution.hpp>
@ -952,7 +953,7 @@ namespace Opm
// while for flow_ebos a SimulationDataContainer is returned
// this is addressed in the above specialized methods
SimulationDataContainer sd =
detail::convertToSimulationDataContainer( physicalModel.getSimulatorData(), localState, phaseUsage_ );
detail::convertToSimulationDataContainer( physicalModel.getSimulatorData(localState), localState, phaseUsage_ );
localCellData = simToSolution( sd, restart_double_si_, phaseUsage_); // Get "normal" data (SWAT, PRESSURE, ...);

View File

@ -32,6 +32,7 @@
#include <opm/polymer/fullyimplicit/PolymerPropsAd.hpp>
#include <opm/core/utility/parameters/ParameterGroup.hpp>
#include <opm/simulators/timestepping/SimulatorTimerInterface.hpp>
#include <opm/common/data/SimulationDataContainer.hpp>
struct UnstructuredGrid;
struct Wells;
@ -146,7 +147,7 @@ namespace Opm {
const PolymerBlackoilState& current ) const;
/// Return reservoir simulation data (for output functionality)
const SimulatorData& getSimulatorData() const {
const SimulatorData& getSimulatorData(const SimulationDataContainer&) const {
return sd_;
}