26#ifndef DUMUX_2P_VOLUME_VARIABLES_HH
27#define DUMUX_2P_VOLUME_VARIABLES_HH
41template <
class Traits>
48 using PermeabilityType =
typename Traits::PermeabilityType;
49 using ModelTraits =
typename Traits::ModelTraits;
51 using Scalar =
typename Traits::PrimaryVariables::value_type;
52 using FS =
typename Traits::FluidSystem;
56 pressureIdx = Indices::pressureIdx,
57 saturationIdx = Indices::saturationIdx,
59 phase0Idx = FS::phase0Idx,
60 phase1Idx = FS::phase1Idx
63 static constexpr auto formulation = ModelTraits::priVarFormulation();
84 template<
class ElemSol,
class Problem,
class Element,
class Scv>
86 const Problem &problem,
87 const Element &element,
94 using MaterialLaw =
typename Problem::SpatialParams::MaterialLaw;
95 const auto& materialParams = problem.spatialParams().materialLawParams(element, scv, elemSol);
97 const int wPhaseIdx = problem.spatialParams().template wettingPhase<FluidSystem>(element, scv, elemSol);
98 const int nPhaseIdx = 1 - wPhaseIdx;
100 mobility_[wPhaseIdx] =
101 MaterialLaw::krw(materialParams,
fluidState_.saturation(wPhaseIdx))
104 mobility_[nPhaseIdx] =
105 MaterialLaw::krn(materialParams,
fluidState_.saturation(wPhaseIdx))
110 EnergyVolVars::updateSolidEnergyParams(elemSol, problem, element, scv,
solidState_);
111 permeability_ = problem.spatialParams().permeability(element, scv, elemSol);
126 template<
class ElemSol,
class Problem,
class Element,
class Scv>
128 const Problem& problem,
129 const Element& element,
136 using MaterialLaw =
typename Problem::SpatialParams::MaterialLaw;
137 const auto& materialParams = problem.spatialParams().materialLawParams(element, scv, elemSol);
138 const auto&
priVars = elemSol[scv.localDofIndex()];
140 const int wPhaseIdx = problem.spatialParams().template wettingPhase<FluidSystem>(element, scv, elemSol);
144 if (wPhaseIdx == phase1Idx)
148 pc_ = MaterialLaw::pc(materialParams,
fluidState.saturation(wPhaseIdx));
153 const auto Sn = Traits::SaturationReconstruction::reconstructSn(problem.spatialParams(), element,
154 scv, elemSol,
priVars[saturationIdx]);
157 pc_ = MaterialLaw::pc(materialParams,
fluidState.saturation(wPhaseIdx));
164 if (wPhaseIdx == phase1Idx)
166 const auto Sn = Traits::SaturationReconstruction::reconstructSn(problem.spatialParams(), element,
167 scv, elemSol,
priVars[saturationIdx]);
170 pc_ = MaterialLaw::pc(materialParams,
fluidState.saturation(wPhaseIdx));
177 pc_ = MaterialLaw::pc(materialParams,
fluidState.saturation(wPhaseIdx));
182 typename FluidSystem::ParameterCache paramCache;
185 for (
int phaseIdx = 0; phaseIdx < ModelTraits::numFluidPhases(); ++phaseIdx) {
195 Scalar h = EnergyVolVars::enthalpy(
fluidState, paramCache, phaseIdx);
273 {
return mobility_[phaseIdx]; }
285 {
return permeability_; }
294 PermeabilityType permeability_;
295 Scalar mobility_[ModelTraits::numFluidPhases()];
Update the solid volume fractions (inert and reacitve) and set them in the solidstate.
Defines an enumeration for the formulations accepted by the two-phase model.
@ p1s0
first phase saturation and second phase pressure as primary variables
@ p0s1
first phase pressure and second phase saturation as primary variables
void updateSolidVolumeFractions(const ElemSol &elemSol, const Problem &problem, const Element &element, const Scv &scv, SolidState &solidState, const int solidVolFracOffset)
update the solid volume fractions (inert and reacitve) and set them in the solidstate
Definition: updatesolidvolumefractions.hh:36
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
Property tag Indices
Definition: porousmediumflow/sequential/properties.hh:59
std::string viscosity(int phaseIdx) noexcept
I/O name of viscosity for multiphase systems.
Definition: name.hh:74
std::string density(int phaseIdx) noexcept
I/O name of density for multiphase systems.
Definition: name.hh:65
Contains the quantities which are are constant within a finite volume in the two-phase model.
Definition: porousmediumflow/2p/volumevariables.hh:45
Scalar mobility(int phaseIdx) const
Returns the effective mobility of a given phase within the control volume in .
Definition: porousmediumflow/2p/volumevariables.hh:272
Scalar density(int phaseIdx) const
Returns the mass density of a given phase within the control volume in .
Definition: porousmediumflow/2p/volumevariables.hh:227
typename Traits::FluidSystem FluidSystem
Export type of fluid system.
Definition: porousmediumflow/2p/volumevariables.hh:67
void update(const ElemSol &elemSol, const Problem &problem, const Element &element, const Scv &scv)
Updates all quantities for a given control volume.
Definition: porousmediumflow/2p/volumevariables.hh:85
Scalar capillaryPressure() const
Returns the capillary pressure within the control volume in .
Definition: porousmediumflow/2p/volumevariables.hh:243
Scalar viscosity(int phaseIdx) const
Returns the dynamic viscosity of the fluid within the control volume in .
Definition: porousmediumflow/2p/volumevariables.hh:263
void completeFluidState(const ElemSol &elemSol, const Problem &problem, const Element &element, const Scv &scv, FluidState &fluidState, SolidState &solidState)
Sets complete fluid state.
Definition: porousmediumflow/2p/volumevariables.hh:127
FluidState fluidState_
Definition: porousmediumflow/2p/volumevariables.hh:288
Scalar porosity() const
Returns the average porosity within the control volume in .
Definition: porousmediumflow/2p/volumevariables.hh:278
SolidState solidState_
Definition: porousmediumflow/2p/volumevariables.hh:289
typename Traits::SolidState SolidState
Export type of solid state.
Definition: porousmediumflow/2p/volumevariables.hh:71
Scalar pressure(int phaseIdx) const
Returns the effective pressure of a given phase within the control volume in .
Definition: porousmediumflow/2p/volumevariables.hh:236
const PermeabilityType & permeability() const
Returns the permeability within the control volume in .
Definition: porousmediumflow/2p/volumevariables.hh:284
Scalar saturation(int phaseIdx) const
Returns the saturation of a given phase within the control volume in .
Definition: porousmediumflow/2p/volumevariables.hh:218
const SolidState & solidState() const
Returns the phase state for the control volume.
Definition: porousmediumflow/2p/volumevariables.hh:209
typename Traits::SolidSystem SolidSystem
Export type of solid system.
Definition: porousmediumflow/2p/volumevariables.hh:73
typename Traits::FluidState FluidState
Export type of fluid state.
Definition: porousmediumflow/2p/volumevariables.hh:69
const FluidState & fluidState() const
Returns the phase state for the control volume.
Definition: porousmediumflow/2p/volumevariables.hh:203
Scalar temperature() const
Returns temperature inside the sub-control volume in .
Definition: porousmediumflow/2p/volumevariables.hh:254
Definition: porousmediumflow/nonisothermal/volumevariables.hh:75
The isothermal base class.
Definition: porousmediumflow/volumevariables.hh:40
static constexpr int numFluidComponents()
Return number of components considered by the model.
Definition: porousmediumflow/volumevariables.hh:52
const PrimaryVariables & priVars() const
Returns the vector of primary variables.
Definition: porousmediumflow/volumevariables.hh:76
void update(const ElemSol &elemSol, const Problem &problem, const Element &element, const Scv &scv)
Updates all quantities for a given control volume.
Definition: porousmediumflow/volumevariables.hh:64
Base class for the model specific class which provides access to all volume averaged quantities.
Base class for the model specific class which provides access to all volume averaged quantities.