13#ifndef DUMUX_RICHARDSEXTENDED_VOLUME_VARIABLES_HH
14#define DUMUX_RICHARDSEXTENDED_VOLUME_VARIABLES_HH
18#include <dune/common/exceptions.hh>
37template <
class Traits>
44 using Scalar =
typename Traits::PrimaryVariables::value_type;
45 using PermeabilityType =
typename Traits::PermeabilityType;
46 using ModelTraits =
typename Traits::ModelTraits;
51 using EffDiffModel =
typename Traits::EffectiveDiffusivityModel;
54 static constexpr auto fsCheck = ModelTraits::checkFluidSystem(
typename Traits::FluidSystem{});
66 using Indices =
typename Traits::ModelTraits::Indices;
71 static constexpr auto gasPhaseIdx = Traits::FluidSystem::phase1Idx;
82 template<
class ElemSol,
class Problem,
class Element,
class Scv>
84 const Problem &problem,
85 const Element &element,
90 const auto fluidMatrixInteraction = problem.spatialParams().fluidMatrixInteraction(element, scv, elemSol);
92 const auto&
priVars = elemSol[scv.localDofIndex()];
93 const auto phasePresence =
priVars.state();
97 minPc_ = fluidMatrixInteraction.endPointPc();
102 typename FluidSystem::ParameterCache paramCache;
103 auto getEffectiveDiffusionCoefficient = [&](
int phaseIdx,
int compIIdx,
int compJIdx)
105 return EffDiffModel::effectiveDiffusionCoefficient(*
this, phaseIdx, compIIdx, compJIdx);
108 if (phasePresence == Indices::gasPhaseOnly)
126 const Scalar pc = fluidMatrixInteraction.pc(0.0);
148 FluidSystem::comp1Idx,
149 FluidSystem::comp0Idx);
151 else if (phasePresence == Indices::bothPhases)
172 FluidSystem::comp1Idx,
173 FluidSystem::comp0Idx);
175 else if (phasePresence == Indices::liquidPhaseOnly)
194 EnergyVolVars::updateSolidEnergyParams(elemSol, problem, element, scv,
solidState_);
195 permeability_ = problem.spatialParams().permeability(element, scv, elemSol);
196 EnergyVolVars::updateEffectiveThermalConductivity();
358 if (compIdx != FluidSystem::comp0Idx)
359 DUNE_THROW(Dune::InvalidStateException,
"There is only one component for Richards!");
372 if (compIdx != FluidSystem::comp0Idx)
373 DUNE_THROW(Dune::InvalidStateException,
"There is only one component for Richards!");
394 assert(compIIdx != compJIdx);
395 typename FluidSystem::ParameterCache paramCache;
397 return FluidSystem::binaryDiffusionCoefficient(
fluidState_, paramCache, phaseIdx, compIIdx, compJIdx);
406 assert(compIIdx != compJIdx);
424 template<
class ElemSol,
class Problem,
class Element,
class Scv>
425 void completeFluidState_(
const ElemSol& elemSol,
426 const Problem& problem,
427 const Element& element,
434 const auto fluidMatrixInteraction = problem.spatialParams().fluidMatrixInteraction(element, scv, elemSol);
436 const auto&
priVars = elemSol[scv.localDofIndex()];
440 Scalar minPc = fluidMatrixInteraction.pc(1.0);
448 const Scalar pc = max(fluidMatrixInteraction.endPointPc(),
450 const Scalar sw = fluidMatrixInteraction.sw(pc);
455 typename FluidSystem::ParameterCache paramCache;
Definition porousmediumflow/nonisothermal/volumevariables.hh:63
The primary variable switch controlling the phase presence state variable.
Definition richardsextended/primaryvariableswitch.hh:29
Volume averaged quantities required by the extended Richards model.
Definition porousmediumflow/richardsextended/volumevariables.hh:41
PermeabilityType permeability_
the intrinsic permeability
Definition porousmediumflow/richardsextended/volumevariables.hh:474
const SolidState & solidState() const
Returns the phase state for the control volume.
Definition porousmediumflow/richardsextended/volumevariables.hh:209
Scalar massFraction_[numPhases]
The water mass fractions in water and air.
Definition porousmediumflow/richardsextended/volumevariables.hh:477
Scalar diffusionCoefficient(int phaseIdx, int compIIdx, int compJIdx) const
Returns the binary diffusion coefficients for a phase in .
Definition porousmediumflow/richardsextended/volumevariables.hh:391
Scalar porosity() const
Returns the average porosity [] within the control volume.
Definition porousmediumflow/richardsextended/volumevariables.hh:224
typename Traits::SolidState SolidState
Definition porousmediumflow/richardsextended/volumevariables.hh:63
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:83
Scalar molarDensity_[numPhases]
The molar density of water and air.
Definition porousmediumflow/richardsextended/volumevariables.hh:478
Scalar effectiveDiffCoeff_
Definition porousmediumflow/richardsextended/volumevariables.hh:481
Scalar relativePermeabilityWetting_
the relative permeability of the wetting phase
Definition porousmediumflow/richardsextended/volumevariables.hh:473
Scalar pressureHead(const int phaseIdx=liquidPhaseIdx) const
Returns the pressureHead of a given phase within the control volume.
Definition porousmediumflow/richardsextended/volumevariables.hh:333
typename Traits::FluidState FluidState
Export type of the fluid state.
Definition porousmediumflow/richardsextended/volumevariables.hh:60
Scalar viscosity(const int phaseIdx=liquidPhaseIdx) const
Returns the dynamic viscosity of a given phase within the control volume.
Definition porousmediumflow/richardsextended/volumevariables.hh:290
Scalar effectiveDiffusionCoefficient(int phaseIdx, int compIIdx, int compJIdx) const
Returns the effective diffusion coefficients for a phase in .
Definition porousmediumflow/richardsextended/volumevariables.hh:403
Scalar mobility(const int phaseIdx=liquidPhaseIdx) const
Returns the effective mobility of a given phase within the control volume.
Definition porousmediumflow/richardsextended/volumevariables.hh:280
Scalar minPc_
the minimum capillary pressure (entry pressure)
Definition porousmediumflow/richardsextended/volumevariables.hh:475
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:243
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:252
Scalar relativePermeability(const int phaseIdx=liquidPhaseIdx) const
Returns relative permeability [-] of a given phase within the control volume.
Definition porousmediumflow/richardsextended/volumevariables.hh:299
typename Traits::ModelTraits::Indices Indices
Definition porousmediumflow/richardsextended/volumevariables.hh:66
static constexpr auto gasPhaseIdx
Definition porousmediumflow/richardsextended/volumevariables.hh:71
const PermeabilityType & permeability() const
Returns the permeability within the control volume in .
Definition porousmediumflow/richardsextended/volumevariables.hh:230
Scalar capillaryPressure() const
Returns the effective capillary pressure within the control volume.
Definition porousmediumflow/richardsextended/volumevariables.hh:313
Scalar moleFraction_[numPhases]
The water mole fractions in water and air.
Definition porousmediumflow/richardsextended/volumevariables.hh:476
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:370
SolidState solidState_
Definition porousmediumflow/richardsextended/volumevariables.hh:472
Scalar molarDensity(const int phaseIdx) const
Returns the mass density of a given phase within the control volume in .
Definition porousmediumflow/richardsextended/volumevariables.hh:383
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:356
typename Traits::FluidSystem FluidSystem
Export type of the fluid system.
Definition porousmediumflow/richardsextended/volumevariables.hh:58
Scalar pressure(const int phaseIdx=liquidPhaseIdx) const
Returns the effective pressure of a given phase within the control volume.
Definition porousmediumflow/richardsextended/volumevariables.hh:266
const FluidState & fluidState() const
Returns the fluid configuration at the given primary variables.
Definition porousmediumflow/richardsextended/volumevariables.hh:203
Scalar waterContent(const int phaseIdx=liquidPhaseIdx) const
Returns the water content of a fluid phase within the finite volume.
Definition porousmediumflow/richardsextended/volumevariables.hh:346
Scalar temperature() const
Returns the temperature.
Definition porousmediumflow/richardsextended/volumevariables.hh:215
FluidState fluidState_
the fluid state
Definition porousmediumflow/richardsextended/volumevariables.hh:471
typename Traits::SolidSystem SolidSystem
Export type of solid system.
Definition porousmediumflow/richardsextended/volumevariables.hh:65
static constexpr auto liquidPhaseIdx
Export phase indices.
Definition porousmediumflow/richardsextended/volumevariables.hh:70
static constexpr Scalar molarDensity(Scalar temperature, Scalar pressure)
The molar density of the gas , depending on pressure and temperature.
Definition idealgas.hh:58
The isothermal base class.
Definition porousmediumflow/volumevariables.hh:28
static constexpr int numFluidComponents()
Return number of components considered by the model.
Definition porousmediumflow/volumevariables.hh:40
const PrimaryVariables & priVars() const
Returns the vector of primary variables.
Definition porousmediumflow/volumevariables.hh:64
static constexpr int numFluidPhases()
Return number of phases considered by the model.
Definition porousmediumflow/volumevariables.hh:38
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:52
A central place for various physical constants occurring in some equations.
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:24
Relations valid for an ideal gas.
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.
Update the solid volume fractions (inert and reacitve) and set them in the solidstate.