version 3.10-dev
freeflow/rans/twoeq/komega/volumevariables.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3//
4// SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
13#ifndef DUMUX_KOMEGA_VOLUME_VARIABLES_HH
14#define DUMUX_KOMEGA_VOLUME_VARIABLES_HH
15
19
20namespace Dumux {
21
26template <class Traits, class NSVolumeVariables>
28: public RANSVolumeVariables<Traits, NSVolumeVariables>
29{
31
32 using Scalar = typename Traits::PrimaryVariables::value_type;
33 using DimVector = Dune::FieldVector<Scalar, Traits::ModelTraits::dim()>;
34
35public:
37 using Indices = typename Traits::ModelTraits::Indices;
38
47 template<class ElementSolution, class Problem, class Element, class SubControlVolume>
48 void update(const ElementSolution &elemSol,
49 const Problem &problem,
50 const Element &element,
51 const SubControlVolume& scv)
52 {
53 RANSParentType::updateNavierStokesVolVars(elemSol, problem, element, scv);
54 updateRANSProperties(elemSol, problem, element, scv);
55 }
56
67 template<class ElementSolution, class Problem, class Element, class SubControlVolume>
68 void updateRANSProperties(const ElementSolution &elemSol,
69 const Problem &problem,
70 const Element &element,
71 const SubControlVolume& scv)
72 {
73 RANSParentType::updateRANSProperties(elemSol, problem, element, scv);
74 betaOmega_ = problem.betaOmega();
75 turbulentKineticEnergy_ = elemSol[0][Indices::turbulentKineticEnergyIdx];
76 dissipation_ = elemSol[0][Indices::dissipationIdx];
77 storedDissipation_ = problem.storedDissipation(RANSParentType::elementIdx());
78 storedTurbulentKineticEnergy_ = problem.storedTurbulentKineticEnergy(RANSParentType::elementIdx());
79 storedDissipationGradient_ = problem.storedDissipationGradient(RANSParentType::elementIdx());
80 storedTurbulentKineticEnergyGradient_ = problem.storedTurbulentKineticEnergyGradient(RANSParentType::elementIdx());
81 stressTensorScalarProduct_ = problem.stressTensorScalarProduct(RANSParentType::elementIdx());
82 if (problem.useStoredEddyViscosity())
83 RANSParentType::setDynamicEddyViscosity_(problem.storedDynamicEddyViscosity(RANSParentType::elementIdx()));
84 else
88 }
89
93 template<class Problem>
94 Scalar calculateEddyViscosity(const Problem& problem)
95 {
96 using std::sqrt;
97 using std::max;
98
99 // use the Dissipation limiter proposed in wilcox2008
100 Scalar limitiedDissipation = std::numeric_limits<Scalar>::min();
101 static const auto enableKOmegaDissipationLimiter
102 = getParamFromGroup<bool>(problem.paramGroup(), "KOmega.EnableDissipationLimiter", true);
103 if (enableKOmegaDissipationLimiter)
104 {
105 limitiedDissipation = (7.0 / 8.0) * sqrt(2.0 * stressTensorScalarProduct() / betaK());
106 }
107 return turbulentKineticEnergy() / max(dissipation(), limitiedDissipation)
109 }
110
113 { return turbulentKineticEnergy_; }
114
116 Scalar dissipation() const
117 { return dissipation_; }
118
122
124 Scalar storedDissipation() const
125 { return storedDissipation_; }
126
130
134
138
140 const Scalar alpha() const
141 { return 0.52; }
142
144 const Scalar sigmaK() const
145 { return 0.6; }
146
148 const Scalar sigmaOmega() const
149 { return 0.5; }
150
152 const Scalar betaK() const
153 { return 0.09; }
154
156 const Scalar betaOmega() const
157 { return betaOmega_; }
158
159protected:
160 Scalar betaOmega_ = 0.0;
161 Scalar dissipation_ = 0.0;
163 Scalar storedDissipation_ = 0.0;
164 DimVector storedDissipationGradient_ = DimVector(0.0);
166 DimVector storedTurbulentKineticEnergyGradient_ = DimVector(0.0);
168};
169
170} // end namespace Dumux
171
172#endif
Volume variables for the isothermal single-phase k-omega 2-Eq model.
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:29
const Scalar alpha() const
Returns the value.
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:140
Scalar turbulentKineticEnergy_
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:162
Scalar stressTensorScalarProduct() const
Returns the scalar product of the stress tensor.
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:136
DimVector storedTurbulentKineticEnergyGradient_
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:166
const Scalar sigmaOmega() const
Returns the constant.
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:148
DimVector storedDissipationGradient_
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:164
Scalar dissipation_
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:161
Scalar dissipation() const
Returns an effective dissipation .
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:116
Scalar storedTurbulentKineticEnergy_
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:165
Scalar betaOmega_
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:160
const Scalar betaK() const
Returns the constant.
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:152
Scalar storedDissipation() const
Returns an effective dissipation .
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:124
Scalar stressTensorScalarProduct_
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:167
void updateRANSProperties(const ElementSolution &elemSol, const Problem &problem, const Element &element, const SubControlVolume &scv)
Update all turbulent quantities for a given control volume.
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:68
Scalar storedDissipation_
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:163
Scalar storedTurbulentKineticEnergy() const
Returns the turbulent kinetic energy .
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:120
DimVector storedDissipationGradient() const
Returns the gradient of the effective dissipation .
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:132
typename Traits::ModelTraits::Indices Indices
export the indices type
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:37
const Scalar sigmaK() const
Returns the constant.
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:144
Scalar turbulentKineticEnergy() const
Returns the turbulent kinetic energy .
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:112
DimVector storedTurbulentKineticEnergyGradient() const
Returns the gradient of the turbulent kinetic energy .
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:128
const Scalar betaOmega() const
Returns the constant.
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:156
Scalar calculateEddyViscosity(const Problem &problem)
Returns the dynamic eddy viscosity .
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:94
void update(const ElementSolution &elemSol, const Problem &problem, const Element &element, const SubControlVolume &scv)
Update all quantities for a given control volume.
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:48
Volume variables for the isothermal single-phase Reynolds-Averaged Navier-Stokes models.
Definition: freeflow/rans/volumevariables.hh:30
void calculateEddyThermalConductivity(const Problem &problem)
Calculates the eddy thermal conductivity based on the kinematic eddy viscosity and the turbulent Pra...
Definition: freeflow/rans/volumevariables.hh:209
void updateNavierStokesVolVars(const ElementSolution &elemSol, const Problem &problem, const Element &element, const SubControlVolume &scv)
Update all quantities for a given control volume.
Definition: freeflow/rans/volumevariables.hh:53
Scalar setDynamicEddyViscosity_(Scalar value)
Sets the dynamic eddy viscosity .
Definition: freeflow/rans/volumevariables.hh:254
void updateRANSProperties(const ElementSolution &elemSol, const Problem &problem, const Element &element, const SubControlVolume &scv)
Update all turbulent quantities for a given control volume.
Definition: freeflow/rans/volumevariables.hh:73
void calculateEddyDiffusivity(const Problem &problem)
Calculates the eddy diffusivity based on the kinematic eddy viscosity and the turbulent Schmidt numb...
Definition: freeflow/rans/volumevariables.hh:198
unsigned int elementIdx() const
Return the element Idx of the control volume.
Definition: freeflow/rans/volumevariables.hh:108
Defines all properties used in Dumux.
std::string density(int phaseIdx) noexcept
I/O name of density for multiphase systems.
Definition: name.hh:53
Definition: adapt.hh:17
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.