3.5-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
porousmediumflow/nonisothermal/localresidual.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 *****************************************************************************/
26#ifndef DUMUX_ENERGY_LOCAL_RESIDUAL_HH
27#define DUMUX_ENERGY_LOCAL_RESIDUAL_HH
28
32
33namespace Dumux {
34
35// forward declaration
36template<class TypeTag, bool enableEneryBalance>
38
39template<class TypeTag>
41
46template<class TypeTag>
48{
52 using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView;
53 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
55
56public:
65 static void fluidPhaseStorage(NumEqVector& storage,
66 const SubControlVolume& scv,
67 const VolumeVariables& volVars,
68 int phaseIdx)
69 {}
70
78 static void solidPhaseStorage(NumEqVector& storage,
79 const SubControlVolume& scv,
80 const VolumeVariables& volVars)
81 {}
82
90 static void heatConvectionFlux(NumEqVector& flux,
91 FluxVariables& fluxVars,
92 int phaseIdx)
93 {}
94
101 static void heatConductionFlux(NumEqVector& flux,
102 FluxVariables& fluxVars)
103 {}
104
111 static void heatDispersionFlux(NumEqVector& flux,
112 FluxVariables& fluxVars)
113 {}
114};
115
120template<class TypeTag>
122{
126 using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView;
127 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
130 using Element = typename GridView::template Codim<0>::Entity;
131 using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView;
133 using Indices = typename ModelTraits::Indices;
134
135 static constexpr int numPhases = ModelTraits::numFluidPhases();
136 enum { energyEqIdx = Indices::energyEqIdx };
137
138public:
139
148 static void fluidPhaseStorage(NumEqVector& storage,
149 const SubControlVolume& scv,
150 const VolumeVariables& volVars,
151 int phaseIdx)
152 {
153 storage[energyEqIdx] += volVars.porosity()
154 * volVars.density(phaseIdx)
155 * volVars.internalEnergy(phaseIdx)
156 * volVars.saturation(phaseIdx);
157 }
158
166 static void solidPhaseStorage(NumEqVector& storage,
167 const SubControlVolume& scv,
168 const VolumeVariables& volVars)
169 {
170 storage[energyEqIdx] += volVars.temperature()
171 * volVars.solidHeatCapacity()
172 * volVars.solidDensity()
173 * (1.0 - volVars.porosity());
174 }
175
183 static void heatConvectionFlux(NumEqVector& flux,
184 FluxVariables& fluxVars,
185 int phaseIdx)
186 {
187 auto upwindTerm = [phaseIdx](const auto& volVars)
188 { return volVars.density(phaseIdx)*volVars.mobility(phaseIdx)*volVars.enthalpy(phaseIdx); };
189
190 flux[energyEqIdx] += fluxVars.advectiveFlux(phaseIdx, upwindTerm);
191 }
192
199 static void heatConductionFlux(NumEqVector& flux,
200 FluxVariables& fluxVars)
201 {
202 flux[energyEqIdx] += fluxVars.heatConductionFlux();
203 }
204
211 static void heatDispersionFlux(NumEqVector& flux,
212 FluxVariables& fluxVars)
213 {
214 if constexpr (Deprecated::hasEnableThermalDispersion<ModelTraits>())
215 {
216 if constexpr (ModelTraits::enableThermalDispersion())
217 {
218 flux[energyEqIdx] += fluxVars.thermalDispersionFlux();
219 }
220 }
221 else
222 enableThermalDispersionMissing_<ModelTraits>();
223 }
224
225
235 static void computeSourceEnergy(NumEqVector& source,
236 const Element& element,
237 const FVElementGeometry& fvGeometry,
238 const ElementVolumeVariables& elemVolVars,
239 const SubControlVolume &scv)
240 {}
241
242private:
243
244 template <class T = ModelTraits>
245 [[deprecated("All non-isothermal models must specifiy if thermal dispersion is enabled."
246 "Please add enableThermalDispersion to the ModelTraits in your model header.")]]
247 static void enableThermalDispersionMissing_() {}
248
249};
250
251} // end namespace Dumux
252
253#endif
A helper to deduce a vector with the same size as numbers of equations.
Helpers for deprecation.
typename NumEqVectorTraits< PrimaryVariables >::type NumEqVector
A vector with the same size as numbers of equations This is the default implementation and has to be ...
Definition: numeqvector.hh:46
Definition: adapt.hh:29
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:150
Definition: porousmediumflow/nonisothermal/localresidual.hh:37
static void heatDispersionFlux(NumEqVector &flux, FluxVariables &fluxVars)
The dispersive energy fluxes.
Definition: porousmediumflow/nonisothermal/localresidual.hh:111
static void heatConductionFlux(NumEqVector &flux, FluxVariables &fluxVars)
The diffusive energy fluxes.
Definition: porousmediumflow/nonisothermal/localresidual.hh:101
static void fluidPhaseStorage(NumEqVector &storage, const SubControlVolume &scv, const VolumeVariables &volVars, int phaseIdx)
The energy storage in the fluid phase with index phaseIdx.
Definition: porousmediumflow/nonisothermal/localresidual.hh:65
static void heatConvectionFlux(NumEqVector &flux, FluxVariables &fluxVars, int phaseIdx)
The advective phase energy fluxes.
Definition: porousmediumflow/nonisothermal/localresidual.hh:90
static void solidPhaseStorage(NumEqVector &storage, const SubControlVolume &scv, const VolumeVariables &volVars)
The energy storage in the solid matrix.
Definition: porousmediumflow/nonisothermal/localresidual.hh:78
static void solidPhaseStorage(NumEqVector &storage, const SubControlVolume &scv, const VolumeVariables &volVars)
The energy storage in the solid matrix.
Definition: porousmediumflow/nonisothermal/localresidual.hh:166
static void fluidPhaseStorage(NumEqVector &storage, const SubControlVolume &scv, const VolumeVariables &volVars, int phaseIdx)
The energy storage in the fluid phase with index phaseIdx.
Definition: porousmediumflow/nonisothermal/localresidual.hh:148
static void heatConductionFlux(NumEqVector &flux, FluxVariables &fluxVars)
The diffusive energy fluxes.
Definition: porousmediumflow/nonisothermal/localresidual.hh:199
static void heatDispersionFlux(NumEqVector &flux, FluxVariables &fluxVars)
The dispersive energy fluxes.
Definition: porousmediumflow/nonisothermal/localresidual.hh:211
static void computeSourceEnergy(NumEqVector &source, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolume &scv)
heat transfer between the phases for nonequilibrium models
Definition: porousmediumflow/nonisothermal/localresidual.hh:235
static void heatConvectionFlux(NumEqVector &flux, FluxVariables &fluxVars, int phaseIdx)
The advective phase energy fluxes.
Definition: porousmediumflow/nonisothermal/localresidual.hh:183
Declares all properties used in Dumux.