28#ifndef EWOMS_IMMISCIBLE_INTENSIVE_QUANTITIES_HH
29#define EWOMS_IMMISCIBLE_INTENSIVE_QUANTITIES_HH
35#include <opm/material/fluidstates/ImmiscibleFluidState.hpp>
36#include <opm/material/common/Valgrind.hpp>
38#include <dune/common/fvector.hh>
39#include <dune/common/fmatrix.hh>
49template <
class TypeTag>
51 :
public GetPropType<TypeTag, Properties::DiscIntensiveQuantities>
53 ,
public GetPropType<TypeTag, Properties::FluxModule>::FluxIntensiveQuantities
66 enum { numPhases = getPropValue<TypeTag, Properties::NumPhases>() };
67 enum { pressure0Idx = Indices::pressure0Idx };
68 enum { saturation0Idx = Indices::saturation0Idx };
69 enum { enableEnergy = getPropValue<TypeTag, Properties::EnableEnergy>() };
70 enum { dimWorld = GridView::dimensionworld };
72 using Toolbox = Opm::MathToolbox<Evaluation>;
73 using DimMatrix = Dune::FieldMatrix<Scalar, dimWorld, dimWorld>;
74 using PhaseVector = Dune::FieldVector<Scalar, numPhases>;
75 using EvalPhaseVector = Dune::FieldVector<Evaluation, numPhases>;
77 using FluxIntensiveQuantities =
typename FluxModule::FluxIntensiveQuantities;
79 using FluidState = Opm::ImmiscibleFluidState<Evaluation, FluidSystem,
93 void update(
const ElementContext& elemCtx,
unsigned dofIdx,
unsigned timeIdx)
95 ParentType::update(elemCtx, dofIdx, timeIdx);
96 EnergyIntensiveQuantities::updateTemperatures_(
fluidState_, elemCtx, dofIdx, timeIdx);
99 const auto& problem = elemCtx.problem();
100 const typename MaterialLaw::Params& materialParams =
101 problem.materialLawParams(elemCtx, dofIdx, timeIdx);
102 const auto& priVars = elemCtx.primaryVars(dofIdx, timeIdx);
103 Opm::Valgrind::CheckDefined(priVars);
105 Evaluation sumSat = 0.0;
106 for (
unsigned phaseIdx = 0; phaseIdx < numPhases - 1; ++phaseIdx) {
107 const Evaluation& Salpha = priVars.makeEvaluation(saturation0Idx + phaseIdx, timeIdx);
111 fluidState_.setSaturation(numPhases - 1, 1 - sumSat);
114 MaterialLaw::capillaryPressures(pC, materialParams,
fluidState_);
115 Opm::Valgrind::CheckDefined(pC);
121 const Evaluation& p0 = priVars.makeEvaluation(pressure0Idx, timeIdx);
122 for (
unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
123 fluidState_.setPressure(phaseIdx, p0 + (pC[phaseIdx] - pC[0]));
125 typename FluidSystem::template ParameterCache<Evaluation> paramCache;
128 for (
unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
130 const Evaluation& mu = FluidSystem::viscosity(
fluidState_, paramCache, phaseIdx);
134 const Evaluation& rho = FluidSystem::density(
fluidState_, paramCache, phaseIdx);
141 porosity_ = problem.porosity(elemCtx, dofIdx, timeIdx);
144 intrinsicPerm_ = problem.intrinsicPermeability(elemCtx, dofIdx, timeIdx);
147 EnergyIntensiveQuantities::update_(
fluidState_, paramCache, elemCtx, dofIdx, timeIdx);
150 FluxIntensiveQuantities::update_(elemCtx, dofIdx, timeIdx);
180 const Evaluation&
mobility(
unsigned phaseIdx)
const
Provides the volumetric quantities required for the energy equation.
Definition: energymodule.hh:532
Contains the quantities which are are constant within a finite volume for the immiscible multi-phase ...
Definition: immiscibleintensivequantities.hh:54
FluidState fluidState_
Definition: immiscibleintensivequantities.hh:190
const Evaluation & relativePermeability(unsigned phaseIdx) const
Returns the relative permeability of a given phase within the control volume.
Definition: immiscibleintensivequantities.hh:171
ImmiscibleIntensiveQuantities & operator=(const ImmiscibleIntensiveQuantities &other)=default
Evaluation mobility_[numPhases]
Definition: immiscibleintensivequantities.hh:194
void update(const ElementContext &elemCtx, unsigned dofIdx, unsigned timeIdx)
Definition: immiscibleintensivequantities.hh:93
ImmiscibleIntensiveQuantities()
Definition: immiscibleintensivequantities.hh:83
const FluidState & fluidState() const
Returns the phase state for the control-volume.
Definition: immiscibleintensivequantities.hh:156
const Evaluation & mobility(unsigned phaseIdx) const
Returns the effective mobility of a given phase within the control volume.
Definition: immiscibleintensivequantities.hh:180
const Evaluation & porosity() const
Returns the average porosity within the control volume.
Definition: immiscibleintensivequantities.hh:186
DimMatrix intrinsicPerm_
Definition: immiscibleintensivequantities.hh:192
Evaluation porosity_
Definition: immiscibleintensivequantities.hh:191
const DimMatrix & intrinsicPermeability() const
Returns the intrinsic permeability tensor a degree of freedom.
Definition: immiscibleintensivequantities.hh:162
Evaluation relativePermeability_[numPhases]
Definition: immiscibleintensivequantities.hh:193
ImmiscibleIntensiveQuantities(const ImmiscibleIntensiveQuantities &other)=default
Contains the classes required to consider energy as a conservation quantity in a multi-phase module.
Defines the properties required for the immiscible multi-phase model.
Definition: blackoilboundaryratevector.hh:37
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition: propertysystem.hh:235