3.6-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
31
32namespace Dumux {
33
34// forward declaration
35template<class TypeTag, bool enableEneryBalance>
37
38template<class TypeTag>
40
45template<class TypeTag>
47{
51 using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView;
52 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
54
55public:
64 static void fluidPhaseStorage(NumEqVector& storage,
65 const SubControlVolume& scv,
66 const VolumeVariables& volVars,
67 int phaseIdx)
68 {}
69
77 static void solidPhaseStorage(NumEqVector& storage,
78 const SubControlVolume& scv,
79 const VolumeVariables& volVars)
80 {}
81
89 static void heatConvectionFlux(NumEqVector& flux,
90 FluxVariables& fluxVars,
91 int phaseIdx)
92 {}
93
100 static void heatConductionFlux(NumEqVector& flux,
101 FluxVariables& fluxVars)
102 {}
103
110 static void heatDispersionFlux(NumEqVector& flux,
111 FluxVariables& fluxVars)
112 {}
113};
114
119template<class TypeTag>
121{
125 using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView;
126 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
129 using Element = typename GridView::template Codim<0>::Entity;
130 using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView;
132 using Indices = typename ModelTraits::Indices;
133
134 static constexpr int numPhases = ModelTraits::numFluidPhases();
135 enum { energyEqIdx = Indices::energyEqIdx };
136
137public:
138
147 static void fluidPhaseStorage(NumEqVector& storage,
148 const SubControlVolume& scv,
149 const VolumeVariables& volVars,
150 int phaseIdx)
151 {
152 storage[energyEqIdx] += volVars.porosity()
153 * volVars.density(phaseIdx)
154 * volVars.internalEnergy(phaseIdx)
155 * volVars.saturation(phaseIdx);
156 }
157
165 static void solidPhaseStorage(NumEqVector& storage,
166 const SubControlVolume& scv,
167 const VolumeVariables& volVars)
168 {
169 storage[energyEqIdx] += volVars.temperature()
170 * volVars.solidHeatCapacity()
171 * volVars.solidDensity()
172 * (1.0 - volVars.porosity());
173 }
174
182 static void heatConvectionFlux(NumEqVector& flux,
183 FluxVariables& fluxVars,
184 int phaseIdx)
185 {
186 auto upwindTerm = [phaseIdx](const auto& volVars)
187 { return volVars.density(phaseIdx)*volVars.mobility(phaseIdx)*volVars.enthalpy(phaseIdx); };
188
189 flux[energyEqIdx] += fluxVars.advectiveFlux(phaseIdx, upwindTerm);
190 }
191
198 static void heatConductionFlux(NumEqVector& flux,
199 FluxVariables& fluxVars)
200 {
201 flux[energyEqIdx] += fluxVars.heatConductionFlux();
202 }
203
210 static void heatDispersionFlux(NumEqVector& flux,
211 FluxVariables& fluxVars)
212 {
213
214 if constexpr (ModelTraits::enableThermalDispersion())
215 {
216 flux[energyEqIdx] += fluxVars.thermalDispersionFlux();
217 }
218 }
219
220
230 static void computeSourceEnergy(NumEqVector& source,
231 const Element& element,
232 const FVElementGeometry& fvGeometry,
233 const ElementVolumeVariables& elemVolVars,
234 const SubControlVolume &scv)
235 {}
236};
237
238} // end namespace Dumux
239
240#endif
A helper to deduce a vector with the same size as numbers of equations.
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
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
Definition: adapt.hh:29
typename GetProp< TypeTag, Property >::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:180
Definition: porousmediumflow/nonisothermal/localresidual.hh:36
static void heatDispersionFlux(NumEqVector &flux, FluxVariables &fluxVars)
The dispersive energy fluxes.
Definition: porousmediumflow/nonisothermal/localresidual.hh:110
static void heatConductionFlux(NumEqVector &flux, FluxVariables &fluxVars)
The diffusive energy fluxes.
Definition: porousmediumflow/nonisothermal/localresidual.hh:100
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:64
static void heatConvectionFlux(NumEqVector &flux, FluxVariables &fluxVars, int phaseIdx)
The advective phase energy fluxes.
Definition: porousmediumflow/nonisothermal/localresidual.hh:89
static void solidPhaseStorage(NumEqVector &storage, const SubControlVolume &scv, const VolumeVariables &volVars)
The energy storage in the solid matrix.
Definition: porousmediumflow/nonisothermal/localresidual.hh:77
static void solidPhaseStorage(NumEqVector &storage, const SubControlVolume &scv, const VolumeVariables &volVars)
The energy storage in the solid matrix.
Definition: porousmediumflow/nonisothermal/localresidual.hh:165
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:147
static void heatConductionFlux(NumEqVector &flux, FluxVariables &fluxVars)
The diffusive energy fluxes.
Definition: porousmediumflow/nonisothermal/localresidual.hh:198
static void heatDispersionFlux(NumEqVector &flux, FluxVariables &fluxVars)
The dispersive energy fluxes.
Definition: porousmediumflow/nonisothermal/localresidual.hh:210
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:230
static void heatConvectionFlux(NumEqVector &flux, FluxVariables &fluxVars, int phaseIdx)
The advective phase energy fluxes.
Definition: porousmediumflow/nonisothermal/localresidual.hh:182
Declares all properties used in Dumux.