24#ifndef DUMUX_STAGGERED_KEPSILON_LOCAL_RESIDUAL_HH
25#define DUMUX_STAGGERED_KEPSILON_LOCAL_RESIDUAL_HH
27#include <dune/common/hybridutilities.hh>
35template<
class TypeTag,
class BaseLocalRes
idual, DiscretizationMethod discMethod>
42template<
class TypeTag,
class BaseLocalRes
idual>
44:
public BaseLocalResidual
46 using ParentType = BaseLocalResidual;
51 using GridVolumeVariables =
typename GridVariables::GridVolumeVariables;
52 using ElementVolumeVariables =
typename GridVolumeVariables::LocalView;
53 using VolumeVariables =
typename GridVolumeVariables::VolumeVariables;
55 using GridFluxVariablesCache =
typename GridVariables::GridFluxVariablesCache;
56 using ElementFluxVariablesCache =
typename GridFluxVariablesCache::LocalView;
59 using GridFaceVariables =
typename GridVariables::GridFaceVariables;
60 using ElementFaceVariables =
typename GridFaceVariables::LocalView;
65 using Element =
typename GridView::template Codim<0>::Entity;
67 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();
93 storage[dissipationEqIdx] = volVars.dissipation();
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.kinematicEddyViscosity()
117 * volVars.stressTensorScalarProduct();
119 source[dissipationEqIdx] += volVars.cOneEpsilon()
120 * dissipation / turbulentKineticEnergy
121 * 2.0 * volVars.kinematicEddyViscosity()
122 * volVars.stressTensorScalarProduct();
126 if (!volVars.isMatchingPoint())
128 source[turbulentKineticEnergyEqIdx] -= dissipation;
130 source[dissipationEqIdx] -= volVars.cTwoEpsilon()
131 * dissipation * dissipation
132 / turbulentKineticEnergy;
The available discretization methods in Dumux.
DiscretizationMethod
The available discretization methods in Dumux.
Definition: method.hh:37
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
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:40
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.