26#ifndef DUMUX_ENERGY_LOCAL_RESIDUAL_HH
27#define DUMUX_ENERGY_LOCAL_RESIDUAL_HH
36template<
class TypeTag,
bool enableEneryBalance>
39template<
class TypeTag>
46template<
class TypeTag>
53 using SubControlVolume =
typename FVElementGeometry::SubControlVolume;
66 const SubControlVolume& scv,
67 const VolumeVariables& volVars,
79 const SubControlVolume& scv,
80 const VolumeVariables& volVars)
91 FluxVariables& fluxVars,
102 FluxVariables& fluxVars)
112 FluxVariables& fluxVars)
120template<
class TypeTag>
127 using SubControlVolume =
typename FVElementGeometry::SubControlVolume;
130 using Element =
typename GridView::template Codim<0>::Entity;
133 using Indices =
typename ModelTraits::Indices;
135 static constexpr int numPhases = ModelTraits::numFluidPhases();
136 enum { energyEqIdx = Indices::energyEqIdx };
149 const SubControlVolume& scv,
150 const VolumeVariables& volVars,
153 storage[energyEqIdx] += volVars.porosity()
154 * volVars.density(phaseIdx)
155 * volVars.internalEnergy(phaseIdx)
156 * volVars.saturation(phaseIdx);
167 const SubControlVolume& scv,
168 const VolumeVariables& volVars)
170 storage[energyEqIdx] += volVars.temperature()
171 * volVars.solidHeatCapacity()
172 * volVars.solidDensity()
173 * (1.0 - volVars.porosity());
184 FluxVariables& fluxVars,
187 auto upwindTerm = [phaseIdx](
const auto& volVars)
188 {
return volVars.density(phaseIdx)*volVars.mobility(phaseIdx)*volVars.enthalpy(phaseIdx); };
190 flux[energyEqIdx] += fluxVars.advectiveFlux(phaseIdx, upwindTerm);
200 FluxVariables& fluxVars)
202 flux[energyEqIdx] += fluxVars.heatConductionFlux();
212 FluxVariables& fluxVars)
214 if constexpr (Deprecated::hasEnableThermalDispersion<ModelTraits>())
216 if constexpr (ModelTraits::enableThermalDispersion())
218 flux[energyEqIdx] += fluxVars.thermalDispersionFlux();
222 enableThermalDispersionMissing_<ModelTraits>();
236 const Element& element,
237 const FVElementGeometry& fvGeometry,
238 const ElementVolumeVariables& elemVolVars,
239 const SubControlVolume &scv)
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_() {}
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
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.