3.3.0
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
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 * See the file COPYING for full copying permissions. *
5 * *
6 * This program is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation, either version 3 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
18 *****************************************************************************/
25#ifndef DUMUX_1P_VOLUME_VARIABLES_HH
26#define DUMUX_1P_VOLUME_VARIABLES_HH
27
32
33namespace Dumux {
34
42template<class Traits>
44: public PorousMediumFlowVolumeVariables< Traits>
45, public EnergyVolumeVariables<Traits, OnePVolumeVariables<Traits> >
46{
50
51 using Scalar = typename Traits::PrimaryVariables::value_type;
52 using PermeabilityType = typename Traits::PermeabilityType;
53 static constexpr int numFluidComps = ParentType::numFluidComponents();
54public:
56 using FluidSystem = typename Traits::FluidSystem;
58 using FluidState = typename Traits::FluidState;
60 using Indices = typename Traits::ModelTraits::Indices;
62 using SolidState = typename Traits::SolidState;
64 using SolidSystem = typename Traits::SolidSystem;
65
75 template<class ElemSol, class Problem, class Element, class Scv>
76 void update(const ElemSol& elemSol,
77 const Problem& problem,
78 const Element& element,
79 const Scv& scv)
80 {
81 ParentType::update(elemSol, problem, element, scv);
82
83 // porosity
84 completeFluidState(elemSol, problem, element, scv, fluidState_, solidState_);
85
86 // porosity and permeability
87 updateSolidVolumeFractions(elemSol, problem, element, scv, solidState_, numFluidComps);
88 EnergyVolVars::updateSolidEnergyParams(elemSol, problem, element, scv, solidState_);
89 permeability_ = problem.spatialParams().permeability(element, scv, elemSol);
90 EnergyVolVars::updateEffectiveThermalConductivity();
91 }
92
104 template<class ElemSol, class Problem, class Element, class Scv>
105 void completeFluidState(const ElemSol& elemSol,
106 const Problem& problem,
107 const Element& element,
108 const Scv& scv,
111 {
112 EnergyVolVars::updateTemperature(elemSol, problem, element, scv, fluidState, solidState);
113 fluidState.setSaturation(/*phaseIdx=*/0, 1.);
114
115 const auto& priVars = elemSol[scv.localDofIndex()];
116 fluidState.setPressure(/*phaseIdx=*/0, priVars[Indices::pressureIdx]);
117
118 // saturation in a single phase is always 1 and thus redundant
119 // to set. But since we use the fluid state shared by the
120 // immiscible multi-phase models, so we have to set it here...
121 fluidState.setSaturation(/*phaseIdx=*/0, 1.0);
122
123 typename FluidSystem::ParameterCache paramCache;
124 paramCache.updatePhase(fluidState, /*phaseIdx=*/0);
125
126 Scalar value = FluidSystem::density(fluidState, paramCache, /*phaseIdx=*/0);
127 fluidState.setDensity(/*phaseIdx=*/0, value);
128
129 value = FluidSystem::viscosity(fluidState, paramCache, /*phaseIdx=*/0);
130 fluidState.setViscosity(/*phaseIdx=*/0, value);
131
132 // compute and set the enthalpy
133 value = EnergyVolVars::enthalpy(fluidState, paramCache, /*phaseIdx=*/0);
134 fluidState.setEnthalpy(/*phaseIdx=*/0, value);
135 }
136
144 Scalar temperature() const
145 { return fluidState_.temperature(); }
146
150 const SolidState &solidState() const
151 { return solidState_; }
152
157 Scalar pressure(int phaseIdx = 0) const
158 { return fluidState_.pressure(phaseIdx); }
159
163 Scalar saturation(int phaseIdx = 0) const
164 { return 1.0; }
165
170 Scalar density(int phaseIdx = 0) const
171 { return fluidState_.density(phaseIdx); }
172
177 Scalar viscosity(int phaseIdx = 0) const
178 { return fluidState_.viscosity(phaseIdx); }
179
189 Scalar mobility(int phaseIdx = 0) const
190 { return 1.0/fluidState_.viscosity(phaseIdx); }
191
195 Scalar porosity() const
196 { return solidState_.porosity(); }
197
201 const PermeabilityType& permeability() const
202 { return permeability_; }
203
207 const FluidState &fluidState() const
208 { return fluidState_; }
209
210protected:
213 PermeabilityType permeability_;
214};
215
216} // end namespace Dumux
217
218#endif
Represents all relevant thermodynamic quantities of a multi-phase fluid system assuming immiscibility...
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
Definition: adapt.hh:29
std::string viscosity(int phaseIdx) noexcept
I/O name of viscosity for multiphase systems.
Definition: name.hh:74
std::string density(int phaseIdx) noexcept
I/O name of density for multiphase systems.
Definition: name.hh:65
Contains the quantities which are constant within a finite volume in the one-phase model.
Definition: porousmediumflow/1p/volumevariables.hh:46
typename Traits::FluidSystem FluidSystem
Export the underlying fluid system.
Definition: porousmediumflow/1p/volumevariables.hh:56
typename Traits::SolidSystem SolidSystem
Export type of solid system.
Definition: porousmediumflow/1p/volumevariables.hh:64
typename Traits::FluidState FluidState
Export the fluid state type.
Definition: porousmediumflow/1p/volumevariables.hh:58
typename Traits::SolidState SolidState
Export type of solid state.
Definition: porousmediumflow/1p/volumevariables.hh:62
Scalar density(int phaseIdx=0) const
Returns the mass density of a given phase within the control volume.
Definition: porousmediumflow/1p/volumevariables.hh:170
PermeabilityType permeability_
Definition: porousmediumflow/1p/volumevariables.hh:213
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:76
Scalar pressure(int phaseIdx=0) const
Returns the effective pressure of a given phase within the control volume.
Definition: porousmediumflow/1p/volumevariables.hh:157
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:105
const SolidState & solidState() const
Returns the phase state for the control volume.
Definition: porousmediumflow/1p/volumevariables.hh:150
Scalar saturation(int phaseIdx=0) const
Returns the saturation.
Definition: porousmediumflow/1p/volumevariables.hh:163
Scalar porosity() const
Returns the average porosity within the control volume.
Definition: porousmediumflow/1p/volumevariables.hh:195
Scalar temperature() const
Returns the temperature inside the sub-control volume.
Definition: porousmediumflow/1p/volumevariables.hh:144
FluidState fluidState_
Definition: porousmediumflow/1p/volumevariables.hh:211
const PermeabilityType & permeability() const
Returns the permeability within the control volume in .
Definition: porousmediumflow/1p/volumevariables.hh:201
const FluidState & fluidState() const
Returns the fluid state of the control volume.
Definition: porousmediumflow/1p/volumevariables.hh:207
typename Traits::ModelTraits::Indices Indices
Export the indices.
Definition: porousmediumflow/1p/volumevariables.hh:60
SolidState solidState_
Definition: porousmediumflow/1p/volumevariables.hh:212
Scalar viscosity(int phaseIdx=0) const
Returns the dynamic viscosity of the fluid within the control volume.
Definition: porousmediumflow/1p/volumevariables.hh:177
Scalar mobility(int phaseIdx=0) const
Returns the mobility .
Definition: porousmediumflow/1p/volumevariables.hh:189
Definition: porousmediumflow/nonisothermal/volumevariables.hh:75
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.