24#ifndef DUMUX_STAGGERED_KEPSILON_LOCAL_RESIDUAL_HH
25#define DUMUX_STAGGERED_KEPSILON_LOCAL_RESIDUAL_HH
27#include <dune/common/hybridutilities.hh>
40template<
class TypeTag,
class BaseLocalRes
idual, DiscretizationMethod discMethod>
43template<
class TypeTag,
class BaseLocalRes
idual>
45:
public BaseLocalResidual
47 using ParentType = BaseLocalResidual;
52 using GridVolumeVariables =
typename GridVariables::GridVolumeVariables;
53 using ElementVolumeVariables =
typename GridVolumeVariables::LocalView;
54 using VolumeVariables =
typename GridVolumeVariables::VolumeVariables;
56 using GridFluxVariablesCache =
typename GridVariables::GridFluxVariablesCache;
57 using ElementFluxVariablesCache =
typename GridFluxVariablesCache::LocalView;
60 using GridFaceVariables =
typename GridVariables::GridFaceVariables;
61 using ElementFaceVariables =
typename GridFaceVariables::LocalView;
66 using Element =
typename GridView::template Codim<0>::Entity;
68 using SubControlVolume =
typename FVElementGeometry::SubControlVolume;
73 using CellCenterResidual = CellCenterPrimaryVariables;
75 static constexpr int turbulentKineticEnergyEqIdx = Indices::turbulentKineticEnergyEqIdx - ModelTraits::dim();
76 static constexpr int dissipationEqIdx = Indices::dissipationEqIdx - ModelTraits::dim();
79 using ParentType::ParentType;
82 static constexpr auto cellCenterOffset = ModelTraits::numEq() - CellCenterPrimaryVariables::dimension;
83 static_assert(cellCenterOffset == ModelTraits::dim(),
"cellCenterOffset must equal dim for staggered NavierStokes");
87 const SubControlVolume& scv,
88 const VolumeVariables& volVars)
const
90 CellCenterPrimaryVariables storage = ParentType::computeStorageForCellCenter(problem, scv, volVars);
92 storage[turbulentKineticEnergyEqIdx] = volVars.turbulentKineticEnergy() * volVars.density();
93 storage[dissipationEqIdx] = volVars.dissipation() * volVars.density();
99 const Element &element,
100 const FVElementGeometry& fvGeometry,
101 const ElementVolumeVariables& elemVolVars,
102 const ElementFaceVariables& elemFaceVars,
103 const SubControlVolume &scv)
const
105 CellCenterPrimaryVariables source = ParentType::computeSourceForCellCenter(problem, element, fvGeometry,
106 elemVolVars, elemFaceVars, scv);
108 const auto& volVars = elemVolVars[scv];
109 Scalar turbulentKineticEnergy = volVars.turbulentKineticEnergy();
110 Scalar dissipation = volVars.dissipation();
114 if (!volVars.isMatchingPoint())
116 source[turbulentKineticEnergyEqIdx] += 2.0 * volVars.dynamicEddyViscosity()
117 * volVars.stressTensorScalarProduct();
119 source[dissipationEqIdx] += volVars.cOneEpsilon()
120 * dissipation / turbulentKineticEnergy
121 * 2.0 * volVars.dynamicEddyViscosity()
122 * volVars.stressTensorScalarProduct();
126 if (!volVars.isMatchingPoint())
128 source[turbulentKineticEnergyEqIdx] -= dissipation * volVars.density();
130 source[dissipationEqIdx] -= volVars.cTwoEpsilon()
131 * dissipation * dissipation
132 / turbulentKineticEnergy * volVars.density();
The available discretization methods in Dumux.
DiscretizationMethod
The available discretization methods in Dumux.
Definition: method.hh:37
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition: propertysystem.hh:149
Calculates the element-wise residual for the staggered FV scheme.
Definition: staggeredlocalresidual.hh:41
Element-wise calculation of the residual for k-epsilon models using the staggered discretization.
Definition: freeflow/rans/twoeq/kepsilon/localresidual.hh:36
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:86
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:98
Declares all properties used in Dumux.