12#ifndef DUMUX_STAGGERED_KEPSILON_LOCAL_RESIDUAL_HH
13#define DUMUX_STAGGERED_KEPSILON_LOCAL_RESIDUAL_HH
15#include <dune/common/hybridutilities.hh>
28template<
class TypeTag,
class BaseLocalRes
idual,
class DiscretizationMethod>
31template<
class TypeTag,
class BaseLocalRes
idual>
33:
public BaseLocalResidual
35 using ParentType = BaseLocalResidual;
40 using GridVolumeVariables =
typename GridVariables::GridVolumeVariables;
41 using ElementVolumeVariables =
typename GridVolumeVariables::LocalView;
42 using VolumeVariables =
typename GridVolumeVariables::VolumeVariables;
44 using GridFluxVariablesCache =
typename GridVariables::GridFluxVariablesCache;
45 using ElementFluxVariablesCache =
typename GridFluxVariablesCache::LocalView;
48 using GridFaceVariables =
typename GridVariables::GridFaceVariables;
49 using ElementFaceVariables =
typename GridFaceVariables::LocalView;
54 using Element =
typename GridView::template Codim<0>::Entity;
56 using SubControlVolume =
typename FVElementGeometry::SubControlVolume;
61 using CellCenterResidual = CellCenterPrimaryVariables;
63 static constexpr int turbulentKineticEnergyEqIdx = Indices::turbulentKineticEnergyEqIdx - ModelTraits::dim();
64 static constexpr int dissipationEqIdx = Indices::dissipationEqIdx - ModelTraits::dim();
67 using ParentType::ParentType;
70 static constexpr auto cellCenterOffset = ModelTraits::numEq() - CellCenterPrimaryVariables::dimension;
71 static_assert(cellCenterOffset == ModelTraits::dim(),
"cellCenterOffset must equal dim for staggered NavierStokes");
75 const SubControlVolume& scv,
76 const VolumeVariables& volVars)
const
78 CellCenterPrimaryVariables storage = ParentType::computeStorageForCellCenter(problem, scv, volVars);
80 storage[turbulentKineticEnergyEqIdx] = volVars.turbulentKineticEnergy() * volVars.density();
81 storage[dissipationEqIdx] = volVars.dissipation() * volVars.density();
87 const Element &element,
88 const FVElementGeometry& fvGeometry,
89 const ElementVolumeVariables& elemVolVars,
90 const ElementFaceVariables& elemFaceVars,
91 const SubControlVolume &scv)
const
93 CellCenterPrimaryVariables source = ParentType::computeSourceForCellCenter(problem, element, fvGeometry,
94 elemVolVars, elemFaceVars, scv);
96 const auto& volVars = elemVolVars[scv];
97 Scalar turbulentKineticEnergy = volVars.turbulentKineticEnergy();
98 Scalar dissipation = volVars.dissipation();
102 if (!volVars.isMatchingPoint())
104 source[turbulentKineticEnergyEqIdx] += 2.0 * volVars.dynamicEddyViscosity()
105 * volVars.stressTensorScalarProduct();
107 source[dissipationEqIdx] += volVars.cOneEpsilon()
108 * dissipation / turbulentKineticEnergy
109 * 2.0 * volVars.dynamicEddyViscosity()
110 * volVars.stressTensorScalarProduct();
114 if (!volVars.isMatchingPoint())
116 source[turbulentKineticEnergyEqIdx] -= dissipation * volVars.density();
118 source[dissipationEqIdx] -= volVars.cTwoEpsilon()
119 * dissipation * dissipation
120 / turbulentKineticEnergy * volVars.density();
CellCenterPrimaryVariables computeSourceForCellCenter(const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const ElementFaceVariables &elemFaceVars, const SubControlVolume &scv) const
Definition: freeflow/rans/twoeq/kepsilon/staggered/localresidual.hh:86
CellCenterPrimaryVariables computeStorageForCellCenter(const Problem &problem, const SubControlVolume &scv, const VolumeVariables &volVars) const
Evaluate fluxes entering or leaving the cell center control volume.
Definition: freeflow/rans/twoeq/kepsilon/staggered/localresidual.hh:74
Element-wise calculation of the residual for k-epsilon models using the staggered discretization.
Definition: freeflow/rans/twoeq/kepsilon/localresidual.hh:24
Calculates the element-wise residual for the staggered FV scheme.
Definition: staggeredlocalresidual.hh:29
Defines all properties used in Dumux.
typename GetProp< TypeTag, Property >::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:296
The available discretization methods in Dumux.