3.1-git
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:
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
127 {
129 }
130
134 Scalar dissipation() const
135 {
136 return dissipation_;
137 }
138
143 {
145 }
146
150 Scalar storedDissipation() const
151 {
152 return storedDissipation_;
153 }
154
159 {
161 }
162
167 {
169 }
170
175 {
177 }
178
180 const Scalar alpha() const
181 { return 0.52; }
182
184 const Scalar sigmaK() const
185 { return 0.6; }
186
188 const Scalar sigmaOmega() const
189 { return 0.5; }
190
192 const Scalar betaK() const
193 { return 0.09; }
194
196 const Scalar betaOmega() const
197 { return betaOmega_; }
198
199protected:
200 Scalar betaOmega_ = 0.0;
201 Scalar dissipation_ = 0.0;
203 Scalar storedDissipation_ = 0.0;
204 DimVector storedDissipationGradient_ = DimVector(0.0);
206 DimVector storedTurbulentKineticEnergyGradient_ = DimVector(0.0);
208};
209
210} // end namespace Dumux
211
212#endif
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
Property tag Indices
Definition: porousmediumflow/sequential/properties.hh:59
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:180
Scalar turbulentKineticEnergy_
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:202
Scalar stressTensorScalarProduct() const
Returns the scalar product of the stress tensor.
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:174
DimVector storedTurbulentKineticEnergyGradient_
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:206
const Scalar sigmaOmega() const
Returns the constant.
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:188
DimVector storedDissipationGradient_
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:204
Scalar dissipation_
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:201
Scalar dissipation() const
Returns an effective dissipation .
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:134
Scalar storedTurbulentKineticEnergy_
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:205
Scalar betaOmega_
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:200
const Scalar betaK() const
Returns the constant.
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:192
Scalar storedDissipation() const
Returns an effective dissipation .
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:150
Scalar stressTensorScalarProduct_
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:207
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:203
Scalar storedTurbulentKineticEnergy() const
Returns the turbulent kinetic energy .
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:142
DimVector storedDissipationGradient() const
Returns the gradient of the effective dissipation .
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:166
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:184
Scalar turbulentKineticEnergy() const
Returns the turbulent kinetic energy .
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:126
DimVector storedTurbulentKineticEnergyGradient() const
Returns the gradient of the turbulent kinetic energy .
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:158
const Scalar betaOmega() const
Returns the constant.
Definition: freeflow/rans/twoeq/komega/volumevariables.hh:196
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: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:65
Scalar setDynamicEddyViscosity_(Scalar value)
Sets the dynamic eddy viscosity .
Definition: freeflow/rans/volumevariables.hh:259
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:198
unsigned int elementIdx() const
Return the element Idx of the control volume.
Definition: freeflow/rans/volumevariables.hh:114
Declares all properties used in Dumux.