25#ifndef DUMUX_RICHARDS_VOLUME_VARIABLES_HH
26#define DUMUX_RICHARDS_VOLUME_VARIABLES_HH
30#include <dune/common/exceptions.hh>
62template <
class Traits>
66,
public std::conditional_t<Traits::ModelTraits::enableMolecularDiffusion(),
67 Detail::VolVarsWithPVSwitch, Detail::VolVarsWithOutPVSwitch>
71 using Scalar =
typename Traits::PrimaryVariables::value_type;
72 using PermeabilityType =
typename Traits::PermeabilityType;
73 using ModelTraits =
typename Traits::ModelTraits;
78 using EffDiffModel =
typename Traits::EffectiveDiffusivityModel;
81 static constexpr auto fsCheck = ModelTraits::checkFluidSystem(
typename Traits::FluidSystem{});
93 using Indices =
typename Traits::ModelTraits::Indices;
95 static constexpr bool enableWaterDiffusionInAir() {
return Dumux::Deprecated::ExtendedRichardsHelper<ModelTraits::enableMolecularDiffusion()>::isExtendedRichards(); }
99 static constexpr auto gasPhaseIdx = Traits::FluidSystem::phase1Idx;
110 template<
class ElemSol,
class Problem,
class Element,
class Scv>
112 const Problem &problem,
113 const Element &element,
118 const auto fluidMatrixInteraction = problem.spatialParams().fluidMatrixInteraction(element, scv, elemSol);
122 minPc_ = fluidMatrixInteraction.endPointPc();
129 const auto&
priVars = elemSol[scv.localDofIndex()];
130 const auto phasePresence =
priVars.state();
132 typename FluidSystem::ParameterCache paramCache;
133 auto getEffectiveDiffusionCoefficient = [&](
int phaseIdx,
int compIIdx,
int compJIdx)
135 return EffDiffModel::effectiveDiffusionCoefficient(*
this, phaseIdx, compIIdx, compJIdx);
138 if (phasePresence == Indices::gasPhaseOnly)
156 const Scalar pc = fluidMatrixInteraction.pc(0.0);
182 FluidSystem::comp1Idx,
183 FluidSystem::comp0Idx);
185 else if (phasePresence == Indices::bothPhases)
208 FluidSystem::comp1Idx,
209 FluidSystem::comp0Idx);
212 else if (phasePresence == Indices::liquidPhaseOnly)
239 EnergyVolVars::updateSolidEnergyParams(elemSol, problem, element, scv,
solidState_);
240 permeability_ = problem.spatialParams().permeability(element, scv, elemSol);
241 EnergyVolVars::updateEffectiveThermalConductivity();
258 template<
class ElemSol,
class Problem,
class Element,
class Scv>
260 const Problem& problem,
261 const Element& element,
268 const auto fluidMatrixInteraction = problem.spatialParams().fluidMatrixInteraction(element, scv, elemSol);
270 const auto&
priVars = elemSol[scv.localDofIndex()];
282 const Scalar sw = fluidMatrixInteraction.sw(pc);
287 typename FluidSystem::ParameterCache paramCache;
462 if (compIdx != FluidSystem::comp0Idx)
463 DUNE_THROW(Dune::InvalidStateException,
"There is only one component for Richards!");
477 if (compIdx != FluidSystem::comp0Idx)
478 DUNE_THROW(Dune::InvalidStateException,
"There is only one component for Richards!");
501 assert(compIIdx != compJIdx);
502 typename FluidSystem::ParameterCache paramCache;
504 return FluidSystem::binaryDiffusionCoefficient(
fluidState_, paramCache, phaseIdx, compIIdx, compJIdx);
514 assert(compIIdx != compJIdx);
533 template<
class PriVars>
534 auto getState_(
const PriVars&
priVars)
539 return Indices::bothPhases;
Type traits to be used with matrix types.
Update the solid volume fractions (inert and reacitve) and set them in the solidstate.
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: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
Distance implementation details.
Definition cvfelocalresidual.hh:37
constexpr bool priVarsHaveState()
Definition state.hh:44
static constexpr Scalar molarDensity(Scalar temperature, Scalar pressure)
The molar density of the gas , depending on pressure and temperature.
Definition idealgas.hh:70
Helper structs to conditionally use a primary variable switch or not.
Definition porousmediumflow/richards/volumevariables.hh:47
ExtendedRichardsPrimaryVariableSwitch PrimaryVariableSwitch
Definition porousmediumflow/richards/volumevariables.hh:48
Definition porousmediumflow/richards/volumevariables.hh:52
Volume averaged quantities required by the Richards model.
Definition porousmediumflow/richards/volumevariables.hh:68
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:346
FluidState fluidState_
Definition porousmediumflow/richards/volumevariables.hh:519
Scalar relativePermeabilityWetting_
Definition porousmediumflow/richards/volumevariables.hh:521
const PermeabilityType & permeability() const
Returns the permeability within the control volume in .
Definition porousmediumflow/richards/volumevariables.hh:333
Scalar diffusionCoefficient(int phaseIdx, int compIIdx, int compJIdx) const
Returns the binary diffusion coefficients for a phase in .
Definition porousmediumflow/richards/volumevariables.hh:497
Scalar waterContent(const int phaseIdx=liquidPhaseIdx) const
Returns the water content of a fluid phase within the finite volume.
Definition porousmediumflow/richards/volumevariables.hh:449
Scalar porosity() const
Returns the average porosity [] within the control volume.
Definition porousmediumflow/richards/volumevariables.hh:327
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:459
SolidState solidState_
Definition porousmediumflow/richards/volumevariables.hh:520
const FluidState & fluidState() const
Definition porousmediumflow/richards/volumevariables.hh:306
Scalar viscosity(const int phaseIdx=liquidPhaseIdx) const
Returns the dynamic viscosity of a given phase within the control volume.
Definition porousmediumflow/richards/volumevariables.hh:393
static constexpr auto liquidPhaseIdx
Definition porousmediumflow/richards/volumevariables.hh:98
static constexpr auto gasPhaseIdx
Definition porousmediumflow/richards/volumevariables.hh:99
Scalar pressureHead(const int phaseIdx=liquidPhaseIdx) const
Returns the pressureHead of a given phase within the control volume.
Definition porousmediumflow/richards/volumevariables.hh:436
static constexpr bool enableWaterDiffusionInAir()
If water diffusion in air is enabled.
Definition porousmediumflow/richards/volumevariables.hh:95
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:111
Scalar capillaryPressure() const
Returns the effective capillary pressure within the control volume.
Definition porousmediumflow/richards/volumevariables.hh:416
PermeabilityType permeability_
Definition porousmediumflow/richards/volumevariables.hh:522
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:355
typename NITraits< BaseTraits, ETCM >::SolidSystem SolidSystem
Definition porousmediumflow/richards/volumevariables.hh:92
Scalar massFraction_[numPhases]
Definition porousmediumflow/richards/volumevariables.hh:525
Scalar effectiveDiffusionCoefficient(int phaseIdx, int compIIdx, int compJIdx) const
Returns the effective diffusion coefficients for a phase in .
Definition porousmediumflow/richards/volumevariables.hh:510
Scalar molarDensity_[numPhases]
Definition porousmediumflow/richards/volumevariables.hh:526
typename NITraits< BaseTraits, ETCM >::ModelTraits::Indices Indices
Definition porousmediumflow/richards/volumevariables.hh:93
Scalar relativePermeability(const int phaseIdx=liquidPhaseIdx) const
Returns relative permeability [-] of a given phase within the control volume.
Definition porousmediumflow/richards/volumevariables.hh:402
Scalar moleFraction_[numPhases]
Definition porousmediumflow/richards/volumevariables.hh:524
const SolidState & solidState() const
Definition porousmediumflow/richards/volumevariables.hh:312
typename NITraits< BaseTraits, ETCM >::SolidState SolidState
Definition porousmediumflow/richards/volumevariables.hh:90
Scalar effectiveDiffCoeff_
Definition porousmediumflow/richards/volumevariables.hh:529
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:259
Scalar molarDensity(const int phaseIdx) const
Returns the mass density of a given phase within the control volume in .
Definition porousmediumflow/richards/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/richards/volumevariables.hh:474
Scalar mobility(const int phaseIdx=liquidPhaseIdx) const
Returns the effective mobility of a given phase within the control volume.
Definition porousmediumflow/richards/volumevariables.hh:383
Scalar pressure(const int phaseIdx=liquidPhaseIdx) const
Returns the effective pressure of a given phase within the control volume.
Definition porousmediumflow/richards/volumevariables.hh:369
typename NITraits< BaseTraits, ETCM >::FluidSystem FluidSystem
Definition porousmediumflow/richards/volumevariables.hh:85
typename NITraits< BaseTraits, ETCM >::FluidState FluidState
Definition porousmediumflow/richards/volumevariables.hh:87
Scalar temperature() const
Returns the temperature.
Definition porousmediumflow/richards/volumevariables.hh:318
Scalar minPc_
Definition porousmediumflow/richards/volumevariables.hh:523
The primary variable switch controlling the phase presence state variable.
Definition richardsextended/primaryvariableswitch.hh:41
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.