26 #ifndef EWOMS_IMMISCIBLE_INTENSIVE_QUANTITIES_HH
27 #define EWOMS_IMMISCIBLE_INTENSIVE_QUANTITIES_HH
32 #include <opm/material/fluidstates/ImmiscibleFluidState.hpp>
34 #include <dune/common/fvector.hh>
35 #include <dune/common/fmatrix.hh>
45 template <
class TypeTag>
49 ,
public GET_PROP_TYPE(TypeTag, FluxModule)::FluxIntensiveQuantities
51 typedef typename GET_PROP_TYPE(TypeTag, DiscIntensiveQuantities) ParentType;
53 typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
54 typedef typename GET_PROP_TYPE(TypeTag, Evaluation) Evaluation;
55 typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
56 typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw;
57 typedef typename GET_PROP_TYPE(TypeTag, ElementContext) ElementContext;
58 typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices;
59 typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
60 typedef typename GET_PROP_TYPE(TypeTag, FluxModule) FluxModule;
63 enum { pressure0Idx = Indices::pressure0Idx };
64 enum { saturation0Idx = Indices::saturation0Idx };
66 enum { dimWorld = GridView::dimensionworld };
68 typedef Opm::MathToolbox<Evaluation> Toolbox;
69 typedef Dune::FieldMatrix<Scalar, dimWorld, dimWorld> DimMatrix;
70 typedef Dune::FieldVector<Scalar, numPhases> PhaseVector;
71 typedef Dune::FieldVector<Evaluation, numPhases> EvalPhaseVector;
73 typedef typename FluxModule::FluxIntensiveQuantities FluxIntensiveQuantities;
75 typedef Opm::ImmiscibleFluidState<Evaluation, FluidSystem,
76 enableEnergy> FluidState;
82 void update(
const ElementContext &elemCtx,
int dofIdx,
int timeIdx)
84 ParentType::update(elemCtx, dofIdx, timeIdx);
85 EnergyIntensiveQuantities::updateTemperatures_(
fluidState_, elemCtx, dofIdx, timeIdx);
88 typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw;
89 const auto &problem = elemCtx.problem();
90 const typename MaterialLaw::Params &materialParams =
91 problem.materialLawParams(elemCtx, dofIdx, timeIdx);
92 const auto &priVars = elemCtx.primaryVars(dofIdx, timeIdx);
93 Valgrind::CheckDefined(priVars);
95 Evaluation sumSat = Toolbox::createConstant(0.0);
96 for (
int phaseIdx = 0; phaseIdx < numPhases - 1; ++phaseIdx) {
97 const Evaluation& Salpha = priVars.makeEvaluation(saturation0Idx + phaseIdx, timeIdx);
101 fluidState_.setSaturation(numPhases - 1, 1 - sumSat);
104 MaterialLaw::capillaryPressures(pC, materialParams,
fluidState_);
105 Valgrind::CheckDefined(pC);
111 const Evaluation& p0 = priVars.makeEvaluation(pressure0Idx, timeIdx);
112 for (
int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
113 fluidState_.setPressure(phaseIdx, p0 + (pC[phaseIdx] - pC[0]));
115 typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
116 typename FluidSystem::ParameterCache paramCache;
119 for (
int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
121 const Evaluation& mu = FluidSystem::viscosity(
fluidState_, paramCache, phaseIdx);
125 const Evaluation& rho = FluidSystem::density(
fluidState_, paramCache, phaseIdx);
132 porosity_ = problem.porosity(elemCtx, dofIdx, timeIdx);
135 intrinsicPerm_ = problem.intrinsicPermeability(elemCtx, dofIdx, timeIdx);
138 EnergyIntensiveQuantities::update_(
fluidState_, paramCache, elemCtx, dofIdx, timeIdx);
141 FluxIntensiveQuantities::update_(elemCtx, dofIdx, timeIdx);
Provides the volumetric quantities required for the energy equation.
Definition: energymodule.hh:530
void update(const ElementContext &elemCtx, int dofIdx, int timeIdx)
Definition: immiscibleintensivequantities.hh:82
#define GET_PROP_VALUE(TypeTag, PropTagName)
Access the value attribute of a property for a type tag.
Definition: propertysystem.hh:468
Evaluation relativePermeability_[numPhases]
Definition: immiscibleintensivequantities.hh:184
#define GET_PROP_TYPE(TypeTag, PropTagName)
Access the type attribute of a property for a type tag.
Definition: propertysystem.hh:485
const FluidState & fluidState() const
Returns the phase state for the control-volume.
Definition: immiscibleintensivequantities.hh:147
Evaluation mobility_[numPhases]
Definition: immiscibleintensivequantities.hh:185
DimMatrix intrinsicPerm_
Definition: immiscibleintensivequantities.hh:183
Defines the properties required for the immiscible multi-phase model.
const Evaluation & mobility(int phaseIdx) const
Returns the effective mobility of a given phase within the control volume.
Definition: immiscibleintensivequantities.hh:171
Definition: baseauxiliarymodule.hh:35
Evaluation porosity_
Definition: immiscibleintensivequantities.hh:182
FluidState fluidState_
Definition: immiscibleintensivequantities.hh:181
const DimMatrix & intrinsicPermeability() const
Returns the intrinsic permeability tensor a degree of freedom.
Definition: immiscibleintensivequantities.hh:153
const Evaluation & relativePermeability(int phaseIdx) const
Returns the relative permeability of a given phase within the control volume.
Definition: immiscibleintensivequantities.hh:162
const Evaluation & porosity() const
Returns the average porosity within the control volume.
Definition: immiscibleintensivequantities.hh:177
Contains the quantities which are are constant within a finite volume for the immiscible multi-phase ...
Definition: immiscibleintensivequantities.hh:46
Contains the classes required to consider energy as a conservation quantity in a multi-phase module...