Merge pull request #1103 from totto82/output_rsrv_pc

Fix output of rs and rv.
This commit is contained in:
Atgeirr Flø Rasmussen 2017-03-20 06:47:17 +01:00 committed by GitHub
commit 2eb8816507
5 changed files with 56 additions and 11 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

@ -675,6 +675,11 @@ namespace Opm {
switch (hydroCarbonState) {
case HydroCarbonState::GasAndOil: {
// for the Gas and Oil case rs=rsSat and rv=rvSat
rs = FluidSystem::oilPvt().saturatedGasDissolutionFactor(fs.pvtRegionIndex(), reservoir_state.temperature()[cell_idx], reservoir_state.pressure()[cell_idx]);
// use gas pressure?
rv = FluidSystem::gasPvt().saturatedOilVaporizationFactor(fs.pvtRegionIndex(), reservoir_state.temperature()[cell_idx], reservoir_state.pressure()[cell_idx]);
if (sw > (1.0 - epsilon)) // water only i.e. do nothing
break;
@ -682,15 +687,12 @@ namespace Opm {
reservoir_state.hydroCarbonState()[cell_idx] = HydroCarbonState::OilOnly; // sg --> rs
sg = 0;
so = 1.0 - sw - sg;
const double& rsSat = FluidSystem::oilPvt().saturatedGasDissolutionFactor(fs.pvtRegionIndex(), reservoir_state.temperature()[cell_idx], reservoir_state.pressure()[cell_idx]);
rs = rsSat*(1-epsilon);
rs *= (1-epsilon);
} else if (so <= 0.0 && has_vapoil_) {
reservoir_state.hydroCarbonState()[cell_idx] = HydroCarbonState::GasOnly; // sg --> rv
so = 0;
sg = 1.0 - sw - so;
// use gas pressure?
const double& rvSat = FluidSystem::gasPvt().saturatedOilVaporizationFactor(fs.pvtRegionIndex(), reservoir_state.temperature()[cell_idx], reservoir_state.pressure()[cell_idx]);
rv = rvSat*(1-epsilon);
rv *= (1-epsilon);
}
break;
}
@ -1150,7 +1152,7 @@ namespace Opm {
return regionValues;
}
SimulationDataContainer getSimulatorData () const
SimulationDataContainer getSimulatorData ( const SimulationDataContainer& localState) const
{
typedef std::vector<double> VectorType;
@ -1304,8 +1306,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>
@ -950,7 +951,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_;
}