mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-18 21:43:27 -06:00
Merge pull request #1078 from andlaus/fix_initial_rs_and_rv
set the Rv and Rs factors to the saturated values for cells which have no gas and no oil
This commit is contained in:
commit
6a1ad6f3fe
@ -25,7 +25,7 @@
|
|||||||
#include <opm/core/grid/GridHelpers.hpp>
|
#include <opm/core/grid/GridHelpers.hpp>
|
||||||
#include <opm/core/simulator/EquilibrationHelpers.hpp>
|
#include <opm/core/simulator/EquilibrationHelpers.hpp>
|
||||||
#include <opm/core/simulator/BlackoilState.hpp>
|
#include <opm/core/simulator/BlackoilState.hpp>
|
||||||
#include <opm/core/props/BlackoilPropertiesInterface.hpp>
|
#include <opm/core/props/BlackoilPropertiesFromDeck.hpp>
|
||||||
#include <opm/core/props/BlackoilPhases.hpp>
|
#include <opm/core/props/BlackoilPhases.hpp>
|
||||||
#include <opm/core/utility/RegionMapping.hpp>
|
#include <opm/core/utility/RegionMapping.hpp>
|
||||||
#include <opm/core/utility/Units.hpp>
|
#include <opm/core/utility/Units.hpp>
|
||||||
@ -163,7 +163,7 @@ namespace Opm
|
|||||||
phaseSaturations(const Grid& grid,
|
phaseSaturations(const Grid& grid,
|
||||||
const Region& reg,
|
const Region& reg,
|
||||||
const CellRange& cells,
|
const CellRange& cells,
|
||||||
BlackoilPropertiesInterface& props,
|
BlackoilPropertiesFromDeck& props,
|
||||||
const std::vector<double> swat_init,
|
const std::vector<double> swat_init,
|
||||||
std::vector< std::vector<double> >& phase_pressures);
|
std::vector< std::vector<double> >& phase_pressures);
|
||||||
|
|
||||||
|
@ -885,7 +885,7 @@ namespace Opm
|
|||||||
*/
|
*/
|
||||||
template<class Grid>
|
template<class Grid>
|
||||||
void initStateEquil(const Grid& grid,
|
void initStateEquil(const Grid& grid,
|
||||||
BlackoilPropertiesInterface& props,
|
BlackoilPropertiesFromDeck& props,
|
||||||
const Opm::DeckConstPtr deck,
|
const Opm::DeckConstPtr deck,
|
||||||
const Opm::EclipseStateConstPtr eclipseState,
|
const Opm::EclipseStateConstPtr eclipseState,
|
||||||
const double gravity,
|
const double gravity,
|
||||||
@ -901,6 +901,36 @@ namespace Opm
|
|||||||
state.saturation() = Details::convertSats(isc.saturation());
|
state.saturation() = Details::convertSats(isc.saturation());
|
||||||
state.gasoilratio() = isc.rs();
|
state.gasoilratio() = isc.rs();
|
||||||
state.rv() = isc.rv();
|
state.rv() = isc.rv();
|
||||||
|
|
||||||
|
// set the Rs and Rv factors to the saturated ones if both the gas and the oil
|
||||||
|
// saturations are zero. in most cases this does not matter, but when doing the
|
||||||
|
// gravity correction (in particular, when determining the upstream direction) it
|
||||||
|
// does.
|
||||||
|
if (pu.phase_used[BlackoilPhases::Liquid] && pu.phase_used[BlackoilPhases::Vapour]) {
|
||||||
|
const int posOil = pu.phase_pos[BlackoilPhases::Liquid];
|
||||||
|
const int posGas = pu.phase_pos[BlackoilPhases::Vapour];
|
||||||
|
for (unsigned cellIdx = 0; cellIdx < state.pressure().size(); ++ cellIdx) {
|
||||||
|
const double so = isc.saturation()[posOil][cellIdx];
|
||||||
|
const double sg = isc.saturation()[posGas][cellIdx];
|
||||||
|
|
||||||
|
if (so <= 0.0 && sg <= 0.0) {
|
||||||
|
int pvtRegionIdx = props.cellPvtRegionIndex()[cellIdx];
|
||||||
|
const double po = state.pressure()[cellIdx];
|
||||||
|
const double pg = po; // hack: include capillary pressure!
|
||||||
|
const double T = 273.15 + 25.0; // does not matter for isothermal simulations!
|
||||||
|
const double rsSat = props.oilPvt().saturatedGasDissolutionFactor(pvtRegionIdx,
|
||||||
|
T,
|
||||||
|
pg);
|
||||||
|
const double rvSat = props.gasPvt().saturatedOilVaporizationFactor(pvtRegionIdx,
|
||||||
|
T,
|
||||||
|
po);
|
||||||
|
|
||||||
|
state.gasoilratio()[cellIdx] = rsSat;
|
||||||
|
state.rv()[cellIdx] = rvSat;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
initBlackoilSurfvolUsingRSorRV(UgGridHelpers::numCells(grid), props, state);
|
initBlackoilSurfvolUsingRSorRV(UgGridHelpers::numCells(grid), props, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user