24#ifndef DUMUX_STAGGERED_KOMEGA_LOCAL_RESIDUAL_HH
25#define DUMUX_STAGGERED_KOMEGA_LOCAL_RESIDUAL_HH
27#include <dune/common/hybridutilities.hh>
35template<
class TypeTag,
class BaseLocalRes
idual, DiscretizationMethod discMethod>
36class KOmegaResidualImpl;
42template<
class TypeTag,
class BaseLocalRes
idual>
44:
public BaseLocalResidual
46 using ParentType = BaseLocalResidual;
50 using GridVolumeVariables =
typename GridVariables::GridVolumeVariables;
51 using ElementVolumeVariables =
typename GridVolumeVariables::LocalView;
52 using VolumeVariables =
typename GridVolumeVariables::VolumeVariables;
54 using GridFluxVariablesCache =
typename GridVariables::GridFluxVariablesCache;
55 using ElementFluxVariablesCache =
typename GridFluxVariablesCache::LocalView;
58 using GridFaceVariables =
typename GridVariables::GridFaceVariables;
59 using ElementFaceVariables =
typename GridFaceVariables::LocalView;
64 using Element =
typename GridView::template Codim<0>::Entity;
66 using SubControlVolume =
typename FVElementGeometry::SubControlVolume;
68 using CellCenterResidual = CellCenterPrimaryVariables;
73 static constexpr int turbulentKineticEnergyEqIdx = Indices::turbulentKineticEnergyEqIdx - ModelTraits::dim();
74 static constexpr int dissipationEqIdx = Indices::dissipationEqIdx - ModelTraits::dim();
77 using ParentType::ParentType;
81 const SubControlVolume& scv,
82 const VolumeVariables& volVars)
const
84 CellCenterPrimaryVariables storage = ParentType::computeStorageForCellCenter(problem, scv, volVars);
86 storage[turbulentKineticEnergyEqIdx] = volVars.turbulentKineticEnergy();
87 storage[dissipationEqIdx] = volVars.dissipation();
93 const Element &element,
94 const FVElementGeometry& fvGeometry,
95 const ElementVolumeVariables& elemVolVars,
96 const ElementFaceVariables& elemFaceVars,
97 const SubControlVolume &scv)
const
99 CellCenterPrimaryVariables source = ParentType::computeSourceForCellCenter(problem, element, fvGeometry,
100 elemVolVars, elemFaceVars, scv);
103 const auto& volVars = elemVolVars[scv];
106 static const auto enableKOmegaProductionLimiter
107 = getParamFromGroup<bool>(problem.paramGroup(),
"KOmega.EnableProductionLimiter",
false);
108 Scalar productionTerm = 2.0 * volVars.kinematicEddyViscosity() * volVars.stressTensorScalarProduct();
109 if (enableKOmegaProductionLimiter)
111 Scalar productionAlternative = 20.0 * volVars.betaK() * volVars.turbulentKineticEnergy() * volVars.dissipation();
112 productionTerm = min(productionTerm, productionAlternative);
114 source[turbulentKineticEnergyEqIdx] += productionTerm;
115 source[dissipationEqIdx] += volVars.alpha() * volVars.dissipation() / volVars.turbulentKineticEnergy() * productionTerm;
118 source[turbulentKineticEnergyEqIdx] -= volVars.betaK() * volVars.turbulentKineticEnergy() * volVars.dissipation();
119 source[dissipationEqIdx] -= volVars.betaOmega() * volVars.dissipation() * volVars.dissipation();
122 Scalar gradientProduct = 0.0;
123 for (
unsigned int i = 0; i < ModelTraits::dim(); ++i)
124 gradientProduct += volVars.storedTurbulentKineticEnergyGradient()[i]
125 * volVars.storedDissipationGradient()[i];
126 if (gradientProduct > 0.0)
127 source[dissipationEqIdx] += 0.125 / volVars.dissipation() * gradientProduct;
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
Definition: freeflow/rans/twoeq/komega/localresidual.hh:36
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/komega/staggered/localresidual.hh:92
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/komega/staggered/localresidual.hh:80
Declares all properties used in Dumux.