25#ifndef DUMUX_RICHARDSEXTENDED_VOLUME_VARIABLES_HH
26#define DUMUX_RICHARDSEXTENDED_VOLUME_VARIABLES_HH
30#include <dune/common/exceptions.hh>
49template <
class Traits>
56 using Scalar =
typename Traits::PrimaryVariables::value_type;
57 using PermeabilityType =
typename Traits::PermeabilityType;
58 using ModelTraits =
typename Traits::ModelTraits;
63 using EffDiffModel =
typename Traits::EffectiveDiffusivityModel;
66 static constexpr auto fsCheck = ModelTraits::checkFluidSystem(
typename Traits::FluidSystem{});
78 using Indices =
typename Traits::ModelTraits::Indices;
83 static constexpr auto gasPhaseIdx = Traits::FluidSystem::phase1Idx;
94 template<
class ElemSol,
class Problem,
class Element,
class Scv>
96 const Problem &problem,
97 const Element &element,
102 const auto fluidMatrixInteraction = problem.spatialParams().fluidMatrixInteraction(element, scv, elemSol);
104 const auto&
priVars = elemSol[scv.localDofIndex()];
105 const auto phasePresence =
priVars.state();
109 minPc_ = fluidMatrixInteraction.endPointPc();
114 typename FluidSystem::ParameterCache paramCache;
115 auto getEffectiveDiffusionCoefficient = [&](
int phaseIdx,
int compIIdx,
int compJIdx)
117 return EffDiffModel::effectiveDiffusionCoefficient(*
this, phaseIdx, compIIdx, compJIdx);
120 if (phasePresence == Indices::gasPhaseOnly)
138 const Scalar pc = fluidMatrixInteraction.pc(0.0);
160 FluidSystem::comp1Idx,
161 FluidSystem::comp0Idx);
163 else if (phasePresence == Indices::bothPhases)
184 FluidSystem::comp1Idx,
185 FluidSystem::comp0Idx);
187 else if (phasePresence == Indices::liquidPhaseOnly)
206 EnergyVolVars::updateSolidEnergyParams(elemSol, problem, element, scv,
solidState_);
207 permeability_ = problem.spatialParams().permeability(element, scv, elemSol);
208 EnergyVolVars::updateEffectiveThermalConductivity();
370 if (compIdx != FluidSystem::comp0Idx)
371 DUNE_THROW(Dune::InvalidStateException,
"There is only one component for Richards!");
384 if (compIdx != FluidSystem::comp0Idx)
385 DUNE_THROW(Dune::InvalidStateException,
"There is only one component for Richards!");
406 assert(compIIdx != compJIdx);
407 typename FluidSystem::ParameterCache paramCache;
409 return FluidSystem::binaryDiffusionCoefficient(
fluidState_, paramCache, phaseIdx, compIIdx, compJIdx);
418 assert(compIIdx != compJIdx);
436 template<
class ElemSol,
class Problem,
class Element,
class Scv>
437 void completeFluidState_(
const ElemSol& elemSol,
438 const Problem& problem,
439 const Element& element,
446 const auto fluidMatrixInteraction = problem.spatialParams().fluidMatrixInteraction(element, scv, elemSol);
448 const auto&
priVars = elemSol[scv.localDofIndex()];
452 Scalar minPc = fluidMatrixInteraction.pc(1.0);
460 const Scalar pc = max(fluidMatrixInteraction.endPointPc(),
462 const Scalar sw = fluidMatrixInteraction.sw(pc);
467 typename FluidSystem::ParameterCache paramCache;
Update the solid volume fractions (inert and reacitve) and set them in the solidstate.
Relations valid for an ideal gas.
A central place for various physical constants occurring in some equations.
EnergyVolumeVariablesImplementation< IsothermalTraits, Impl, IsothermalTraits::ModelTraits::enableEnergyBalance()> EnergyVolumeVariables
Base class for the model specific class which provides access to all volume averaged quantities.
Definition porousmediumflow/nonisothermal/volumevariables.hh:85
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
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
Definition adapt.hh:29
static constexpr Scalar molarDensity(Scalar temperature, Scalar pressure)
The molar density of the gas , depending on pressure and temperature.
Definition idealgas.hh:70
The primary variable switch controlling the phase presence state variable.
Definition richardsextended/primaryvariableswitch.hh:41
Volume averaged quantities required by the extended Richards model.
Definition porousmediumflow/richardsextended/volumevariables.hh:53
PermeabilityType permeability_
Definition porousmediumflow/richardsextended/volumevariables.hh:486
const SolidState & solidState() const
Returns the phase state for the control volume.
Definition porousmediumflow/richardsextended/volumevariables.hh:221
Scalar massFraction_[numPhases]
Definition porousmediumflow/richardsextended/volumevariables.hh:489
Scalar diffusionCoefficient(int phaseIdx, int compIIdx, int compJIdx) const
Returns the binary diffusion coefficients for a phase in .
Definition porousmediumflow/richardsextended/volumevariables.hh:403
Scalar porosity() const
Returns the average porosity [] within the control volume.
Definition porousmediumflow/richardsextended/volumevariables.hh:236
typename NITraits< BaseTraits, ETCM >::SolidState SolidState
Definition porousmediumflow/richardsextended/volumevariables.hh:75
void update(const ElemSol &elemSol, const Problem &problem, const Element &element, const Scv &scv)
Updates all quantities for a given control volume.
Definition porousmediumflow/richardsextended/volumevariables.hh:95
Scalar molarDensity_[numPhases]
Definition porousmediumflow/richardsextended/volumevariables.hh:490
Scalar effectiveDiffCoeff_
Definition porousmediumflow/richardsextended/volumevariables.hh:493
Scalar relativePermeabilityWetting_
Definition porousmediumflow/richardsextended/volumevariables.hh:485
Scalar pressureHead(const int phaseIdx=liquidPhaseIdx) const
Returns the pressureHead of a given phase within the control volume.
Definition porousmediumflow/richardsextended/volumevariables.hh:345
typename NITraits< BaseTraits, ETCM >::FluidState FluidState
Definition porousmediumflow/richardsextended/volumevariables.hh:72
Scalar viscosity(const int phaseIdx=liquidPhaseIdx) const
Returns the dynamic viscosity of a given phase within the control volume.
Definition porousmediumflow/richardsextended/volumevariables.hh:302
Scalar effectiveDiffusionCoefficient(int phaseIdx, int compIIdx, int compJIdx) const
Returns the effective diffusion coefficients for a phase in .
Definition porousmediumflow/richardsextended/volumevariables.hh:415
Scalar mobility(const int phaseIdx=liquidPhaseIdx) const
Returns the effective mobility of a given phase within the control volume.
Definition porousmediumflow/richardsextended/volumevariables.hh:292
Scalar minPc_
Definition porousmediumflow/richardsextended/volumevariables.hh:487
Scalar saturation(const int phaseIdx=liquidPhaseIdx) const
Returns the average absolute saturation [] of a given fluid phase within the finite volume.
Definition porousmediumflow/richardsextended/volumevariables.hh:255
Scalar density(const int phaseIdx=liquidPhaseIdx) const
Returns the average mass density of a given fluid phase within the control volume.
Definition porousmediumflow/richardsextended/volumevariables.hh:264
Scalar relativePermeability(const int phaseIdx=liquidPhaseIdx) const
Returns relative permeability [-] of a given phase within the control volume.
Definition porousmediumflow/richardsextended/volumevariables.hh:311
typename NITraits< BaseTraits, ETCM >::ModelTraits::Indices Indices
Definition porousmediumflow/richardsextended/volumevariables.hh:78
static constexpr auto gasPhaseIdx
Definition porousmediumflow/richardsextended/volumevariables.hh:83
const PermeabilityType & permeability() const
Returns the permeability within the control volume in .
Definition porousmediumflow/richardsextended/volumevariables.hh:242
Scalar capillaryPressure() const
Returns the effective capillary pressure within the control volume.
Definition porousmediumflow/richardsextended/volumevariables.hh:325
Scalar moleFraction_[numPhases]
Definition porousmediumflow/richardsextended/volumevariables.hh:488
Scalar massFraction(const int phaseIdx, const int compIdx) const
Returns the mole fraction of a given component in a given phase within the control volume in .
Definition porousmediumflow/richardsextended/volumevariables.hh:382
SolidState solidState_
Definition porousmediumflow/richardsextended/volumevariables.hh:484
Scalar molarDensity(const int phaseIdx) const
Returns the mass density of a given phase within the control volume in .
Definition porousmediumflow/richardsextended/volumevariables.hh:395
Scalar moleFraction(const int phaseIdx, const int compIdx) const
Returns the mole fraction of a given component in a given phase within the control volume in .
Definition porousmediumflow/richardsextended/volumevariables.hh:368
typename NITraits< BaseTraits, ETCM >::FluidSystem FluidSystem
Definition porousmediumflow/richardsextended/volumevariables.hh:70
Scalar pressure(const int phaseIdx=liquidPhaseIdx) const
Returns the effective pressure of a given phase within the control volume.
Definition porousmediumflow/richardsextended/volumevariables.hh:278
const FluidState & fluidState() const
Returns the fluid configuration at the given primary variables.
Definition porousmediumflow/richardsextended/volumevariables.hh:215
Scalar waterContent(const int phaseIdx=liquidPhaseIdx) const
Returns the water content of a fluid phase within the finite volume.
Definition porousmediumflow/richardsextended/volumevariables.hh:358
Scalar temperature() const
Returns the temperature.
Definition porousmediumflow/richardsextended/volumevariables.hh:227
FluidState fluidState_
Definition porousmediumflow/richardsextended/volumevariables.hh:483
typename NITraits< BaseTraits, ETCM >::SolidSystem SolidSystem
Definition porousmediumflow/richardsextended/volumevariables.hh:77
ExtendedRichardsPrimaryVariableSwitch PrimaryVariableSwitch
Definition porousmediumflow/richardsextended/volumevariables.hh:79
static constexpr auto liquidPhaseIdx
Definition porousmediumflow/richardsextended/volumevariables.hh:82
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
Definition porousmediumflow/volumevariables.hh:76
static constexpr int numFluidPhases()
Return number of phases considered by the model.
Definition porousmediumflow/volumevariables.hh:50
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.
The primary variable switch for the extended Richards model.