3.4
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
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 * See the file COPYING for full copying permissions. *
5 * *
6 * This program is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation, either version 3 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
18 *****************************************************************************/
25#ifndef DUMUX_KOMEGA_VOLUME_VARIABLES_HH
26#define DUMUX_KOMEGA_VOLUME_VARIABLES_HH
27
31
32namespace Dumux {
33
38template <class Traits, class NSVolumeVariables>
40: public RANSVolumeVariables<Traits, NSVolumeVariables>
41{
43
44 using Scalar = typename Traits::PrimaryVariables::value_type;
45 using DimVector = Dune::FieldVector<Scalar, Traits::ModelTraits::dim()>;
46
47public:
49 using Indices = typename Traits::ModelTraits::Indices;
50
59 template<class ElementSolution, class Problem, class Element, class SubControlVolume>
60 void update(const ElementSolution &elemSol,
61 const Problem &problem,
62 const Element &element,
63 const SubControlVolume& scv)
64 {
65 RANSParentType::updateNavierStokesVolVars(elemSol, problem, element, scv);
66 updateRANSProperties(elemSol, problem, element, scv);
67 }
68
79 template<class ElementSolution, class Problem, class Element, class SubControlVolume>
80 void updateRANSProperties(const ElementSolution &elemSol,
81 const Problem &problem,
82 const Element &element,
83 const SubControlVolume& scv)
84 {
85 RANSParentType::updateRANSProperties(elemSol, problem, element, scv);
86 betaOmega_ = problem.betaOmega();
87 turbulentKineticEnergy_ = elemSol[0][Indices::turbulentKineticEnergyIdx];
88 dissipation_ = elemSol[0][Indices::dissipationIdx];
89 storedDissipation_ = problem.storedDissipation(RANSParentType::elementIdx());
90 storedTurbulentKineticEnergy_ = problem.storedTurbulentKineticEnergy(RANSParentType::elementIdx());
91 storedDissipationGradient_ = problem.storedDissipationGradient(RANSParentType::elementIdx());
92 storedTurbulentKineticEnergyGradient_ = problem.storedTurbulentKineticEnergyGradient(RANSParentType::elementIdx());
93 stressTensorScalarProduct_ = problem.stressTensorScalarProduct(RANSParentType::elementIdx());
94 if (problem.useStoredEddyViscosity())
95 RANSParentType::setDynamicEddyViscosity_(problem.storedDynamicEddyViscosity(RANSParentType::elementIdx()));
96 else
100 }
101
105 template<class Problem>
106 Scalar calculateEddyViscosity(const Problem& problem)
107 {
108 using std::sqrt;
109 using std::max;
110
111 // use the Dissipation limiter proposed in wilcox2008
112 Scalar limitiedDissipation = std::numeric_limits<Scalar>::min();
113 static const auto enableKOmegaDissipationLimiter
114 = getParamFromGroup<bool>(problem.paramGroup(), "KOmega.EnableDissipationLimiter", true);
115 if (enableKOmegaDissipationLimiter)
116 {
117 limitiedDissipation = (7.0 / 8.0) * sqrt(2.0 * stressTensorScalarProduct() / betaK());
118 }
119 return turbulentKineticEnergy() / max(dissipation(), limitiedDissipation)
121 }
122
125 { return turbulentKineticEnergy_; }
126
128 Scalar dissipation() const
129 { return dissipation_; }
130
134
136 Scalar storedDissipation() const
137 { return storedDissipation_; }
138
142
146
150
152 const Scalar alpha() const
153 { return 0.52; }
154
156 const Scalar sigmaK() const
157 { return 0.6; }
158
160 const Scalar sigmaOmega() const
161 { return 0.5; }
162
164 const Scalar betaK() const
165 { return 0.09; }
166
168 const Scalar betaOmega() const
169 { return betaOmega_; }
170
171protected:
172 Scalar betaOmega_ = 0.0;
173 Scalar dissipation_ = 0.0;
175 Scalar storedDissipation_ = 0.0;
176 DimVector storedDissipationGradient_ = DimVector(0.0);
178 DimVector storedTurbulentKineticEnergyGradient_ = DimVector(0.0);
180};
181
182} // end namespace Dumux
183
184#endif
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
Definition: adapt.hh:29
std::string density(int phaseIdx) noexcept
I/O name of density for multiphase systems.
Definition: name.hh:65
Volume variables for the isothermal single-phase k-omega 2-Eq model.
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:41
const Scalar alpha() const
Returns the value.
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:152
Scalar turbulentKineticEnergy_
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:174
Scalar stressTensorScalarProduct() const
Returns the scalar product of the stress tensor.
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:148
DimVector storedTurbulentKineticEnergyGradient_
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:178
const Scalar sigmaOmega() const
Returns the constant.
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:160
DimVector storedDissipationGradient_
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:176
Scalar dissipation_
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:173
Scalar dissipation() const
Returns an effective dissipation .
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:128
Scalar storedTurbulentKineticEnergy_
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:177
Scalar betaOmega_
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:172
const Scalar betaK() const
Returns the constant.
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:164
Scalar storedDissipation() const
Returns an effective dissipation .
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:136
Scalar stressTensorScalarProduct_
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:179
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:80
Scalar storedDissipation_
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:175
Scalar storedTurbulentKineticEnergy() const
Returns the turbulent kinetic energy .
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:132
DimVector storedDissipationGradient() const
Returns the gradient of the effective dissipation .
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:144
typename Traits::ModelTraits::Indices Indices
export the indices type
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:49
const Scalar sigmaK() const
Returns the constant.
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:156
Scalar turbulentKineticEnergy() const
Returns the turbulent kinetic energy .
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:124
DimVector storedTurbulentKineticEnergyGradient() const
Returns the gradient of the turbulent kinetic energy .
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:140
const Scalar betaOmega() const
Returns the constant.
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:168
Scalar calculateEddyViscosity(const Problem &problem)
Returns the dynamic eddy viscosity .
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:106
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:60
Volume variables for the isothermal single-phase Reynolds-Averaged Navier-Stokes models.
Definition: freeflow/rans/volumevariables.hh:42
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:221
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:65
Scalar setDynamicEddyViscosity_(Scalar value)
Sets the dynamic eddy viscosity .
Definition: freeflow/rans/volumevariables.hh:266
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:85
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:210
unsigned int elementIdx() const
Return the element Idx of the control volume.
Definition: freeflow/rans/volumevariables.hh:120
Declares all properties used in Dumux.