12#ifndef DUMUX_FREE_FLOW_ENERGY_LOCAL_RESIDUAL_HH 
   13#define DUMUX_FREE_FLOW_ENERGY_LOCAL_RESIDUAL_HH 
   23template<
class Gr
idGeometry, 
class FluxVariables, 
class DiscretizationMethod, 
bool enableEneryBalance, 
bool isCompositional>
 
   31template<
class Gr
idGeometry, 
class FluxVariables, 
bool enableEneryBalance, 
bool isCompositional>
 
   35                                                typename GridGeometry::DiscretizationMethod,
 
   36                                                enableEneryBalance, isCompositional>;
 
   42template<
class Gr
idGeometry, 
class FluxVariables, 
class DiscretizationMethod, 
bool isCompositional>
 
   48    template <
typename... Args>
 
   53    template <
typename... Args>
 
 
   62template<
class Gr
idGeometry, 
class FluxVariables>
 
   63class FreeFlowEnergyLocalResidualImplementation<GridGeometry,
 
   65                                                DiscretizationMethods::Staggered,
 
   68    using Element = 
typename GridGeometry::GridView::template Codim<0>::Entity;
 
   69    using FVElementGeometry = 
typename GridGeometry::LocalView;
 
   70    using SubControlVolumeFace = 
typename FVElementGeometry::SubControlVolumeFace;
 
   75    template<
class NumEqVector, 
class VolumeVariables>
 
   77                                  const VolumeVariables& volVars)
 
   79        static constexpr auto localEnergyBalanceIdx = NumEqVector::dimension - 1;
 
   80        storage[localEnergyBalanceIdx] += volVars.density() * volVars.internalEnergy();
 
   84    template<
class NumEqVector, 
class Problem, 
class ElementVolumeVariables, 
class ElementFaceVariables>
 
   86                         const Problem& problem,
 
   87                         const Element &element,
 
   88                         const FVElementGeometry& fvGeometry,
 
   89                         const ElementVolumeVariables& elemVolVars,
 
   90                         const ElementFaceVariables& elemFaceVars,
 
   91                         const SubControlVolumeFace& scvf)
 
   93        static constexpr auto localEnergyBalanceIdx = NumEqVector::dimension - 1;
 
   95        auto upwindTerm = [](
const auto& volVars) { 
return volVars.density() * volVars.enthalpy(); };
 
   96        flux[localEnergyBalanceIdx] += FluxVariables::advectiveFluxForCellCenter(problem,
 
  103        flux[localEnergyBalanceIdx] += FluxVariables::HeatConductionType::flux(problem,
 
  115template<
class Gr
idGeometry, 
class FluxVariables>
 
  122                                                       DiscretizationMethods::Staggered,
 
  129    using Element = 
typename GridGeometry::GridView::template Codim<0>::Entity;
 
  130    using FVElementGeometry = 
typename GridGeometry::LocalView;
 
  131    using SubControlVolumeFace = 
typename FVElementGeometry::SubControlVolumeFace;
 
  135    template<
class NumEqVector, 
class Problem, 
class ElementVolumeVariables, 
class ElementFaceVariables>
 
  137                         const Problem& problem,
 
  138                         const Element &element,
 
  139                         const FVElementGeometry& fvGeometry,
 
  140                         const ElementVolumeVariables& elemVolVars,
 
  141                         const ElementFaceVariables& elemFaceVars,
 
  142                         const SubControlVolumeFace& scvf)
 
  144        ParentType::heatFlux(flux, problem, element, fvGeometry, elemVolVars, elemFaceVars, scvf);
 
  146        static constexpr auto localEnergyBalanceIdx = NumEqVector::dimension - 1;
 
  147        auto diffusiveFlux = FluxVariables::MolecularDiffusionType::flux(problem, element, fvGeometry, elemVolVars, scvf);
 
  148        for (
int compIdx = 0; compIdx < FluxVariables::numComponents; ++compIdx)
 
  152            const bool insideIsUpstream = !signbit(diffusiveFlux[compIdx]);
 
  153            const auto& upstreamVolVars = insideIsUpstream ? elemVolVars[scvf.insideScvIdx()] : elemVolVars[scvf.outsideScvIdx()];
 
  156                flux[localEnergyBalanceIdx] += diffusiveFlux[compIdx] * upstreamVolVars.componentEnthalpy(compIdx);
 
  158                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:136
static void heatFlux(Args &&... args)
do nothing for the isothermal case
Definition freeflow/nonisothermal/localresidual.hh:54
static void fluidPhaseStorage(Args &&... args)
do nothing for the isothermal case
Definition freeflow/nonisothermal/localresidual.hh:49
Definition freeflow/nonisothermal/localresidual.hh:24
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
@ massAveraged
Definition referencesystemformulation.hh:34
FreeFlowEnergyLocalResidualImplementation< GridGeometry, FluxVariables, typename GridGeometry::DiscretizationMethod, enableEneryBalance, isCompositional > FreeFlowEnergyLocalResidual
Element-wise calculation of the local residual for non-isothermal free-flow models.
Definition freeflow/nonisothermal/localresidual.hh:32
The available discretization methods in Dumux.