version 3.10-dev
porousmediumflow/1p/volumevariables.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3//
4// SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
14#ifndef DUMUX_1P_VOLUME_VARIABLES_HH
15#define DUMUX_1P_VOLUME_VARIABLES_HH
16
21
22namespace Dumux {
23
31template<class Traits>
33: public PorousMediumFlowVolumeVariables< Traits>
34, public EnergyVolumeVariables<Traits, OnePVolumeVariables<Traits> >
35{
39
40 using Scalar = typename Traits::PrimaryVariables::value_type;
41 using PermeabilityType = typename Traits::PermeabilityType;
42 static constexpr int numFluidComps = ParentType::numFluidComponents();
43public:
45 using FluidSystem = typename Traits::FluidSystem;
47 using FluidState = typename Traits::FluidState;
49 using Indices = typename Traits::ModelTraits::Indices;
51 using SolidState = typename Traits::SolidState;
53 using SolidSystem = typename Traits::SolidSystem;
54
64 template<class ElemSol, class Problem, class Element, class Scv>
65 void update(const ElemSol& elemSol,
66 const Problem& problem,
67 const Element& element,
68 const Scv& scv)
69 {
70 ParentType::update(elemSol, problem, element, scv);
71
72 // porosity
73 completeFluidState(elemSol, problem, element, scv, fluidState_, solidState_);
74
75 // porosity and permeability
76 updateSolidVolumeFractions(elemSol, problem, element, scv, solidState_, numFluidComps);
77 EnergyVolVars::updateSolidEnergyParams(elemSol, problem, element, scv, solidState_);
78 permeability_ = problem.spatialParams().permeability(element, scv, elemSol);
79 EnergyVolVars::updateEffectiveThermalConductivity();
80 }
81
93 template<class ElemSol, class Problem, class Element, class Scv>
94 void completeFluidState(const ElemSol& elemSol,
95 const Problem& problem,
96 const Element& element,
97 const Scv& scv,
100 {
101 EnergyVolVars::updateTemperature(elemSol, problem, element, scv, fluidState, solidState);
102 fluidState.setSaturation(/*phaseIdx=*/0, 1.);
103
104 const auto& priVars = elemSol[scv.localDofIndex()];
105 fluidState.setPressure(/*phaseIdx=*/0, priVars[Indices::pressureIdx]);
106
107 // saturation in a single phase is always 1 and thus redundant
108 // to set. But since we use the fluid state shared by the
109 // immiscible multi-phase models, so we have to set it here...
110 fluidState.setSaturation(/*phaseIdx=*/0, 1.0);
111
112 typename FluidSystem::ParameterCache paramCache;
113 paramCache.updatePhase(fluidState, /*phaseIdx=*/0);
114
115 Scalar value = FluidSystem::density(fluidState, paramCache, /*phaseIdx=*/0);
116 fluidState.setDensity(/*phaseIdx=*/0, value);
117
118 value = FluidSystem::viscosity(fluidState, paramCache, /*phaseIdx=*/0);
119 fluidState.setViscosity(/*phaseIdx=*/0, value);
120
121 // compute and set the enthalpy
122 value = EnergyVolVars::enthalpy(fluidState, paramCache, /*phaseIdx=*/0);
123 fluidState.setEnthalpy(/*phaseIdx=*/0, value);
124 }
125
133 Scalar temperature() const
134 { return fluidState_.temperature(); }
135
139 const SolidState &solidState() const
140 { return solidState_; }
141
146 Scalar pressure(int phaseIdx = 0) const
147 { return fluidState_.pressure(phaseIdx); }
148
152 Scalar saturation(int phaseIdx = 0) const
153 { return 1.0; }
154
159 Scalar density(int phaseIdx = 0) const
160 { return fluidState_.density(phaseIdx); }
161
166 Scalar viscosity(int phaseIdx = 0) const
167 { return fluidState_.viscosity(phaseIdx); }
168
178 Scalar mobility(int phaseIdx = 0) const
179 { return 1.0/fluidState_.viscosity(phaseIdx); }
180
184 Scalar porosity() const
185 { return solidState_.porosity(); }
186
190 const PermeabilityType& permeability() const
191 { return permeability_; }
192
196 const FluidState &fluidState() const
197 { return fluidState_; }
198
199protected:
202 PermeabilityType permeability_;
203};
204
205} // end namespace Dumux
206
207#endif
Definition: porousmediumflow/nonisothermal/volumevariables.hh:63
Contains the quantities which are constant within a sub-control volume in the one-phase model.
Definition: porousmediumflow/1p/volumevariables.hh:35
typename Traits::FluidSystem FluidSystem
Export the underlying fluid system.
Definition: porousmediumflow/1p/volumevariables.hh:45
typename Traits::SolidSystem SolidSystem
Export type of solid system.
Definition: porousmediumflow/1p/volumevariables.hh:53
typename Traits::FluidState FluidState
Export the fluid state type.
Definition: porousmediumflow/1p/volumevariables.hh:47
typename Traits::SolidState SolidState
Export type of solid state.
Definition: porousmediumflow/1p/volumevariables.hh:51
Scalar density(int phaseIdx=0) const
Returns the mass density of a given phase within the control volume.
Definition: porousmediumflow/1p/volumevariables.hh:159
PermeabilityType permeability_
Definition: porousmediumflow/1p/volumevariables.hh:202
void update(const ElemSol &elemSol, const Problem &problem, const Element &element, const Scv &scv)
Updates all quantities for a given control volume.
Definition: porousmediumflow/1p/volumevariables.hh:65
Scalar pressure(int phaseIdx=0) const
Returns the effective pressure of a given phase within the control volume.
Definition: porousmediumflow/1p/volumevariables.hh:146
void completeFluidState(const ElemSol &elemSol, const Problem &problem, const Element &element, const Scv &scv, FluidState &fluidState, SolidState &solidState)
Sets complete fluid state.
Definition: porousmediumflow/1p/volumevariables.hh:94
const SolidState & solidState() const
Returns the phase state for the control volume.
Definition: porousmediumflow/1p/volumevariables.hh:139
Scalar saturation(int phaseIdx=0) const
Returns the saturation.
Definition: porousmediumflow/1p/volumevariables.hh:152
Scalar porosity() const
Returns the average porosity within the control volume.
Definition: porousmediumflow/1p/volumevariables.hh:184
Scalar temperature() const
Returns the temperature inside the sub-control volume.
Definition: porousmediumflow/1p/volumevariables.hh:133
FluidState fluidState_
Definition: porousmediumflow/1p/volumevariables.hh:200
const PermeabilityType & permeability() const
Returns the permeability within the control volume in .
Definition: porousmediumflow/1p/volumevariables.hh:190
const FluidState & fluidState() const
Returns the fluid state of the control volume.
Definition: porousmediumflow/1p/volumevariables.hh:196
typename Traits::ModelTraits::Indices Indices
Export the indices.
Definition: porousmediumflow/1p/volumevariables.hh:49
SolidState solidState_
Definition: porousmediumflow/1p/volumevariables.hh:201
Scalar viscosity(int phaseIdx=0) const
Returns the dynamic viscosity of the fluid within the control volume.
Definition: porousmediumflow/1p/volumevariables.hh:166
Scalar mobility(int phaseIdx=0) const
Returns the mobility .
Definition: porousmediumflow/1p/volumevariables.hh:178
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
Returns the vector of primary variables.
Definition: porousmediumflow/volumevariables.hh:64
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
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
Represents all relevant thermodynamic quantities of a multi-phase fluid system assuming immiscibility...
std::string viscosity(int phaseIdx) noexcept
I/O name of viscosity for multiphase systems.
Definition: name.hh:62
std::string density(int phaseIdx) noexcept
I/O name of density for multiphase systems.
Definition: name.hh:53
Definition: adapt.hh:17
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.
Update the solid volume fractions (inert and reacitve) and set them in the solidstate.