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()];
119 const auto phasePresence =
priVars.state();
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);
134 if (phasePresence == Indices::gasPhaseOnly)
152 const Scalar pc = fluidMatrixInteraction.pc(0.0);
178 FluidSystem::comp1Idx,
179 FluidSystem::comp0Idx);
181 else if (phasePresence == Indices::bothPhases)
204 FluidSystem::comp1Idx,
205 FluidSystem::comp0Idx);
208 else if (phasePresence == Indices::liquidPhaseOnly)
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.
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:86
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
Distance implementation details.
Definition fclocalassembler.hh:42
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 richards/primaryvariableswitch.hh:41
Helper structs to conditionally use a primary variable switch or not.
Definition porousmediumflow/richards/volumevariables.hh:45
ExtendedRichardsPrimaryVariableSwitch PrimaryVariableSwitch
Definition porousmediumflow/richards/volumevariables.hh:46
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_
Definition porousmediumflow/richards/volumevariables.hh:512
Scalar relativePermeabilityWetting_
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
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
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_
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 NITraits< BaseTraits, ETCM >::SolidSystem SolidSystem
Definition porousmediumflow/richards/volumevariables.hh:90
Scalar massFraction_[numPhases]
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]
Definition porousmediumflow/richards/volumevariables.hh:519
typename NITraits< BaseTraits, ETCM >::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]
Definition porousmediumflow/richards/volumevariables.hh:517
const SolidState & solidState() const
Definition porousmediumflow/richards/volumevariables.hh:305
typename NITraits< BaseTraits, ETCM >::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 NITraits< BaseTraits, ETCM >::FluidSystem FluidSystem
Definition porousmediumflow/richards/volumevariables.hh:83
typename NITraits< BaseTraits, ETCM >::FluidState FluidState
Definition porousmediumflow/richards/volumevariables.hh:85
Scalar temperature() const
Returns the temperature.
Definition porousmediumflow/richards/volumevariables.hh:311
Scalar minPc_
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
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
The primary variable switch for the extended Richards model.
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.