26#ifndef DUMUX_RICHARDSNC_VOLUME_VARIABLES_HH
27#define DUMUX_RICHARDSNC_VOLUME_VARIABLES_HH
43template <
class Traits>
50 using Scalar =
typename Traits::PrimaryVariables::value_type;
51 using PermeabilityType =
typename Traits::PermeabilityType;
53 static constexpr bool useMoles = Traits::ModelTraits::useMoles();
79 template<
class ElemSol,
class Problem,
class Element,
class Scv>
81 const Problem &problem,
82 const Element &element,
91 using MaterialLaw =
typename Problem::SpatialParams::MaterialLaw;
92 const auto& materialParams = problem.spatialParams().materialLawParams(element, scv, elemSol);
93 relativePermeabilityWetting_ = MaterialLaw::krw(materialParams,
fluidState_.saturation(0));
97 minPc_ = MaterialLaw::endPointPc(materialParams);
98 pn_ = problem.nonWettingReferencePressure();
101 EnergyVolVars::updateSolidEnergyParams(elemSol, problem, element, scv, solidState_);
102 permeability_ = problem.spatialParams().permeability(element, scv, elemSol);
107 typename FluidSystem::ParameterCache paramCache;
110 const int compIIdx = 0;
112 if(compIIdx != compJIdx)
113 setDiffusionCoefficient_(compJIdx,
114 FluidSystem::binaryDiffusionCoefficient(
fluidState_,
135 template<
class ElemSol,
class Problem,
class Element,
class Scv>
137 const Problem& problem,
138 const Element& element,
145 const auto& materialParams = problem.spatialParams().materialLawParams(element, scv, elemSol);
146 const auto&
priVars = elemSol[scv.localDofIndex()];
155 using MaterialLaw =
typename Problem::SpatialParams::MaterialLaw;
156 const Scalar pc = max(MaterialLaw::endPointPc(materialParams),
157 problem.nonWettingReferencePressure() -
fluidState.pressure(0));
158 const Scalar sw = MaterialLaw::sw(materialParams, pc);
164 Scalar sumSecondaryFractions = 0.0;
168 sumSecondaryFractions +=
priVars[compIdx];
170 fluidState.setMoleFraction(0, 0, 1.0 - sumSecondaryFractions);
179 typename FluidSystem::ParameterCache paramCache;
200 {
return solidState_; }
223 {
return solidState_.porosity(); }
229 {
return permeability_; }
251 {
return phaseIdx == 0 ?
fluidState_.density(phaseIdx) : 0.0; }
265 {
return phaseIdx == 0 ?
fluidState_.pressure(phaseIdx) : pn_; }
289 {
return phaseIdx == 0 ?
fluidState_.viscosity(0) : 0.0; }
298 {
return phaseIdx == 0 ? relativePermeabilityWetting_ : 1.0; }
346 {
return saturation(phaseIdx) * solidState_.porosity(); }
354 {
return phaseIdx == 0 ? this->
fluidState_.molarDensity(phaseIdx) : 0.0; }
365 {
return phaseIdx == 0 ? this->
fluidState_.moleFraction(phaseIdx, compIdx) : 0.0; }
376 {
return phaseIdx == 0 ? this->
fluidState_.massFraction(phaseIdx, compIdx) : 0.0; }
386 Scalar
molarity(
const int phaseIdx,
const int compIdx)
const
387 {
return phaseIdx == 0 ? this->
fluidState_.molarity(phaseIdx, compIdx) : 0.0; }
396 {
return diffCoefficient_[compIdx-1]; }
402 void setDiffusionCoefficient_(
int compIdx, Scalar d)
403 { diffCoefficient_[compIdx-1] = d; }
407 Scalar relativePermeabilityWetting_;
409 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
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
Property tag Indices
Definition: porousmediumflow/sequential/properties.hh:59
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:353
Scalar relativePermeability(const int phaseIdx=0) const
Returns relative permeability [-] of a given phase within the control volume.
Definition: porousmediumflow/richardsnc/volumevariables.hh:297
Scalar porosity() const
Returns the average porosity [] within the control volume.
Definition: porousmediumflow/richardsnc/volumevariables.hh:222
Scalar massFraction(const int phaseIdx, const int compIdx) const
Returns the mass fraction of a component in the phase.
Definition: porousmediumflow/richardsnc/volumevariables.hh:375
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:241
typename Traits::ModelTraits::Indices Indices
Export indices.
Definition: porousmediumflow/richardsnc/volumevariables.hh:65
Scalar averageMolarMass(const int phaseIdx=0) const
Returns the average molar mass of the fluid phase.
Definition: porousmediumflow/richardsnc/volumevariables.hh:207
typename Traits::FluidState FluidState
Export type of the fluid state.
Definition: porousmediumflow/richardsnc/volumevariables.hh:59
Scalar viscosity(const int phaseIdx=0) const
Returns the dynamic viscosity of a given phase within the control volume.
Definition: porousmediumflow/richardsnc/volumevariables.hh:288
Scalar waterContent(const int phaseIdx=0) const
Returns the water content fluid phase within the finite volume.
Definition: porousmediumflow/richardsnc/volumevariables.hh:345
Scalar capillaryPressure() const
Returns the effective capillary pressure within the control volume.
Definition: porousmediumflow/richardsnc/volumevariables.hh:311
static constexpr int liquidPhaseIdx
Export phase acess indices.
Definition: porousmediumflow/richardsnc/volumevariables.hh:67
Scalar diffusionCoefficient(const int phaseIdx, const int compIdx) const
Returns the binary diffusion coefficient in the fluid.
Definition: porousmediumflow/richardsnc/volumevariables.hh:395
typename Traits::SolidSystem SolidSystem
Export type of solid system.
Definition: porousmediumflow/richardsnc/volumevariables.hh:63
Scalar temperature() const
Returns the temperature.
Definition: porousmediumflow/richardsnc/volumevariables.hh:213
static constexpr int gasPhaseIdx
Definition: porousmediumflow/richardsnc/volumevariables.hh:68
FluidState fluidState_
the fluid state
Definition: porousmediumflow/richardsnc/volumevariables.hh:399
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:80
Scalar moleFraction(const int phaseIdx, const int compIdx) const
Returns the mole fraction of a component in the phase.
Definition: porousmediumflow/richardsnc/volumevariables.hh:364
Scalar molarity(const int phaseIdx, const int compIdx) const
Returns the concentration of a component in the phase.
Definition: porousmediumflow/richardsnc/volumevariables.hh:386
typename Traits::FluidSystem FluidSystem
Export type of the fluid system.
Definition: porousmediumflow/richardsnc/volumevariables.hh:57
Scalar pressureHead(const int phaseIdx=0) const
Returns the pressureHead of a given phase within the control volume.
Definition: porousmediumflow/richardsnc/volumevariables.hh:331
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:250
typename Traits::SolidState SolidState
Export type of solid state.
Definition: porousmediumflow/richardsnc/volumevariables.hh:61
Scalar pressure(const int phaseIdx=0) const
Returns the effective pressure of a given phase within the control volume.
Definition: porousmediumflow/richardsnc/volumevariables.hh:264
const FluidState & fluidState() const
Returns the fluid configuration at the given primary variables.
Definition: porousmediumflow/richardsnc/volumevariables.hh:193
const SolidState & solidState() const
Returns the phase state for the control volume.
Definition: porousmediumflow/richardsnc/volumevariables.hh:199
Scalar mobility(const int phaseIdx=0) const
Returns the effective mobility of a given phase within the control volume.
Definition: porousmediumflow/richardsnc/volumevariables.hh:278
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:136
const PermeabilityType & permeability() const
Returns the permeability within the control volume in .
Definition: porousmediumflow/richardsnc/volumevariables.hh:228
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.