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)
162 / problem.nonwettingReferencePressure();
173 FluidSystem::comp1Idx,
174 FluidSystem::comp0Idx);
176 else if (phasePresence == Indices::liquidPhaseOnly)
195 EnergyVolVars::updateSolidEnergyParams(elemSol, problem, element, scv,
solidState_);
196 permeability_ = problem.spatialParams().permeability(element, scv, elemSol);
197 EnergyVolVars::updateEffectiveThermalConductivity();
359 if (compIdx != FluidSystem::comp0Idx)
360 DUNE_THROW(Dune::InvalidStateException,
"There is only one component for Richards!");
373 if (compIdx != FluidSystem::comp0Idx)
374 DUNE_THROW(Dune::InvalidStateException,
"There is only one component for Richards!");
395 assert(compIIdx != compJIdx);
396 typename FluidSystem::ParameterCache paramCache;
398 return FluidSystem::binaryDiffusionCoefficient(
fluidState_, paramCache, phaseIdx, compIIdx, compJIdx);
407 assert(compIIdx != compJIdx);
425 template<
class ElemSol,
class Problem,
class Element,
class Scv>
426 void completeFluidState_(
const ElemSol& elemSol,
427 const Problem& problem,
428 const Element& element,
435 const auto fluidMatrixInteraction = problem.spatialParams().fluidMatrixInteraction(element, scv, elemSol);
437 const auto&
priVars = elemSol[scv.localDofIndex()];
441 Scalar minPc = fluidMatrixInteraction.pc(1.0);
449 const Scalar pc = max(fluidMatrixInteraction.endPointPc(),
451 const Scalar sw = fluidMatrixInteraction.sw(pc);
456 typename FluidSystem::ParameterCache paramCache;
The primary variable switch controlling the phase presence state variable.
Definition richardsextended/primaryvariableswitch.hh:55
Volume averaged quantities required by the extended Richards model.
Definition porousmediumflow/richardsextended/volumevariables.hh:41
PermeabilityType permeability_
Definition porousmediumflow/richardsextended/volumevariables.hh:475
const SolidState & solidState() const
Returns the phase state for the control volume.
Definition porousmediumflow/richardsextended/volumevariables.hh:210
Scalar massFraction_[numPhases]
Definition porousmediumflow/richardsextended/volumevariables.hh:478
Scalar diffusionCoefficient(int phaseIdx, int compIIdx, int compJIdx) const
Returns the binary diffusion coefficients for a phase in .
Definition porousmediumflow/richardsextended/volumevariables.hh:392
Scalar porosity() const
Returns the average porosity [] within the control volume.
Definition porousmediumflow/richardsextended/volumevariables.hh:225
typename NITraits< BaseTraits, ETCM >::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]
Definition porousmediumflow/richardsextended/volumevariables.hh:479
Scalar effectiveDiffCoeff_
Definition porousmediumflow/richardsextended/volumevariables.hh:482
Scalar relativePermeabilityWetting_
Definition porousmediumflow/richardsextended/volumevariables.hh:474
Scalar pressureHead(const int phaseIdx=liquidPhaseIdx) const
Returns the pressureHead of a given phase within the control volume.
Definition porousmediumflow/richardsextended/volumevariables.hh:334
typename NITraits< BaseTraits, ETCM >::FluidState FluidState
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:291
Scalar effectiveDiffusionCoefficient(int phaseIdx, int compIIdx, int compJIdx) const
Returns the effective diffusion coefficients for a phase in .
Definition porousmediumflow/richardsextended/volumevariables.hh:404
Scalar mobility(const int phaseIdx=liquidPhaseIdx) const
Returns the effective mobility of a given phase within the control volume.
Definition porousmediumflow/richardsextended/volumevariables.hh:281
Scalar minPc_
Definition porousmediumflow/richardsextended/volumevariables.hh:476
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:244
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:253
Scalar relativePermeability(const int phaseIdx=liquidPhaseIdx) const
Returns relative permeability [-] of a given phase within the control volume.
Definition porousmediumflow/richardsextended/volumevariables.hh:300
typename NITraits< BaseTraits, ETCM >::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:231
Scalar capillaryPressure() const
Returns the effective capillary pressure within the control volume.
Definition porousmediumflow/richardsextended/volumevariables.hh:314
Scalar moleFraction_[numPhases]
Definition porousmediumflow/richardsextended/volumevariables.hh:477
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:371
SolidState solidState_
Definition porousmediumflow/richardsextended/volumevariables.hh:473
Scalar molarDensity(const int phaseIdx) const
Returns the mass density of a given phase within the control volume in .
Definition porousmediumflow/richardsextended/volumevariables.hh:384
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:357
typename NITraits< BaseTraits, ETCM >::FluidSystem FluidSystem
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:267
const FluidState & fluidState() const
Returns the fluid configuration at the given primary variables.
Definition porousmediumflow/richardsextended/volumevariables.hh:204
Scalar waterContent(const int phaseIdx=liquidPhaseIdx) const
Returns the water content of a fluid phase within the finite volume.
Definition porousmediumflow/richardsextended/volumevariables.hh:347
Scalar temperature() const
Returns the temperature.
Definition porousmediumflow/richardsextended/volumevariables.hh:216
FluidState fluidState_
Definition porousmediumflow/richardsextended/volumevariables.hh:472
typename NITraits< BaseTraits, ETCM >::SolidSystem SolidSystem
Definition porousmediumflow/richardsextended/volumevariables.hh:65
ExtendedRichardsPrimaryVariableSwitch PrimaryVariableSwitch
Definition porousmediumflow/richardsextended/volumevariables.hh:67
static constexpr auto liquidPhaseIdx
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
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.
auto equilibriumVaporPressure(const FluidState &fluidState)
The vapor pressure of water in equilibrium with the liquid phase.
Definition richardsextended/primaryvariableswitch.hh:39
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:73
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.