Documentation 6b54b78464
Loading...
Searching...
No Matches
CTurbVariable.hpp
Go to the documentation of this file.
1/*!
2 * \file CTurbVariable.hpp
3 * \brief Base class for defining the variables of the turbulence model.
4 * \author F. Palacios, T. Economon
5 * \version 8.5.0 "Harrier"
6 *
7 * SU2 Project Website: https://su2code.github.io
8 *
9 * The SU2 Project is maintained by the SU2 Foundation
10 * (http://su2foundation.org)
11 *
12 * Copyright 2012-2026, SU2 Contributors (cf. AUTHORS.md)
13 *
14 * SU2 is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Lesser General Public
16 * License as published by the Free Software Foundation; either
17 * version 2.1 of the License, or (at your option) any later version.
18 *
19 * SU2 is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Lesser General Public License for more details.
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with SU2. If not, see <http://www.gnu.org/licenses/>.
26 */
27
28#pragma once
29
30#include "CScalarVariable.hpp"
31
32/*!
33 * \class CTurbVariable
34 * \brief Base class for defining the variables of the turbulence model.
35 * \ingroup Turbulence_Model
36 * \author A. Bueno.
37 */
39protected:
40 VectorType muT; /*!< \brief Eddy viscosity. */
41
42public:
43 static constexpr size_t MAXNVAR = 4;
45 VectorType intermittency; /*!< \brief Value of the intermittency for the trans. model. */
46
47 /*!
48 * \brief Constructor of the class.
49 * \param[in] npoint - Number of points/nodes/vertices in the domain.
50 * \param[in] ndim - Number of dimensions of the problem.
51 * \param[in] nvar - Number of variables of the problem.
52 * \param[in] config - Definition of the particular problem.
53 */
54 CTurbVariable(unsigned long npoint, unsigned long ndim, unsigned long nvar, CConfig *config);
55
56 /*!
57 * \brief Destructor of the class.
58 */
59 ~CTurbVariable() override = default;
60
61 /*!
62 * \brief Get the value of the eddy viscosity.
63 * \param[in] iPoint - Point index.
64 * \return the value of the eddy viscosity.
65 */
66 inline su2double GetmuT(unsigned long iPoint) const final { return muT(iPoint); }
67
68 /*!
69 * \brief Set the value of the eddy viscosity.
70 * \param[in] iPoint - Point index.
71 * \param[in] val_muT - Value of the eddy viscosity.
72 */
73 inline void SetmuT(unsigned long iPoint, su2double val_muT) final { muT(iPoint) = val_muT; }
74
75 /*!
76 * \brief Set the value of the turbulence index.
77 * \param[in] iPoint - Point index.
78 * \param[in] val_turb_index - Value of the turbulence index.
79 */
80 inline void SetTurbIndex(unsigned long iPoint, su2double val_turb_index) final { turb_index(iPoint) = val_turb_index; }
81
82 /*!
83 * \brief Get the value of the turbulence index.
84 * \param[in] iPoint - Point index.
85 * \return Value of the intermittency of the turbulence index.
86 */
87 inline su2double GetTurbIndex(unsigned long iPoint) const final { return turb_index(iPoint); }
88
89 /*!
90 * \brief Get the intermittency of the transition model.
91 * \param[in] iPoint - Point index.
92 * \return Value of the intermittency of the transition model.
93 */
94 inline su2double GetIntermittency(unsigned long iPoint) const final { return intermittency(iPoint); }
95
96 /*!
97 * \brief Set the intermittency of the transition model.
98 * \param[in] iPoint - Point index.
99 * \param[in] val_intermittency - New value of the intermittency.
100 */
101 inline void SetIntermittency(unsigned long iPoint, su2double val_intermittency) final { intermittency(iPoint) = val_intermittency; }
102
103 /*!
104 * \brief Set the Diffusion Coefficients of TKE and omega equations.
105 * \param[in] iPoint - Point index.
106 * \param[in] val_DC_kw - diffusion coefficient value
107 */
108
109 /*!
110 * \brief Register eddy viscosity (muT) as Input or Output of an AD recording.
111 * \param[in] input - Boolean whether In- or Output should be registered.
112 */
113 void RegisterEddyViscosity(bool input);
114
115 /*!
116 * \brief A virtual member.
117 * \param[in] iPoint - Point index.
118 * \param[in] iDim - Dimension index.
119 */
120 inline virtual su2double GetLangevinSourceTermsOld(unsigned long iPoint, unsigned short iDim) const { return 0.0; }
121
122 /*!
123 * \brief A virtual member.
124 * \param[in] iPoint - Point index.
125 * \param[in] iDim - Dimension index.
126 * \param[in] val_stochSource_old - Old value of source term in Langevin equations.
127 */
128 inline virtual void SetLangevinSourceTermsOld(unsigned long iPoint, unsigned short iDim, su2double val_stochSource_old) {}
129
130 /*!
131 * \brief A virtual member.
132 * \param[in] iPoint - Point index.
133 */
134 inline virtual int8_t GetSbsInBox(unsigned long iPoint) const { return 0; }
135
136 /*!
137 * \brief A virtual member.
138 * \param[in] iPoint - Point index.
139 * \param[in] val_sbsInBox - 1.0 if the Stochastic Backscatter Model must be applied only in a confined box.
140 */
141 inline virtual void SetSbsInBox(unsigned long iPoint, int8_t val_sbsInBox) {}
142
143 /*!
144 * \brief Write the first blending function of the SST model, for a ghost row: SetBlendingFunc
145 * derives F1 from the wall distance and viscous state, neither of which a ghost point
146 * has, so its ghost row is written directly with the interior point's own F1 instead.
147 */
148 inline virtual void SetF1blending(unsigned long iPoint, su2double val) {}
149
150 /*!
151 * \brief Container backing GetF1blending/SetF1blending, for the edge-flux kernels to read
152 * through gatherVariables the way they do GetSolution and GetGradient, rather than one
153 * virtual call per point.
154 * \note Not an overload of the per-point CVariable::GetF1blending: brought back into scope so
155 * that name is not hidden here.
156 */
158 inline virtual const VectorType& GetF1blending() const { return EmptyVector; }
159};
Base class for defining the shared variables of scalar solvers.
Main class for defining the problem; basically this class reads the configuration file,...
Definition CConfig.hpp:64
Base class for defining the shared variables of scalar solvers.
Definition CScalarVariable.hpp:36
Base class for defining the variables of the turbulence model.
Definition CTurbVariable.hpp:38
~CTurbVariable() override=default
Destructor of the class.
void RegisterEddyViscosity(bool input)
Set the Diffusion Coefficients of TKE and omega equations.
Definition CTurbVariable.cpp:40
static constexpr size_t MAXNVAR
Definition CTurbVariable.hpp:43
virtual su2double GetLangevinSourceTermsOld(unsigned long iPoint, unsigned short iDim) const
A virtual member.
Definition CTurbVariable.hpp:120
virtual const VectorType & GetF1blending() const
Definition CTurbVariable.hpp:158
virtual int8_t GetSbsInBox(unsigned long iPoint) const
A virtual member.
Definition CTurbVariable.hpp:134
virtual void SetLangevinSourceTermsOld(unsigned long iPoint, unsigned short iDim, su2double val_stochSource_old)
A virtual member.
Definition CTurbVariable.hpp:128
VectorType muT
Eddy viscosity.
Definition CTurbVariable.hpp:40
VectorType turb_index
Definition CTurbVariable.hpp:44
su2double GetTurbIndex(unsigned long iPoint) const final
Get the value of the turbulence index.
Definition CTurbVariable.hpp:87
VectorType intermittency
Value of the intermittency for the trans. model.
Definition CTurbVariable.hpp:45
void SetTurbIndex(unsigned long iPoint, su2double val_turb_index) final
Set the value of the turbulence index.
Definition CTurbVariable.hpp:80
void SetmuT(unsigned long iPoint, su2double val_muT) final
Set the value of the eddy viscosity.
Definition CTurbVariable.hpp:73
virtual void SetF1blending(unsigned long iPoint, su2double val)
Write the first blending function of the SST model, for a ghost row: SetBlendingFunc derives F1 from ...
Definition CTurbVariable.hpp:148
void SetIntermittency(unsigned long iPoint, su2double val_intermittency) final
Set the intermittency of the transition model.
Definition CTurbVariable.hpp:101
virtual void SetSbsInBox(unsigned long iPoint, int8_t val_sbsInBox)
A virtual member.
Definition CTurbVariable.hpp:141
su2double GetIntermittency(unsigned long iPoint) const final
Get the intermittency of the transition model.
Definition CTurbVariable.hpp:94
su2double GetmuT(unsigned long iPoint) const final
Get the value of the eddy viscosity.
Definition CTurbVariable.hpp:66
virtual su2double GetF1blending(unsigned long iPoint) const
Get the first blending function of the SST model.
Definition CVariable.hpp:1716
static const VectorType EmptyVector
Definition CVariable.hpp:116
passivedouble su2double
Definition code_config.hpp:181