Documentation 6b54b78464
Loading...
Searching...
No Matches
CNSVariable.hpp
Go to the documentation of this file.
1/*!
2 * \file CNSVariable.hpp
3 * \brief Class for defining the variables of the compressible Navier-Stokes solver.
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 "CEulerVariable.hpp"
31
32/*!
33 * \class CNSVariable
34 * \brief Class for defining the variables of the compressible Navier-Stokes solver.
35 * \ingroup Navier_Stokes_Equations
36 * \author F. Palacios, T. Economon
37 */
38class CNSVariable final : public CEulerVariable {
39private:
40 su2double inv_TimeScale; /*!< \brief Inverse of the reference time scale. */
41
42 VectorType Tau_Wall; /*!< \brief Magnitude of the wall shear stress from a wall function. */
43 VectorType DES_LengthScale; /*!< \brief DES Length Scale. */
44 VectorType lesMode; /*!< \brief Sensor for local simulation mode (0=RANS, 1=LES).*/
45 VectorType Roe_Dissipation; /*!< \brief Roe low dissipation coefficient. */
46 VectorType Vortex_Tilting; /*!< \brief Value of the vortex tilting variable for DES length scale computation. */
47
48public:
49 /*!
50 * \brief Constructor of the class.
51 * \param[in] density - Value of the flow density (initialization value).
52 * \param[in] velocity - Value of the flow velocity (initialization value).
53 * \param[in] energy - Value of the flow energy (initialization value).
54 * \param[in] npoint - Number of points/nodes/vertices in the domain.
55 * \param[in] ndim - Number of dimensions of the problem.
56 * \param[in] nvar - Number of variables of the problem.
57 * \param[in] config - Definition of the particular problem.
58 */
59 CNSVariable(su2double density, const su2double *velocity, su2double energy,
60 unsigned long npoint, unsigned long ndim, unsigned long nvar, const CConfig *config);
61
62 /*!
63 * \brief Set the laminar viscosity.
64 */
65 inline void SetLaminarViscosity(unsigned long iPoint, su2double laminarViscosity) override {
66 Primitive(iPoint, indices.LaminarViscosity()) = laminarViscosity;
67 }
68
69 /*!
70 * \brief Set the laminar viscosity.
71 */
72 inline void SetThermalConductivity(unsigned long iPoint, su2double thermalConductivity) override {
73 Primitive(iPoint, indices.ThermalConductivity()) = thermalConductivity;
74 }
75
76 /*!
77 * \brief Set the specific heat Cp.
78 */
79 inline void SetSpecificHeatCp(unsigned long iPoint, su2double val_Cp) override {
80 Primitive(iPoint, indices.CpTotal()) = val_Cp;
81 }
82
83 /*!
84 * \overload
85 * \param[in] eddy_visc - Value of the eddy viscosity.
86 */
87 inline void SetEddyViscosity(unsigned long iPoint, su2double eddy_visc) override {
88 Primitive(iPoint, indices.EddyViscosity()) = eddy_visc;
89 }
90
91 /*!
92 * \brief Get the laminar viscosity of the flow.
93 * \return Value of the laminar viscosity of the flow.
94 */
95 inline su2double GetLaminarViscosity(unsigned long iPoint) const override {
96 return Primitive(iPoint, indices.LaminarViscosity());
97 }
98
99 /*!
100 * \brief Get the thermal conductivity of the flow.
101 * \return Value of the laminar viscosity of the flow.
102 */
103 inline su2double GetThermalConductivity(unsigned long iPoint) const override {
104 return Primitive(iPoint, indices.ThermalConductivity());
105 }
106
107 /*!
108 * \brief Get the eddy viscosity of the flow.
109 * \return The eddy viscosity of the flow.
110 */
111 inline su2double GetEddyViscosity(unsigned long iPoint) const override {
112 return Primitive(iPoint, indices.EddyViscosity());
113 }
114
115 /*!
116 * \brief Get the specific heat at constant P of the flow.
117 * \return Value of the specific heat at constant P of the flow.
118 */
119 inline su2double GetSpecificHeatCp(unsigned long iPoint) const override {
120 return Primitive(iPoint, indices.CpTotal());
121 }
122
123 /*!
124 * \brief Set the derivative of temperature with respect to density (at constant internal energy).
125 */
126 inline void SetdTdrho_e(unsigned long iPoint, su2double dTdrho_e) override { Secondary(iPoint,2) = dTdrho_e;}
127
128 /*!
129 * \brief Set the derivative of temperature with respect to internal energy (at constant density).
130 */
131 inline void SetdTde_rho(unsigned long iPoint, su2double dTde_rho) override { Secondary(iPoint,3) = dTde_rho;}
132
133 /*!
134 * \brief Set the derivative of laminar viscosity with respect to density (at constant temperature).
135 */
136 inline void Setdmudrho_T(unsigned long iPoint, su2double dmudrho_T) override { Secondary(iPoint,4) = dmudrho_T;}
137
138 /*!
139 * \brief Set the derivative of laminar viscosity with respect to temperature (at constant density).
140 */
141 inline void SetdmudT_rho(unsigned long iPoint, su2double dmudT_rho) override { Secondary(iPoint,5) = dmudT_rho;}
142
143 /*!
144 * \brief Set the derivative of thermal conductivity with respect to density (at constant temperature).
145 */
146 inline void Setdktdrho_T(unsigned long iPoint, su2double dktdrho_T) override { Secondary(iPoint,6) = dktdrho_T;}
147
148 /*!
149 * \brief Set the derivative of thermal conductivity with respect to temperature (at constant density).
150 */
151 inline void SetdktdT_rho(unsigned long iPoint, su2double dktdT_rho) override { Secondary(iPoint,7) = dktdT_rho;}
152
153 /*!
154 * \brief Set all the primitive variables for compressible flows
155 */
156 bool SetPrimVar(unsigned long iPoint, su2double eddy_visc, su2double turb_ke, CFluidModel *FluidModel) override;
158
159 /*!
160 * \brief Set all the secondary variables (partial derivatives) for compressible flows
161 */
162 void SetSecondaryVar(unsigned long iPoint, CFluidModel *FluidModel) override;
163
164 /*!
165 * \brief Set the value of the wall shear stress computed by a wall function.
166 */
167 inline void SetTau_Wall(unsigned long iPoint, su2double tau_wall) override { Tau_Wall(iPoint) = tau_wall; }
168
169 /*!
170 * \brief Get the value of the wall shear stress computed by a wall function.
171 * \return Value of the wall shear stress computed by a wall function.
172 */
173 inline su2double GetTau_Wall(unsigned long iPoint) const override { return Tau_Wall(iPoint); }
174 inline const VectorType& GetTau_Wall() const { return Tau_Wall; }
175
176 /*!
177 * \brief Get the DES length scale
178 * \return Value of the DES length Scale.
179 */
180 inline su2double GetDES_LengthScale(unsigned long iPoint) const override { return DES_LengthScale(iPoint); }
181
182 /*!
183 * \brief Set the DES Length Scale.
184 */
185 inline void SetDES_LengthScale(unsigned long iPoint, su2double val_des_lengthscale) override {
186 DES_LengthScale(iPoint) = val_des_lengthscale;
187 }
188
189/*!
190 * \brief Set the LES sensor.
191 */
192 inline void SetLES_Mode(unsigned long iPoint, su2double val_les_mode) override {
193 lesMode(iPoint) = val_les_mode;
194 }
195
196 /*!
197 * \brief Get the LES sensor.
198 * \return Value of the LES sensor.
199 */
200 inline su2double GetLES_Mode(unsigned long iPoint) const override { return lesMode(iPoint); }
201
202 /*!
203 * \brief Set the new solution for Roe Dissipation.
204 * \param[in] val_delta - A scalar measure of the grid size
205 * \param[in] val_const_DES - The DES constant (C_DES)
206 */
207 void SetRoe_Dissipation_NTS(unsigned long iPoint, su2double val_delta, su2double val_const_DES) override;
208
209 /*!
210 * \brief Set the new solution for Roe Dissipation.
211 */
212 void SetRoe_Dissipation_FD(unsigned long iPoint, su2double wall_distance) override;
213
214 /*!
215 * \brief Get the Roe Dissipation Coefficient.
216 * \return Value of the Roe Dissipation.
217 */
218 inline su2double GetRoe_Dissipation(unsigned long iPoint) const override { return Roe_Dissipation(iPoint); }
219 inline const VectorType& GetRoe_Dissipation() const { return Roe_Dissipation; }
220
221 /*!
222 * \brief Set the Roe Dissipation Coefficient.
223 * \param[in] val_dissipation - Value of the Roe dissipation factor.
224 */
225 inline void SetRoe_Dissipation(unsigned long iPoint, su2double val_dissipation) override {
226 Roe_Dissipation(iPoint) = val_dissipation;
227 }
228
229};
Class for defining the variables of the compressible Euler solver.
Main class for defining the problem; basically this class reads the configuration file,...
Definition CConfig.hpp:64
Class for defining the variables of the compressible Euler solver.
Definition CEulerVariable.hpp:46
const CIndices< unsigned long > indices
Secondary variables (dPdrho_e, dPde_rho, dTdrho_e, dTde_rho, dmudrho_T, dmudT_rho,...
Definition CEulerVariable.hpp:73
MatrixType Secondary
Definition CEulerVariable.hpp:77
MatrixType Primitive
Primitive variables.
Definition CFlowVariable.hpp:41
Main class for defining the Thermo-Physical Model.
Definition CFluidModel.hpp:47
Class for defining the variables of the compressible Navier-Stokes solver.
Definition CNSVariable.hpp:38
void Setdmudrho_T(unsigned long iPoint, su2double dmudrho_T) override
Set the derivative of laminar viscosity with respect to density (at constant temperature).
Definition CNSVariable.hpp:136
bool SetPrimVar(unsigned long iPoint, su2double eddy_visc, su2double turb_ke, CFluidModel *FluidModel) override
Set all the primitive variables for compressible flows.
Definition CNSVariable.cpp:139
void SetEddyViscosity(unsigned long iPoint, su2double eddy_visc) override
Definition CNSVariable.hpp:87
const VectorType & GetRoe_Dissipation() const
Definition CNSVariable.hpp:219
void Setdktdrho_T(unsigned long iPoint, su2double dktdrho_T) override
Set the derivative of thermal conductivity with respect to density (at constant temperature).
Definition CNSVariable.hpp:146
su2double GetEddyViscosity(unsigned long iPoint) const override
Get the eddy viscosity of the flow.
Definition CNSVariable.hpp:111
su2double GetLES_Mode(unsigned long iPoint) const override
Get the LES sensor.
Definition CNSVariable.hpp:200
void SetLaminarViscosity(unsigned long iPoint, su2double laminarViscosity) override
Set the laminar viscosity.
Definition CNSVariable.hpp:65
su2double GetLaminarViscosity(unsigned long iPoint) const override
Get the laminar viscosity of the flow.
Definition CNSVariable.hpp:95
void SetdktdT_rho(unsigned long iPoint, su2double dktdT_rho) override
Set the derivative of thermal conductivity with respect to temperature (at constant density).
Definition CNSVariable.hpp:151
void SetSecondaryVar(unsigned long iPoint, CFluidModel *FluidModel) override
Set all the secondary variables (partial derivatives) for compressible flows.
Definition CNSVariable.cpp:213
su2double GetSpecificHeatCp(unsigned long iPoint) const override
Get the specific heat at constant P of the flow.
Definition CNSVariable.hpp:119
su2double GetRoe_Dissipation(unsigned long iPoint) const override
Get the Roe Dissipation Coefficient.
Definition CNSVariable.hpp:218
void SetdTdrho_e(unsigned long iPoint, su2double dTdrho_e) override
Set the derivative of temperature with respect to density (at constant internal energy).
Definition CNSVariable.hpp:126
void SetRoe_Dissipation_FD(unsigned long iPoint, su2double wall_distance) override
Set the new solution for Roe Dissipation.
Definition CNSVariable.cpp:105
void SetdTde_rho(unsigned long iPoint, su2double dTde_rho) override
Set the derivative of temperature with respect to internal energy (at constant density).
Definition CNSVariable.hpp:131
void SetTau_Wall(unsigned long iPoint, su2double tau_wall) override
Set the value of the wall shear stress computed by a wall function.
Definition CNSVariable.hpp:167
su2double GetTau_Wall(unsigned long iPoint) const override
Get the value of the wall shear stress computed by a wall function.
Definition CNSVariable.hpp:173
void SetSpecificHeatCp(unsigned long iPoint, su2double val_Cp) override
Set the specific heat Cp.
Definition CNSVariable.hpp:79
void SetdmudT_rho(unsigned long iPoint, su2double dmudT_rho) override
Set the derivative of laminar viscosity with respect to temperature (at constant density).
Definition CNSVariable.hpp:141
su2double GetThermalConductivity(unsigned long iPoint) const override
Get the thermal conductivity of the flow.
Definition CNSVariable.hpp:103
const VectorType & GetTau_Wall() const
Definition CNSVariable.hpp:174
void SetThermalConductivity(unsigned long iPoint, su2double thermalConductivity) override
Set the laminar viscosity.
Definition CNSVariable.hpp:72
void SetRoe_Dissipation(unsigned long iPoint, su2double val_dissipation) override
Set the Roe Dissipation Coefficient.
Definition CNSVariable.hpp:225
void SetDES_LengthScale(unsigned long iPoint, su2double val_des_lengthscale) override
Set the DES Length Scale.
Definition CNSVariable.hpp:185
su2double GetDES_LengthScale(unsigned long iPoint) const override
Get the DES length scale.
Definition CNSVariable.hpp:180
void SetLES_Mode(unsigned long iPoint, su2double val_les_mode) override
Set the LES sensor.
Definition CNSVariable.hpp:192
void SetRoe_Dissipation_NTS(unsigned long iPoint, su2double val_delta, su2double val_const_DES) override
Set the new solution for Roe Dissipation.
Definition CNSVariable.cpp:49
virtual bool SetPrimVar(unsigned long iPoint, CConfig *config)
A virtual member.
Definition CVariable.hpp:1269
passivedouble su2double
Definition code_config.hpp:181
IndexType LaminarViscosity() const
Definition CEulerVariable.hpp:62
IndexType CpTotal() const
Definition CEulerVariable.hpp:65
IndexType EddyViscosity() const
Definition CEulerVariable.hpp:63
IndexType ThermalConductivity() const
Definition CEulerVariable.hpp:64