version 3.8
freeflow/rans/twoeq/kepsilon/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//
12#ifndef DUMUX_KEPSILON_VOLUME_VARIABLES_HH
13#define DUMUX_KEPSILON_VOLUME_VARIABLES_HH
14
17
18namespace Dumux {
19
24template <class Traits, class NSVolumeVariables>
26: public RANSVolumeVariables<Traits, NSVolumeVariables>
27{
29
30 using Scalar = typename Traits::PrimaryVariables::value_type;
31
32public:
34 using Indices = typename Traits::ModelTraits::Indices;
35
45 template<class ElementSolution, class Problem, class Element, class SubControlVolume>
46 void update(const ElementSolution &elemSol,
47 const Problem &problem,
48 const Element &element,
49 const SubControlVolume& scv)
50 {
51 RANSParentType::updateNavierStokesVolVars(elemSol, problem, element, scv);
52 updateRANSProperties(elemSol, problem, element, scv);
53 }
54
65 template<class ElementSolution, class Problem, class Element, class SubControlVolume>
66 void updateRANSProperties(const ElementSolution &elemSol,
67 const Problem &problem,
68 const Element &element,
69 const SubControlVolume& scv)
70 {
71 RANSParentType::updateRANSProperties(elemSol, problem, element, scv);
72 isMatchingPoint_ = problem.isMatchingPoint(RANSParentType::elementIdx());
73 inNearWallRegion_ = problem.inNearWallRegion(RANSParentType::elementIdx());
74 turbulentKineticEnergy_ = elemSol[0][Indices::turbulentKineticEnergyIdx];
75 dissipation_ = elemSol[0][Indices::dissipationIdx];
76 storedDissipation_ = problem.storedDissipation(RANSParentType::elementIdx());
77 storedTurbulentKineticEnergy_ = problem.storedTurbulentKineticEnergy(RANSParentType::elementIdx());
78 stressTensorScalarProduct_ = problem.stressTensorScalarProduct(RANSParentType::elementIdx());
79 const Scalar uStarNominal = problem.uStarNominal(RANSParentType::elementIdx());
80 const auto flowDirectionAxis = problem.flowDirectionAxis(RANSParentType::elementIdx());
81 yPlusNominal_ = RANSParentType::wallDistance() * uStarNominal / problem.kinematicViscosity(RANSParentType::elementIdx());
82 uPlusNominal_ = RANSParentType::ccVelocityVector()[flowDirectionAxis] / uStarNominal;
83 cMu_ = problem.cMu();
84 if (problem.useStoredEddyViscosity())
85 RANSParentType::setDynamicEddyViscosity_(problem.storedDynamicEddyViscosity(RANSParentType::elementIdx()));
86 else
89 {
90 RANSParentType::setDynamicEddyViscosity_(problem.zeroEqDynamicEddyViscosity(RANSParentType::elementIdx()));
91 }
94 }
95
100 {
103 }
104
109 { return turbulentKineticEnergy_; }
110
114 Scalar dissipation() const
115 { return dissipation_; }
116
122
126 Scalar storedDissipation() const
127 { return storedDissipation_; }
128
134
135 /*
136 * \brief Returns if an element is located in the near-wall region
137 */
138 bool inNearWallRegion() const
139 { return inNearWallRegion_; }
140
144 bool isMatchingPoint() const
145 { return isMatchingPoint_; }
146
148 const Scalar cMu() const
149 { return cMu_; }
150
152 const Scalar sigmaK() const
153 { return 1.0; }
154
156 const Scalar sigmaEpsilon() const
157 { return 1.3; }
158
160 const Scalar cOneEpsilon() const
161 { return 1.44; }
162
164 const Scalar cTwoEpsilon() const
165 { return 1.92; }
166
168 Scalar yPlusNominal() const
169 { return yPlusNominal_; }
170
172 Scalar uPlusNominal() const
173 { return uPlusNominal_; }
174
175protected:
177 Scalar dissipation_ = 0.0;
179 Scalar storedDissipation_ = 0.0;
181 Scalar yPlusNominal_ = 0.0;
182 Scalar uPlusNominal_ = 0.0;
183 Scalar cMu_ = 0.0;
184 bool inNearWallRegion_ = false;
185 bool isMatchingPoint_ = false;
186};
187
188} // end namespace Dumux
189
190#endif
Volume variables for the isothermal single-phase k-epsilon model.
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:27
Scalar stressTensorScalarProduct() const
Returns the scalar product of the stress tensor.
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:132
bool inNearWallRegion_
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:184
bool isMatchingPoint() const
Returns if an element is the matching point.
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:144
typename Traits::ModelTraits::Indices Indices
export the indices type
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:34
const Scalar sigmaK() const
Returns the constant.
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:152
bool isMatchingPoint_
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:185
Scalar storedDissipation() const
Returns an effective dissipation .
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:126
Scalar storedTurbulentKineticEnergy_
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:178
Scalar turbulentKineticEnergy_
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:176
Scalar storedTurbulentKineticEnergy() const
Returns the turbulent kinetic energy .
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:120
bool inNearWallRegion() const
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:138
const Scalar sigmaEpsilon() const
Returns the constant.
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:156
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/kepsilon/volumevariables.hh:66
Scalar storedDissipation_
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:179
Scalar uPlusNominal_
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:182
Scalar uPlusNominal() const
Return the nominal dimensionless velocity .
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:172
Scalar stressTensorScalarProduct_
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:180
Scalar yPlusNominal_
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:181
const Scalar cOneEpsilon() const
Returns the constant.
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:160
const Scalar cTwoEpsilon() const
Returns the constant.
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:164
Scalar yPlusNominal() const
Returns the nominal dimensionless wall distance .
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:168
Scalar cMu_
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:183
const Scalar cMu() const
Returns the constant.
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:148
Scalar turbulentKineticEnergy() const
Returns the turbulent kinetic energy .
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:108
Scalar dissipation() const
Returns an effective dissipation .
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:114
Scalar calculateEddyViscosity()
Returns the dynamic eddy viscosity .
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:99
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/kepsilon/volumevariables.hh:46
Scalar dissipation_
Definition: freeflow/rans/twoeq/kepsilon/volumevariables.hh:177
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
Scalar wallDistance() const
Return the wall distance of the control volume.
Definition: freeflow/rans/volumevariables.hh:138
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
DimVector ccVelocityVector() const
Return the velocity vector at the control volume center.
Definition: freeflow/rans/volumevariables.hh:114
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
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.