26 #ifndef EWOMS_IMMISCIBLE_PRIMARY_VARIABLES_HH
27 #define EWOMS_IMMISCIBLE_PRIMARY_VARIABLES_HH
34 #include <opm/material/constraintsolvers/ImmiscibleFlash.hpp>
35 #include <opm/material/fluidstates/ImmiscibleFluidState.hpp>
37 #include <dune/common/fvector.hh>
50 template <
class TypeTag>
55 typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
56 typedef typename GET_PROP_TYPE(TypeTag, Evaluation) Evaluation;
57 typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) Implementation;
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;
62 typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices;
65 enum { pressure0Idx = Indices::pressure0Idx };
66 enum { saturation0Idx = Indices::saturation0Idx };
71 typedef typename Opm::MathToolbox<Evaluation> Toolbox;
72 typedef Dune::FieldVector<Scalar, numComponents> ComponentVector;
73 typedef Opm::ImmiscibleFlash<Scalar, FluidSystem> ImmiscibleFlash;
81 { Valgrind::SetUndefined(*
this); }
120 template <
class Flu
idState>
122 const MaterialLawParams &matParams,
123 bool isInEquilibrium =
false)
125 ComponentVector globalMolarities(0.0);
126 for (
int compIdx = 0; compIdx < numComponents; ++compIdx) {
127 for (
int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
128 globalMolarities[compIdx] +=
129 fluidState.molarity(phaseIdx, compIdx) * fluidState.saturation(phaseIdx);
133 Opm::ImmiscibleFluidState<Scalar, FluidSystem> fsFlash;
134 fsFlash.assign(fluidState);
135 typename FluidSystem::ParameterCache paramCache;
136 ImmiscibleFlash::template solve<MaterialLaw>(fsFlash,
160 template <
class Flu
idState>
165 EnergyModule::setPriVarTemperatures(asImp_(), fluidState);
167 (*this)[pressure0Idx] = fluidState.pressure(0);
168 for (
int phaseIdx = 0; phaseIdx < numPhases - 1; ++phaseIdx)
169 (*
this)[saturation0Idx + phaseIdx] = fluidState.saturation(phaseIdx);
173 Implementation &asImp_()
174 {
return *
static_cast<Implementation *
>(
this); }
ImmisciblePrimaryVariables(Scalar value)
Constructor with assignment from scalar.
Definition: immiscibleprimaryvariables.hh:88
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
Represents the primary variables used by the a model.
Definition: fvbaseprimaryvariables.hh:41
Defines the properties required for the immiscible multi-phase model.
Provides the auxiliary methods required for consideration of the energy equation. ...
Definition: energymodule.hh:54
Definition: baseauxiliarymodule.hh:35
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: immiscibleprimaryvariables.hh:121
void assignNaive(const FluidState &fluidState)
Directly retrieve the primary variables from an arbitrary fluid state.
Definition: immiscibleprimaryvariables.hh:161
Represents the primary variables used by the immiscible multi-phase, model.
Definition: immiscibleprimaryvariables.hh:51
ImmisciblePrimaryVariables(const ImmisciblePrimaryVariables &value)
Copy constructor.
Definition: immiscibleprimaryvariables.hh:96
ImmisciblePrimaryVariables()
Default constructor.
Definition: immiscibleprimaryvariables.hh:80
Contains the classes required to consider energy as a conservation quantity in a multi-phase module...