26 #ifndef EWOMS_RICHARDS_PRIMARY_VARIABLES_HH
27 #define EWOMS_RICHARDS_PRIMARY_VARIABLES_HH
33 #include <opm/material/constraintsolvers/ImmiscibleFlash.hpp>
34 #include <opm/material/fluidstates/ImmiscibleFluidState.hpp>
36 #include <dune/common/fvector.hh>
48 template <
class TypeTag>
52 typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
53 typedef typename GET_PROP_TYPE(TypeTag, Evaluation) Evaluation;
54 typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
55 typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw;
56 typedef typename GET_PROP_TYPE(TypeTag, MaterialLawParams) MaterialLawParams;
57 typedef typename GET_PROP_TYPE(TypeTag, IntensiveQuantities)
EnergyModule;
58 typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices;
61 enum { pressureWIdx = Indices::pressureWIdx };
63 enum { liquidPhaseIdx =
GET_PROP_VALUE(TypeTag, LiquidPhaseIndex) };
69 typedef Dune::FieldVector<Scalar, numComponents> ComponentVector;
70 typedef Dune::FieldVector<Scalar, numPhases> PhaseVector;
71 typedef typename Opm::MathToolbox<Evaluation> Toolbox;
72 typedef Opm::ImmiscibleFlash<Scalar, FluidSystem> ImmiscibleFlash;
76 { Valgrind::SetUndefined(*
this); }
102 const MaterialLawParams &matParams)
104 Opm::ImmiscibleFluidState<Scalar, FluidSystem> fs;
106 fs.setTemperature(T);
107 fs.setSaturation(liquidPhaseIdx, Sw);
108 fs.setSaturation(gasPhaseIdx, 1 - Sw);
112 MaterialLaw::capillaryPressures(pC, matParams, fs);
114 fs.setPressure(liquidPhaseIdx, pw);
115 fs.setPressure(gasPhaseIdx, pw + (pC[gasPhaseIdx] - pC[liquidPhaseIdx]));
130 const MaterialLawParams &matParams)
132 Opm::ImmiscibleFluidState<Scalar, FluidSystem> fs;
134 fs.setTemperature(T);
135 fs.setSaturation(liquidPhaseIdx, 1 - Sn);
136 fs.setSaturation(gasPhaseIdx, Sn);
140 MaterialLaw::capillaryPressures(pC, matParams, fs);
142 fs.setPressure(gasPhaseIdx, pn);
143 fs.setPressure(gasPhaseIdx, pn + (pC[liquidPhaseIdx] - pC[gasPhaseIdx]));
151 template <
class Flu
idState>
153 const MaterialLawParams &matParams,
154 bool isInEquilibrium =
false)
156 ComponentVector globalMolarities(0.0);
157 for (
int compIdx = 0; compIdx < numComponents; ++compIdx) {
158 for (
int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
159 globalMolarities[compIdx] +=
160 fluidState.molarity(phaseIdx, compIdx) * fluidState.saturation(phaseIdx);
164 Opm::ImmiscibleFluidState<Scalar, FluidSystem> fsFlash;
165 fsFlash.assign(fluidState);
166 typename FluidSystem::ParameterCache paramCache;
167 ImmiscibleFlash::template solve<MaterialLaw>(fsFlash, paramCache,
177 template <
class Flu
idState>
182 EnergyModule::setPriVarTemperatures(*
this, fluidState);
184 (*this)[pressureWIdx] = fluidState.pressure(liquidPhaseIdx);
Represents the primary variables used by the a model.
#define GET_PROP_VALUE(TypeTag, PropTagName)
Access the value attribute of a property for a type tag.
Definition: propertysystem.hh:468
RichardsPrimaryVariables(const RichardsPrimaryVariables &value)
Default constructor.
Definition: richardsprimaryvariables.hh:88
Represents the primary variables used by the a model.
Definition: fvbaseprimaryvariables.hh:41
RichardsPrimaryVariables()
Definition: richardsprimaryvariables.hh:75
Provides the auxiliary methods required for consideration of the energy equation. ...
Definition: energymodule.hh:54
RichardsPrimaryVariables(Scalar value)
Constructor with assignment from scalar.
Definition: richardsprimaryvariables.hh:81
Definition: baseauxiliarymodule.hh:35
Represents the primary variables used in the Richards model.
Definition: richardsprimaryvariables.hh:49
void assignMassConservative(const FluidState &fluidState, const MaterialLawParams &matParams, bool isInEquilibrium=false)
Set the primary variables from an arbitrary fluid state in a mass conservative way.
Definition: richardsprimaryvariables.hh:152
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:129
Contains the property declarations for the Richards model.
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:101
void assignNaive(const FluidState &fluidState)
Directly retrieve the primary variables from an arbitrary fluid state.
Definition: richardsprimaryvariables.hh:178