24#ifndef DUMUX_FREE_FLOW_ENERGY_LOCAL_RESIDUAL_HH
25#define DUMUX_FREE_FLOW_ENERGY_LOCAL_RESIDUAL_HH
33template<
class Gr
idGeometry,
class FluxVariables, DiscretizationMethod discMethod,
bool enableEneryBalance,
bool isCompositional>
41template<
class Gr
idGeometry,
class FluxVariables,
bool enableEneryBalance,
bool isCompositional>
45 GridGeometry::discMethod,
46 enableEneryBalance, isCompositional>;
52template<
class Gr
idGeometry,
class FluxVariables, DiscretizationMethod discMethod,
bool isCompositional>
58 template <
typename... Args>
63 template <
typename... Args>
72template<
class Gr
idGeometry,
class FluxVariables>
78 using Element =
typename GridGeometry::GridView::template Codim<0>::Entity;
79 using FVElementGeometry =
typename GridGeometry::LocalView;
80 using SubControlVolumeFace =
typename FVElementGeometry::SubControlVolumeFace;
85 template<
class NumEqVector,
class VolumeVariables>
87 const VolumeVariables& volVars)
89 static constexpr auto localEnergyBalanceIdx = NumEqVector::dimension - 1;
90 storage[localEnergyBalanceIdx] += volVars.density() * volVars.internalEnergy();
94 template<
class NumEqVector,
class Problem,
class ElementVolumeVariables,
class ElementFaceVariables>
96 const Problem& problem,
97 const Element &element,
98 const FVElementGeometry& fvGeometry,
99 const ElementVolumeVariables& elemVolVars,
100 const ElementFaceVariables& elemFaceVars,
101 const SubControlVolumeFace& scvf)
103 static constexpr auto localEnergyBalanceIdx = NumEqVector::dimension - 1;
105 auto upwindTerm = [](
const auto& volVars) {
return volVars.density() * volVars.enthalpy(); };
106 flux[localEnergyBalanceIdx] += FluxVariables::advectiveFluxForCellCenter(problem,
112 flux[localEnergyBalanceIdx] += FluxVariables::HeatConductionType::flux(problem,
124template<
class Gr
idGeometry,
class FluxVariables>
131 DiscretizationMethod::staggered,
138 using Element =
typename GridGeometry::GridView::template Codim<0>::Entity;
139 using FVElementGeometry =
typename GridGeometry::LocalView;
140 using SubControlVolumeFace =
typename FVElementGeometry::SubControlVolumeFace;
144 template<
class NumEqVector,
class Problem,
class ElementVolumeVariables,
class ElementFaceVariables>
146 const Problem& problem,
147 const Element &element,
148 const FVElementGeometry& fvGeometry,
149 const ElementVolumeVariables& elemVolVars,
150 const ElementFaceVariables& elemFaceVars,
151 const SubControlVolumeFace& scvf)
153 ParentType::heatFlux(flux, problem, element, fvGeometry, elemVolVars, elemFaceVars, scvf);
155 static constexpr auto localEnergyBalanceIdx = NumEqVector::dimension - 1;
156 auto diffusiveFlux = FluxVariables::MolecularDiffusionType::flux(problem, element, fvGeometry, elemVolVars, scvf);
157 for (
int compIdx = 0; compIdx < FluxVariables::numComponents; ++compIdx)
159 const bool insideIsUpstream = scvf.directionSign() ==
sign(diffusiveFlux[compIdx]);
160 const auto& upstreamVolVars = insideIsUpstream ? elemVolVars[scvf.insideScvIdx()] : elemVolVars[scvf.outsideScvIdx()];
163 flux[localEnergyBalanceIdx] += diffusiveFlux[compIdx] * upstreamVolVars.componentEnthalpy(compIdx);
165 flux[localEnergyBalanceIdx] += diffusiveFlux[compIdx] * upstreamVolVars.componentEnthalpy(compIdx)* elemVolVars[scvf.insideScvIdx()].molarMass(compIdx);
The available discretization methods in Dumux.
The reference frameworks and formulations available for splitting total fluxes into a advective and d...
DiscretizationMethod
The available discretization methods in Dumux.
Definition: method.hh:37
constexpr int sign(const ValueType &value) noexcept
Sign or signum function.
Definition: math.hh:641
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: freeflow/nonisothermal/localresidual.hh:34
static void heatFlux(Args &&... args)
do nothing for the isothermal case
Definition: freeflow/nonisothermal/localresidual.hh:64
static void fluidPhaseStorage(Args &&... args)
do nothing for the isothermal case
Definition: freeflow/nonisothermal/localresidual.hh:59
Specialization for staggered one-phase, non-isothermal models.
Definition: freeflow/nonisothermal/localresidual.hh:77
static void heatFlux(NumEqVector &flux, const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const ElementFaceVariables &elemFaceVars, const SubControlVolumeFace &scvf)
The convective and conductive heat fluxes in the fluid phase.
Definition: freeflow/nonisothermal/localresidual.hh:95
static void fluidPhaseStorage(NumEqVector &storage, const VolumeVariables &volVars)
The energy storage in the fluid phase.
Definition: freeflow/nonisothermal/localresidual.hh:86
static void heatFlux(NumEqVector &flux, const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const ElementFaceVariables &elemFaceVars, const SubControlVolumeFace &scvf)
The convective and conductive heat fluxes in the fluid phase.
Definition: freeflow/nonisothermal/localresidual.hh:145