28 #ifndef EWOMS_RICHARDS_PRIMARY_VARIABLES_HH
29 #define EWOMS_RICHARDS_PRIMARY_VARIABLES_HH
35 #include <opm/material/constraintsolvers/ImmiscibleFlash.hpp>
36 #include <opm/material/fluidstates/ImmiscibleFluidState.hpp>
37 #include <opm/common/Valgrind.hpp>
38 #include <opm/common/Unused.hpp>
40 #include <dune/common/fvector.hh>
52 template <
class TypeTag>
56 typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
57 typedef typename GET_PROP_TYPE(TypeTag, Evaluation) Evaluation;
58 typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
59 typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw;
60 typedef typename GET_PROP_TYPE(TypeTag, MaterialLawParams) MaterialLawParams;
61 typedef typename GET_PROP_TYPE(TypeTag, IntensiveQuantities)
EnergyModule;
62 typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices;
65 enum { pressureWIdx = Indices::pressureWIdx };
67 enum { liquidPhaseIdx =
GET_PROP_VALUE(TypeTag, LiquidPhaseIndex) };
73 typedef Dune::FieldVector<Scalar, numComponents> ComponentVector;
74 typedef Dune::FieldVector<Scalar, numPhases> PhaseVector;
75 typedef typename Opm::MathToolbox<Evaluation> Toolbox;
76 typedef Opm::ImmiscibleFlash<Scalar, FluidSystem> ImmiscibleFlash;
80 { Opm::Valgrind::SetUndefined(*
this); }
105 const MaterialLawParams& matParams)
107 Opm::ImmiscibleFluidState<Scalar, FluidSystem> fs;
109 fs.setTemperature(T);
110 fs.setSaturation(liquidPhaseIdx, Sw);
111 fs.setSaturation(gasPhaseIdx, 1 - Sw);
115 MaterialLaw::capillaryPressures(pC, matParams, fs);
117 fs.setPressure(liquidPhaseIdx, pw);
118 fs.setPressure(gasPhaseIdx, pw + (pC[gasPhaseIdx] - pC[liquidPhaseIdx]));
133 const MaterialLawParams& matParams)
135 Opm::ImmiscibleFluidState<Scalar, FluidSystem> fs;
137 fs.setTemperature(T);
138 fs.setSaturation(liquidPhaseIdx, 1 - Sn);
139 fs.setSaturation(gasPhaseIdx, Sn);
143 MaterialLaw::capillaryPressures(pC, matParams, fs);
145 fs.setPressure(gasPhaseIdx, pn);
146 fs.setPressure(gasPhaseIdx, pn + (pC[liquidPhaseIdx] - pC[gasPhaseIdx]));
154 template <
class Flu
idState>
156 const MaterialLawParams& matParams,
157 bool isInEquilibrium OPM_UNUSED=
false)
159 ComponentVector globalMolarities(0.0);
160 for (
unsigned compIdx = 0; compIdx < numComponents; ++compIdx) {
161 for (
unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
162 globalMolarities[compIdx] +=
163 fluidState.molarity(phaseIdx, compIdx) * fluidState.saturation(phaseIdx);
167 Opm::ImmiscibleFluidState<Scalar, FluidSystem> fsFlash;
168 fsFlash.assign(fluidState);
169 typename FluidSystem::ParameterCache paramCache;
170 ImmiscibleFlash::template solve<MaterialLaw>(fsFlash, paramCache,
180 template <
class Flu
idState>
185 EnergyModule::setPriVarTemperatures(*
this, fluidState);
187 (*this)[pressureWIdx] = fluidState.pressure(liquidPhaseIdx);
Provides the auxiliary methods required for consideration of the energy equation. ...
Definition: energymodule.hh:59
#define GET_PROP_VALUE(TypeTag, PropTagName)
Access the value attribute of a property for a type tag.
Definition: propertysystem.hh:469
Represents the primary variables used in the Richards model.
Definition: richardsprimaryvariables.hh:53
Contains the property declarations for the Richards model.
Represents the primary variables used by the a model.
Definition: fvbaseprimaryvariables.hh:48
RichardsPrimaryVariables(Scalar value)
Constructor with assignment from scalar.
Definition: richardsprimaryvariables.hh:85
void assignMassConservative(const FluidState &fluidState, const MaterialLawParams &matParams, bool isInEquilibrium OPM_UNUSED=false)
Set the primary variables from an arbitrary fluid state in a mass conservative way.
Definition: richardsprimaryvariables.hh:155
Represents the primary variables used by the a model.
void assignNaive(const FluidState &fluidState)
Directly retrieve the primary variables from an arbitrary fluid state.
Definition: richardsprimaryvariables.hh:181
void assignImmiscibleFromNonWetting(Scalar T, Scalar pn, Scalar Sn, const MaterialLawParams &matParams)
Set the primary variables with the non-wetting phase pressure, saturation and temperature.
Definition: richardsprimaryvariables.hh:132
void assignImmiscibleFromWetting(Scalar T, Scalar pw, Scalar Sw, const MaterialLawParams &matParams)
Set the primary variables with the wetting phase pressure, saturation and temperature.
Definition: richardsprimaryvariables.hh:104