25#ifndef DUMUX_RICHARDS_VOLUME_VARIABLES_HH
26#define DUMUX_RICHARDS_VOLUME_VARIABLES_HH
30#include <dune/common/exceptions.hh>
60template <
class Traits>
64,
public std::conditional_t<Traits::ModelTraits::enableMolecularDiffusion(),
65 Detail::VolVarsWithPVSwitch, Detail::VolVarsWithOutPVSwitch>
69 using Scalar =
typename Traits::PrimaryVariables::value_type;
70 using PermeabilityType =
typename Traits::PermeabilityType;
71 using ModelTraits =
typename Traits::ModelTraits;
76 using EffDiffModel =
typename Traits::EffectiveDiffusivityModel;
79 static constexpr auto fsCheck = ModelTraits::checkFluidSystem(
typename Traits::FluidSystem{});
91 using Indices =
typename Traits::ModelTraits::Indices;
97 static constexpr auto gasPhaseIdx = Traits::FluidSystem::phase1Idx;
108 template<
class ElemSol,
class Problem,
class Element,
class Scv>
110 const Problem &problem,
111 const Element &element,
116 const auto fluidMatrixInteraction = problem.spatialParams().fluidMatrixInteraction(element, scv, elemSol);
118 const auto&
priVars = elemSol[scv.localDofIndex()];
123 minPc_ = fluidMatrixInteraction.endPointPc();
128 typename FluidSystem::ParameterCache paramCache;
129 auto getEffectiveDiffusionCoefficient = [&](
int phaseIdx,
int compIIdx,
int compJIdx)
131 return EffDiffModel::effectiveDiffusionCoefficient(*
this, phaseIdx, compIIdx, compJIdx);
152 const Scalar pc = fluidMatrixInteraction.pc(0.0);
178 FluidSystem::comp1Idx,
179 FluidSystem::comp0Idx);
204 FluidSystem::comp1Idx,
205 FluidSystem::comp0Idx);
230 EnergyVolVars::updateSolidEnergyParams(elemSol, problem, element, scv,
solidState_);
231 permeability_ = problem.spatialParams().permeability(element, scv, elemSol);
232 EnergyVolVars::updateEffectiveThermalConductivity();
249 template<
class ElemSol,
class Problem,
class Element,
class Scv>
251 const Problem& problem,
252 const Element& element,
259 const auto fluidMatrixInteraction = problem.spatialParams().fluidMatrixInteraction(element, scv, elemSol);
261 const auto&
priVars = elemSol[scv.localDofIndex()];
265 Scalar minPc = fluidMatrixInteraction.pc(1.0);
273 const Scalar pc = max(fluidMatrixInteraction.endPointPc(),
275 const Scalar sw = fluidMatrixInteraction.sw(pc);
280 typename FluidSystem::ParameterCache paramCache;
455 if (compIdx != FluidSystem::comp0Idx)
456 DUNE_THROW(Dune::InvalidStateException,
"There is only one component for Richards!");
470 if (compIdx != FluidSystem::comp0Idx)
471 DUNE_THROW(Dune::InvalidStateException,
"There is only one component for Richards!");
494 assert(compIIdx != compJIdx);
495 typename FluidSystem::ParameterCache paramCache;
497 return FluidSystem::binaryDiffusionCoefficient(
fluidState_, paramCache, phaseIdx, compIIdx, compJIdx);
507 assert(compIIdx != compJIdx);
Update the solid volume fractions (inert and reacitve) and set them in the solidstate.
A central place for various physical constants occuring in some equations.
Relations valid for an ideal gas.
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
std::string phasePresence() noexcept
I/O name of phase presence.
Definition: name.hh:147
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
static constexpr Scalar molarDensity(Scalar temperature, Scalar pressure)
The molar density of the gas , depending on pressure and temperature.
Definition: idealgas.hh:70
Definition: porousmediumflow/nonisothermal/volumevariables.hh:76
The primary variable switch controlling the phase presence state variable.
Definition: richards/primaryvariableswitch.hh:41
Helper structs to conditionally use a primary variable switch or not.
Definition: porousmediumflow/richards/volumevariables.hh:45
Definition: porousmediumflow/richards/volumevariables.hh:50
Volume averaged quantities required by the Richards model.
Definition: porousmediumflow/richards/volumevariables.hh:66
Scalar saturation(const int phaseIdx=liquidPhaseIdx) const
Returns the average absolute saturation [] of a given fluid phase within the finite volume.
Definition: porousmediumflow/richards/volumevariables.hh:339
FluidState fluidState_
the fluid state
Definition: porousmediumflow/richards/volumevariables.hh:512
Scalar relativePermeabilityWetting_
the relative permeability of the wetting phase
Definition: porousmediumflow/richards/volumevariables.hh:514
const PermeabilityType & permeability() const
Returns the permeability within the control volume in .
Definition: porousmediumflow/richards/volumevariables.hh:326
Scalar diffusionCoefficient(int phaseIdx, int compIIdx, int compJIdx) const
Returns the binary diffusion coefficients for a phase in .
Definition: porousmediumflow/richards/volumevariables.hh:490
Scalar waterContent(const int phaseIdx=liquidPhaseIdx) const
Returns the water content of a fluid phase within the finite volume.
Definition: porousmediumflow/richards/volumevariables.hh:442
Scalar porosity() const
Returns the average porosity [] within the control volume.
Definition: porousmediumflow/richards/volumevariables.hh:320
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/richards/volumevariables.hh:452
SolidState solidState_
Definition: porousmediumflow/richards/volumevariables.hh:513
const FluidState & fluidState() const
Returns the fluid configuration at the given primary variables.
Definition: porousmediumflow/richards/volumevariables.hh:299
Scalar viscosity(const int phaseIdx=liquidPhaseIdx) const
Returns the dynamic viscosity of a given phase within the control volume.
Definition: porousmediumflow/richards/volumevariables.hh:386
static constexpr auto liquidPhaseIdx
Export phase indices.
Definition: porousmediumflow/richards/volumevariables.hh:96
static constexpr auto gasPhaseIdx
Definition: porousmediumflow/richards/volumevariables.hh:97
Scalar pressureHead(const int phaseIdx=liquidPhaseIdx) const
Returns the pressureHead of a given phase within the control volume.
Definition: porousmediumflow/richards/volumevariables.hh:429
static constexpr bool enableWaterDiffusionInAir()
If water diffusion in air is enabled.
Definition: porousmediumflow/richards/volumevariables.hh:93
void update(const ElemSol &elemSol, const Problem &problem, const Element &element, const Scv &scv)
Updates all quantities for a given control volume.
Definition: porousmediumflow/richards/volumevariables.hh:109
Scalar capillaryPressure() const
Returns the effective capillary pressure within the control volume.
Definition: porousmediumflow/richards/volumevariables.hh:409
PermeabilityType permeability_
the intrinsic permeability
Definition: porousmediumflow/richards/volumevariables.hh:515
Scalar density(const int phaseIdx=liquidPhaseIdx) const
Returns the average mass density of a given fluid phase within the control volume.
Definition: porousmediumflow/richards/volumevariables.hh:348
typename Traits::SolidSystem SolidSystem
Export type of solid system.
Definition: porousmediumflow/richards/volumevariables.hh:90
Scalar massFraction_[numPhases]
The water mass fractions in water and air.
Definition: porousmediumflow/richards/volumevariables.hh:518
Scalar effectiveDiffusionCoefficient(int phaseIdx, int compIIdx, int compJIdx) const
Returns the effective diffusion coefficients for a phase in .
Definition: porousmediumflow/richards/volumevariables.hh:503
Scalar molarDensity_[numPhases]
The molar density of water and air.
Definition: porousmediumflow/richards/volumevariables.hh:519
typename Traits::ModelTraits::Indices Indices
Definition: porousmediumflow/richards/volumevariables.hh:91
Scalar relativePermeability(const int phaseIdx=liquidPhaseIdx) const
Returns relative permeability [-] of a given phase within the control volume.
Definition: porousmediumflow/richards/volumevariables.hh:395
Scalar moleFraction_[numPhases]
The water mole fractions in water and air.
Definition: porousmediumflow/richards/volumevariables.hh:517
const SolidState & solidState() const
Returns the phase state for the control volume.
Definition: porousmediumflow/richards/volumevariables.hh:305
typename Traits::SolidState SolidState
Definition: porousmediumflow/richards/volumevariables.hh:88
Scalar effectiveDiffCoeff_
Definition: porousmediumflow/richards/volumevariables.hh:522
void completeFluidState(const ElemSol &elemSol, const Problem &problem, const Element &element, const Scv &scv, FluidState &fluidState, SolidState &solidState)
Fills the fluid state according to the primary variables.
Definition: porousmediumflow/richards/volumevariables.hh:250
Scalar molarDensity(const int phaseIdx) const
Returns the mass density of a given phase within the control volume in .
Definition: porousmediumflow/richards/volumevariables.hh:481
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/richards/volumevariables.hh:467
Scalar mobility(const int phaseIdx=liquidPhaseIdx) const
Returns the effective mobility of a given phase within the control volume.
Definition: porousmediumflow/richards/volumevariables.hh:376
Scalar pressure(const int phaseIdx=liquidPhaseIdx) const
Returns the effective pressure of a given phase within the control volume.
Definition: porousmediumflow/richards/volumevariables.hh:362
typename Traits::FluidSystem FluidSystem
Export type of the fluid system.
Definition: porousmediumflow/richards/volumevariables.hh:83
typename Traits::FluidState FluidState
Export type of the fluid state.
Definition: porousmediumflow/richards/volumevariables.hh:85
Scalar temperature() const
Returns the temperature.
Definition: porousmediumflow/richards/volumevariables.hh:311
Scalar minPc_
the minimum capillary pressure (entry pressure)
Definition: porousmediumflow/richards/volumevariables.hh:516
The isothermal base class.
Definition: porousmediumflow/volumevariables.hh:42
static constexpr int numFluidComponents()
Return number of components considered by the model.
Definition: porousmediumflow/volumevariables.hh:54
const PrimaryVariables & priVars() const
Returns the vector of primary variables.
Definition: porousmediumflow/volumevariables.hh:78
static constexpr int numFluidPhases()
Return number of phases considered by the model.
Definition: porousmediumflow/volumevariables.hh:52
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:66
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.