26#ifndef DUMUX_RICHARDSNC_VOLUME_VARIABLES_HH
27#define DUMUX_RICHARDSNC_VOLUME_VARIABLES_HH
43template <
class Traits>
51 using Scalar =
typename Traits::PrimaryVariables::value_type;
52 using PermeabilityType =
typename Traits::PermeabilityType;
55 static constexpr bool useMoles = Traits::ModelTraits::useMoles();
57 using EffDiffModel =
typename Traits::EffectiveDiffusivityModel;
58 using DiffusionCoefficients =
typename Traits::DiffusionType::DiffusionCoefficientsContainer;
70 using Indices =
typename Traits::ModelTraits::Indices;
84 template<
class ElemSol,
class Problem,
class Element,
class Scv>
86 const Problem &problem,
87 const Element &element,
97 const auto fluidMatrixInteraction = problem.spatialParams().fluidMatrixInteraction(element, scv, elemSol);
98 relativePermeabilityWetting_ = fluidMatrixInteraction.krw(
fluidState_.saturation(0));
102 minPc_ = fluidMatrixInteraction.endPointPc();
103 pn_ = problem.nonwettingReferencePressure();
106 EnergyVolVars::updateSolidEnergyParams(elemSol, problem, element, scv, solidState_);
107 permeability_ = problem.spatialParams().permeability(element, scv, elemSol);
108 EnergyVolVars::updateEffectiveThermalConductivity();
113 typename FluidSystem::ParameterCache paramCache;
116 auto getEffectiveDiffusionCoefficient = [&](
int phaseIdx,
int compIIdx,
int compJIdx)
118 return EffDiffModel::effectiveDiffusionCoefficient(*
this, phaseIdx, compIIdx, compJIdx);
121 effectiveDiffCoeff_.update(getEffectiveDiffusionCoefficient);
124 EnergyVolVars::updateSolidEnergyParams(elemSol, problem, element, scv, solidState_);
125 permeability_ = problem.spatialParams().permeability(element, scv, elemSol);
126 EnergyVolVars::updateEffectiveThermalConductivity();
143 template<
class ElemSol,
class Problem,
class Element,
class Scv>
145 const Problem& problem,
146 const Element& element,
153 const auto fluidMatrixInteraction = problem.spatialParams().fluidMatrixInteraction(element, scv, elemSol);
155 const auto&
priVars = elemSol[scv.localDofIndex()];
164 const Scalar pc = max(fluidMatrixInteraction.endPointPc(),
165 problem.nonwettingReferencePressure() -
fluidState.pressure(0));
166 const Scalar sw = fluidMatrixInteraction.sw(pc);
172 Scalar sumSecondaryFractions = 0.0;
176 sumSecondaryFractions +=
priVars[compIdx];
178 fluidState.setMoleFraction(0, 0, 1.0 - sumSecondaryFractions);
187 typename FluidSystem::ParameterCache paramCache;
208 {
return solidState_; }
231 {
return solidState_.porosity(); }
237 {
return permeability_; }
259 {
return phaseIdx == 0 ?
fluidState_.density(phaseIdx) : 0.0; }
273 {
return phaseIdx == 0 ?
fluidState_.pressure(phaseIdx) : pn_; }
297 {
return phaseIdx == 0 ?
fluidState_.viscosity(0) : 0.0; }
306 {
return phaseIdx == 0 ? relativePermeabilityWetting_ : 1.0; }
354 {
return saturation(phaseIdx) * solidState_.porosity(); }
362 {
return phaseIdx == 0 ? this->
fluidState_.molarDensity(phaseIdx) : 0.0; }
373 {
return phaseIdx == 0 ? this->
fluidState_.moleFraction(phaseIdx, compIdx) : 0.0; }
384 {
return phaseIdx == 0 ? this->
fluidState_.massFraction(phaseIdx, compIdx) : 0.0; }
394 Scalar
molarity(
const int phaseIdx,
const int compIdx)
const
395 {
return phaseIdx == 0 ? this->
fluidState_.molarity(phaseIdx, compIdx) : 0.0; }
402 typename FluidSystem::ParameterCache paramCache;
404 return FluidSystem::binaryDiffusionCoefficient(
fluidState_, paramCache, phaseIdx, compIIdx, compJIdx);
411 {
return effectiveDiffCoeff_(phaseIdx, compIIdx, compJIdx); }
418 DiffusionCoefficients effectiveDiffCoeff_;
420 Scalar relativePermeabilityWetting_;
422 PermeabilityType permeability_;
Update the solid volume fractions (inert and reacitve) and set them in the solidstate.
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
std::string viscosity(int phaseIdx) noexcept
I/O name of viscosity for multiphase systems.
Definition: name.hh:74
std::string molarDensity(int phaseIdx) noexcept
I/O name of molar density for multiphase systems.
Definition: name.hh:83
std::string density(int phaseIdx) noexcept
I/O name of density for multiphase systems.
Definition: name.hh:65
Definition: porousmediumflow/nonisothermal/volumevariables.hh:75
Contains the quantities which are constant within a finite volume in the Richards,...
Definition: porousmediumflow/richardsnc/volumevariables.hh:47
Scalar molarDensity(const int phaseIdx=0) const
Returns the molar density the of the fluid phase.
Definition: porousmediumflow/richardsnc/volumevariables.hh:361
Scalar relativePermeability(const int phaseIdx=0) const
Returns relative permeability [-] of a given phase within the control volume.
Definition: porousmediumflow/richardsnc/volumevariables.hh:305
Scalar porosity() const
Returns the average porosity [] within the control volume.
Definition: porousmediumflow/richardsnc/volumevariables.hh:230
Scalar massFraction(const int phaseIdx, const int compIdx) const
Returns the mass fraction of a component in the phase.
Definition: porousmediumflow/richardsnc/volumevariables.hh:383
Scalar saturation(const int phaseIdx=0) const
Returns the average absolute saturation [] of a given fluid phase within the finite volume.
Definition: porousmediumflow/richardsnc/volumevariables.hh:249
typename Traits::ModelTraits::Indices Indices
Export indices.
Definition: porousmediumflow/richardsnc/volumevariables.hh:70
Scalar effectiveDiffusionCoefficient(int phaseIdx, int compIIdx, int compJIdx) const
Returns the effective diffusion coefficients for a phase in .
Definition: porousmediumflow/richardsnc/volumevariables.hh:410
Scalar averageMolarMass(const int phaseIdx=0) const
Returns the average molar mass of the fluid phase.
Definition: porousmediumflow/richardsnc/volumevariables.hh:215
typename Traits::FluidState FluidState
Export type of the fluid state.
Definition: porousmediumflow/richardsnc/volumevariables.hh:64
Scalar viscosity(const int phaseIdx=0) const
Returns the dynamic viscosity of a given phase within the control volume.
Definition: porousmediumflow/richardsnc/volumevariables.hh:296
Scalar waterContent(const int phaseIdx=0) const
Returns the water content fluid phase within the finite volume.
Definition: porousmediumflow/richardsnc/volumevariables.hh:353
Scalar capillaryPressure() const
Returns the effective capillary pressure within the control volume.
Definition: porousmediumflow/richardsnc/volumevariables.hh:319
static constexpr int liquidPhaseIdx
Export phase access indices.
Definition: porousmediumflow/richardsnc/volumevariables.hh:72
typename Traits::SolidSystem SolidSystem
Export type of solid system.
Definition: porousmediumflow/richardsnc/volumevariables.hh:68
Scalar temperature() const
Returns the temperature.
Definition: porousmediumflow/richardsnc/volumevariables.hh:221
static constexpr int gasPhaseIdx
Definition: porousmediumflow/richardsnc/volumevariables.hh:73
FluidState fluidState_
the fluid state
Definition: porousmediumflow/richardsnc/volumevariables.hh:414
void update(const ElemSol &elemSol, const Problem &problem, const Element &element, const Scv &scv)
Updates all quantities for a given control volume.
Definition: porousmediumflow/richardsnc/volumevariables.hh:85
Scalar moleFraction(const int phaseIdx, const int compIdx) const
Returns the mole fraction of a component in the phase.
Definition: porousmediumflow/richardsnc/volumevariables.hh:372
Scalar molarity(const int phaseIdx, const int compIdx) const
Returns the concentration of a component in the phase.
Definition: porousmediumflow/richardsnc/volumevariables.hh:394
typename Traits::FluidSystem FluidSystem
Export type of the fluid system.
Definition: porousmediumflow/richardsnc/volumevariables.hh:62
Scalar pressureHead(const int phaseIdx=0) const
Returns the pressureHead of a given phase within the control volume.
Definition: porousmediumflow/richardsnc/volumevariables.hh:339
Scalar density(const int phaseIdx=0) const
Returns the average mass density of a given fluid phase within the control volume.
Definition: porousmediumflow/richardsnc/volumevariables.hh:258
typename Traits::SolidState SolidState
Export type of solid state.
Definition: porousmediumflow/richardsnc/volumevariables.hh:66
Scalar pressure(const int phaseIdx=0) const
Returns the effective pressure of a given phase within the control volume.
Definition: porousmediumflow/richardsnc/volumevariables.hh:272
const FluidState & fluidState() const
Returns the fluid configuration at the given primary variables.
Definition: porousmediumflow/richardsnc/volumevariables.hh:201
const SolidState & solidState() const
Returns the phase state for the control volume.
Definition: porousmediumflow/richardsnc/volumevariables.hh:207
Scalar diffusionCoefficient(int phaseIdx, int compIIdx, int compJIdx) const
Returns the binary diffusion coefficients for a phase in .
Definition: porousmediumflow/richardsnc/volumevariables.hh:400
Scalar mobility(const int phaseIdx=0) const
Returns the effective mobility of a given phase within the control volume.
Definition: porousmediumflow/richardsnc/volumevariables.hh:286
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/richardsnc/volumevariables.hh:144
const PermeabilityType & permeability() const
Returns the permeability within the control volume in .
Definition: porousmediumflow/richardsnc/volumevariables.hh:236
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
Returns the vector of primary variables.
Definition: porousmediumflow/volumevariables.hh:76
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.