24#ifndef DUMUX_STAGGERED_KOMEGA_LOCAL_RESIDUAL_HH
25#define DUMUX_STAGGERED_KOMEGA_LOCAL_RESIDUAL_HH
27#include <dune/common/hybridutilities.hh>
40template<
class TypeTag,
class BaseLocalRes
idual, DiscretizationMethod discMethod>
41class KOmegaResidualImpl;
43template<
class TypeTag,
class BaseLocalRes
idual>
45:
public BaseLocalResidual
47 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;
69 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()*volVars.density();
87 storage[dissipationEqIdx] = volVars.dissipation()*volVars.density();
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.dynamicEddyViscosity() * volVars.stressTensorScalarProduct();
109 if (enableKOmegaProductionLimiter)
111 Scalar productionAlternative = 20.0 * volVars.density() * 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.density() * volVars.turbulentKineticEnergy() * volVars.dissipation();
119 source[dissipationEqIdx] -= volVars.betaOmega() * volVars.density() * 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.density() / volVars.dissipation() * gradientProduct;
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
Element-wise calculation of the residual for k-omega models using the staggered discretization.
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.