12#ifndef DUMUX_FREE_FLOW_ENERGY_LOCAL_RESIDUAL_HH
13#define DUMUX_FREE_FLOW_ENERGY_LOCAL_RESIDUAL_HH
21template<
class Gr
idGeometry,
class FluxVariables,
class DiscretizationMethod,
bool enableEneryBalance,
bool isCompositional>
29template<
class Gr
idGeometry,
class FluxVariables,
bool enableEneryBalance,
bool isCompositional>
33 typename GridGeometry::DiscretizationMethod,
34 enableEneryBalance, isCompositional>;
40template<
class Gr
idGeometry,
class FluxVariables,
class DiscretizationMethod,
bool isCompositional>
46 template <
typename... Args>
51 template <
typename... Args>
60template<
class Gr
idGeometry,
class FluxVariables>
63 DiscretizationMethods::Staggered,
66 using Element =
typename GridGeometry::GridView::template Codim<0>::Entity;
67 using FVElementGeometry =
typename GridGeometry::LocalView;
68 using SubControlVolumeFace =
typename FVElementGeometry::SubControlVolumeFace;
73 template<
class NumEqVector,
class VolumeVariables>
75 const VolumeVariables& volVars)
77 static constexpr auto localEnergyBalanceIdx = NumEqVector::dimension - 1;
78 storage[localEnergyBalanceIdx] += volVars.density() * volVars.internalEnergy();
82 template<
class NumEqVector,
class Problem,
class ElementVolumeVariables,
class ElementFaceVariables>
84 const Problem& problem,
85 const Element &element,
86 const FVElementGeometry& fvGeometry,
87 const ElementVolumeVariables& elemVolVars,
88 const ElementFaceVariables& elemFaceVars,
89 const SubControlVolumeFace& scvf)
91 static constexpr auto localEnergyBalanceIdx = NumEqVector::dimension - 1;
93 auto upwindTerm = [](
const auto& volVars) {
return volVars.density() * volVars.enthalpy(); };
94 flux[localEnergyBalanceIdx] += FluxVariables::advectiveFluxForCellCenter(problem,
101 flux[localEnergyBalanceIdx] += FluxVariables::HeatConductionType::flux(problem,
113template<
class Gr
idGeometry,
class FluxVariables>
116 DiscretizationMethods::Staggered,
120 DiscretizationMethods::Staggered,
127 using Element =
typename GridGeometry::GridView::template Codim<0>::Entity;
128 using FVElementGeometry =
typename GridGeometry::LocalView;
129 using SubControlVolumeFace =
typename FVElementGeometry::SubControlVolumeFace;
133 template<
class NumEqVector,
class Problem,
class ElementVolumeVariables,
class ElementFaceVariables>
135 const Problem& problem,
136 const Element &element,
137 const FVElementGeometry& fvGeometry,
138 const ElementVolumeVariables& elemVolVars,
139 const ElementFaceVariables& elemFaceVars,
140 const SubControlVolumeFace& scvf)
142 ParentType::heatFlux(flux, problem, element, fvGeometry, elemVolVars, elemFaceVars, scvf);
144 static constexpr auto localEnergyBalanceIdx = NumEqVector::dimension - 1;
145 auto diffusiveFlux = FluxVariables::MolecularDiffusionType::flux(problem, element, fvGeometry, elemVolVars, scvf);
146 for (
int compIdx = 0; compIdx < FluxVariables::numComponents; ++compIdx)
148 const bool insideIsUpstream = scvf.directionSign() ==
sign(diffusiveFlux[compIdx]);
149 const auto& upstreamVolVars = insideIsUpstream ? elemVolVars[scvf.insideScvIdx()] : elemVolVars[scvf.outsideScvIdx()];
152 flux[localEnergyBalanceIdx] += diffusiveFlux[compIdx] * upstreamVolVars.componentEnthalpy(compIdx);
154 flux[localEnergyBalanceIdx] += diffusiveFlux[compIdx] * upstreamVolVars.componentEnthalpy(compIdx)* elemVolVars[scvf.insideScvIdx()].molarMass(compIdx);
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:134
Specialization for staggered one-phase, non-isothermal models.
Definition: freeflow/nonisothermal/localresidual.hh:65
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:83
static void fluidPhaseStorage(NumEqVector &storage, const VolumeVariables &volVars)
The energy storage in the fluid phase.
Definition: freeflow/nonisothermal/localresidual.hh:74
static void heatFlux(Args &&... args)
do nothing for the isothermal case
Definition: freeflow/nonisothermal/localresidual.hh:52
static void fluidPhaseStorage(Args &&... args)
do nothing for the isothermal case
Definition: freeflow/nonisothermal/localresidual.hh:47
Definition: freeflow/nonisothermal/localresidual.hh:22
The available discretization methods in Dumux.
constexpr int sign(const ValueType &value) noexcept
Sign or signum function.
Definition: math.hh:629
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:34
Definition: method.hh:114