Blackoil: Prepare for 2p conditional storage of fluidstate

Also fix pseudo 2p case for ebos
This commit is contained in:
Tor Harald Sandve 2018-10-18 12:55:49 +02:00
parent cee74bb2b5
commit 656f055992
2 changed files with 15 additions and 10 deletions

View File

@ -69,6 +69,7 @@ class EclEquilInitializer
typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw;
typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices;
enum { numPhases = FluidSystem::numPhases };
enum { oilPhaseIdx = FluidSystem::oilPhaseIdx };
@ -84,14 +85,18 @@ class EclEquilInitializer
enum { enableTemperature = GET_PROP_VALUE(TypeTag, EnableTemperature) };
enum { enableEnergy = GET_PROP_VALUE(TypeTag, EnableEnergy) };
public:
// NB: setting the enableEnergy argument to true enables storage of enthalpy and
// internal energy!
typedef Opm::BlackOilFluidState<Scalar,
FluidSystem,
enableTemperature,
enableEnergy> ScalarFluidState;
enableEnergy,
Indices::gasEnabled,
Indices::numPhases
> ScalarFluidState;
public:
template <class EclMaterialLawManager>
EclEquilInitializer(const Simulator& simulator,
EclMaterialLawManager& materialLawManager)
@ -123,18 +128,18 @@ public:
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
if (FluidSystem::phaseIsActive(phaseIdx))
fluidState.setSaturation(phaseIdx, initialState.saturation()[phaseIdx][elemIdx]);
else
else if (Indices::numPhases == 3)
fluidState.setSaturation(phaseIdx, 0.0);
}
if (FluidSystem::enableDissolvedGas())
fluidState.setRs(initialState.rs()[elemIdx]);
else
else if (Indices::gasEnabled)
fluidState.setRs(0.0);
if (FluidSystem::enableVaporizedOil())
fluidState.setRv(initialState.rv()[elemIdx]);
else
else if (Indices::gasEnabled)
fluidState.setRv(0.0);
@ -143,8 +148,11 @@ public:
fluidState.setTemperature(initialState.temperature()[elemIdx]);
// set the phase pressures.
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
if (!FluidSystem::phaseIsActive(phaseIdx))
continue;
fluidState.setPressure(phaseIdx, initialState.press()[phaseIdx][elemIdx]);
}
}
}

View File

@ -354,10 +354,7 @@ class EclProblem : public GET_PROP_TYPE(TypeTag, BaseProblem)
typedef BlackOilSolventModule<TypeTag> SolventModule;
typedef BlackOilPolymerModule<TypeTag> PolymerModule;
typedef Opm::BlackOilFluidState<Scalar,
FluidSystem,
enableTemperature,
enableEnergy> InitialFluidState;
typedef typename EclEquilInitializer<TypeTag>::ScalarFluidState InitialFluidState;
typedef Opm::MathToolbox<Evaluation> Toolbox;
typedef Dune::FieldMatrix<Scalar, dimWorld, dimWorld> DimMatrix;