Documentation 6b54b78464
Loading...
Searching...
No Matches
CNSSolver.hpp
Go to the documentation of this file.
1/*!
2 * \file CNSSolver.hpp
3 * \brief Headers of the CNSSolver class
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 "CEulerSolver.hpp"
31
32/*!
33 * \class CNSSolver
34 * \brief Main class for defining the Navier-Stokes flow solver.
35 * \ingroup Navier_Stokes_Equations
36 * \author F. Palacios
37 */
38class CNSSolver final : public CEulerSolver {
39private:
40
41 vector<su2double> Surface_Buffet_Metric; /*!< \brief Integrated separation sensor for each monitoring surface. */
42 vector<su2double> Buffet_Metric; /*!< \brief Integrated separation sensor for each boundary. */
43 vector<vector<su2double> > Buffet_Sensor; /*!< \brief Separation sensor for each boundary and vertex. */
44 su2double Total_Buffet_Metric = 0.0; /*!< \brief Integrated separation sensor for all the boundaries. */
45
46 /*!
47 * \brief A virtual member.
48 * \param[in] geometry - Geometrical definition.
49 * \param[in] config - Definition of the particular problem.
50 */
51 void SetRoe_Dissipation(CGeometry *geometry, CConfig *config) override;
52
53 /*!
54 * \brief Compute the velocity^2, SoundSpeed, Pressure, Enthalpy, Viscosity.
55 * \param[in] solver_container - Container vector with all the solutions.
56 * \param[in] config - Definition of the particular problem.
57 * \return - The number of non-physical points.
58 */
59 unsigned long SetPrimitive_Variables(CSolver **solver_container,
60 const CConfig *config) override;
61
62 /*!
63 * \brief Common code for wall boundaries, add the residual and Jacobian
64 * contributions due to grid motion associated with a particular boundary point.
65 */
66 void AddDynamicGridResidualContribution(unsigned long iPoint,
67 unsigned long Point_Normal,
68 const CGeometry* geometry,
69 const su2double* UnitNormal,
70 su2double Area,
71 const su2double* GridVel,
74 su2double& Res_Visc) const;
75
76 /*!
77 * \brief Get the wall temperature at a given vertex of a given marker for CHT problems.
78 */
79 su2double GetCHTWallTemperature(const CConfig* config,
80 unsigned short val_marker,
81 unsigned long iVertex,
82 su2double thermal_conductivity,
83 su2double dist_ij,
84 su2double There,
85 su2double Temperature_Ref) const;
86
87 /*!
88 * \brief Generic implementation of the isothermal wall also covering CHT cases,
89 * for which the wall temperature is given by GetCHTWallTemperature.
90 */
91 void BC_Isothermal_Wall_Generic(CGeometry *geometry,
92 CSolver **solver_container,
93 CNumerics *conv_numerics,
94 CNumerics *visc_numerics,
95 CConfig *config,
96 unsigned short val_marker,
97 bool cht_mode = false);
98
99 /*!
100 * \brief Generic implementation of the heatflux and heat-transfer/convection walls.
101 */
102 void BC_HeatFlux_Wall_Generic(const CGeometry *geometry,
103 const CConfig *config,
104 unsigned short val_marker,
105 unsigned short kind_boundary);
106
107 /*!
108 * \brief Compute the viscous contribution for a particular edge.
109 * \param[in] iEdge - Edge for which the flux and Jacobians are to be computed.
110 * \param[in] geometry - Geometrical definition of the problem.
111 * \param[in] solver_container - Container vector with all the solutions.
112 * \param[in] numerics - Description of the numerical method.
113 * \param[in] config - Definition of the particular problem.
114 * \return The viscous Jacobians, to be applied by the caller together with the convective part.
115 */
116 CNumerics::ResidualType<> Viscous_Residual(unsigned long iEdge, CGeometry *geometry, CSolver **solver_container,
117 CNumerics *numerics, CConfig *config) override;
118
119 /*!
120 * \brief Computes the wall shear stress (Tau_Wall) on the surface using a wall function.
121 * \param[in] geometry - Geometrical definition of the problem.
122 * \param[in] solver_container - Container vector with all the solutions.
123 * \param[in] config - Definition of the particular problem.
124 */
125 void SetTau_Wall_WF(CGeometry *geometry, CSolver** solver_container, const CConfig* config);
126
127public:
128 /*!
129 * \brief Constructor of the class.
130 */
131 CNSSolver() = default;
132
133 /*!
134 * \overload
135 * \param[in] geometry - Geometrical definition of the problem.
136 * \param[in] config - Definition of the particular problem.
137 */
138 CNSSolver(CGeometry *geometry, CConfig *config, unsigned short iMesh);
139
140 /*!
141 * \brief Destructor of the class.
142 */
143 ~CNSSolver() = default;
144
145 /*!
146 * \brief Provide the buffet metric.
147 * \param[in] val_marker - Surface marker where the coefficient is computed.
148 * \return Value of the buffet metric on the surface <i>val_marker</i>.
149 */
150 inline su2double GetSurface_Buffet_Metric(unsigned short val_marker) const override { return Surface_Buffet_Metric[val_marker]; }
151
152 /*!
153 * \brief Get the buffet metric.
154 * \return Value of the buffet metric.
155 */
156 inline su2double GetTotal_Buffet_Metric() const override { return Total_Buffet_Metric; }
157
158 /*!
159 * \brief Restart residual and compute gradients.
160 * \param[in] geometry - Geometrical definition of the problem.
161 * \param[in] solver_container - Container vector with all the solutions.
162 * \param[in] config - Definition of the particular problem.
163 * \param[in] iRKStep - Current step of the Runge-Kutta iteration.
164 * \param[in] RunTime_EqSystem - System of equations which is going to be solved.
165 * \param[in] Output - boolean to determine whether to print output.
166 */
167 void Preprocessing(CGeometry *geometry,
168 CSolver **solver_container,
169 CConfig *config,
170 unsigned short iMesh,
171 unsigned short iRKStep,
172 unsigned short RunTime_EqSystem,
173 bool Output) override;
174
175 /*!
176 * \brief Compute weighted-sum "combo" objective output
177 * \param[in] config - Definition of the particular problem.
178 * \param[in] solver - Container vector with all the solutions.
179 */
180 void Evaluate_ObjFunc(const CConfig *config, CSolver **solver) override;
181
182 /*!
183 * \brief Impose a constant heat-flux condition at the wall.
184 * \param[in] geometry - Geometrical definition of the problem.
185 * \param[in] solver_container - Container vector with all the solutions.
186 * \param[in] conv_numerics - Description of the numerical method.
187 * \param[in] visc_numerics - Description of the numerical method.
188 * \param[in] config - Definition of the particular problem.
189 * \param[in] val_marker - Surface marker where the boundary condition is applied.
190 */
191 void BC_HeatFlux_Wall(CGeometry *geometry,
192 CSolver **solver_container,
193 CNumerics *conv_numerics,
194 CNumerics *visc_numerics,
195 CConfig *config,
196 unsigned short val_marker) override;
197
198 /*!
199 * \brief Impose a heat flux by prescribing a heat transfer coefficient and a temperature at infinity.
200 * \param[in] geometry - Geometrical definition of the problem.
201 * \param[in] config - Definition of the particular problem.
202 * \param[in] val_marker - Surface marker where the boundary condition is applied.
203 */
204 void BC_HeatTransfer_Wall(const CGeometry *geometry,
205 const CConfig *config,
206 const unsigned short val_marker) override;
207
208 /*!
209 * \brief Impose the Navier-Stokes boundary condition (strong).
210 * \param[in] geometry - Geometrical definition of the problem.
211 * \param[in] solver_container - Container vector with all the solutions.
212 * \param[in] conv_numerics - Description of the numerical method.
213 * \param[in] visc_numerics - Description of the numerical method.
214 * \param[in] config - Definition of the particular problem.
215 * \param[in] val_marker - Surface marker where the boundary condition is applied.
216 */
217 void BC_Isothermal_Wall(CGeometry *geometry,
218 CSolver **solver_container,
219 CNumerics *conv_numerics,
220 CNumerics *visc_numerics,
221 CConfig *config,
222 unsigned short val_marker) override;
223
224 /*!
225 * \brief Impose the Navier-Stokes boundary condition (strong) with values from a CHT coupling.
226 * \param[in] geometry - Geometrical definition of the problem.
227 * \param[in] solver_container - Container vector with all the solutions.
228 * \param[in] conv_numerics - Description of the numerical method.
229 * \param[in] visc_numerics - Description of the numerical method.
230 * \param[in] config - Definition of the particular problem.
231 * \param[in] val_marker - Surface marker where the boundary condition is applied.
232 */
234 CSolver **solver_container,
235 CNumerics *numerics,
236 CConfig *config,
237 unsigned short val_marker) override;
238
239 /*!
240 * \brief Compute the buffet sensor.
241 * \param[in] geometry - Geometrical definition of the problem.
242 * \param[in] config - Definition of the particular problem.
243 */
244 void Buffet_Monitoring(const CGeometry *geometry, const CConfig *config) override;
245
246 /*!
247 * \brief Get the value of the buffet sensor
248 * \param[in] val_marker - Surface marker where the coefficient is computed.
249 * \param[in] val_vertex - Vertex of the marker <i>val_marker</i> where the coefficient is evaluated.
250 * \return Value of the buffet sensor.
251 */
252 inline su2double GetBuffetSensor(unsigned short val_marker, unsigned long val_vertex) const override {
253 return Buffet_Sensor[val_marker][val_vertex];
254 }
255};
Headers of the CEulerSolver class.
Main class for defining the problem; basically this class reads the configuration file,...
Definition CConfig.hpp:64
Class for compressible inviscid flow problems, serves as base for Navier-Stokes/RANS.
Definition CEulerSolver.hpp:40
Parent class for defining the geometry of the problem (complete geometry, multigrid agglomerated geom...
Definition CGeometry.hpp:75
Main class for defining the Navier-Stokes flow solver.
Definition CNSSolver.hpp:38
void BC_ConjugateHeat_Interface(CGeometry *geometry, CSolver **solver_container, CNumerics *numerics, CConfig *config, unsigned short val_marker) override
Impose the Navier-Stokes boundary condition (strong) with values from a CHT coupling.
Definition CNSSolver.cpp:793
void Evaluate_ObjFunc(const CConfig *config, CSolver **solver) override
Compute weighted-sum "combo" objective output.
Definition CNSSolver.cpp:276
CNSSolver()=default
Constructor of the class.
void BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) override
Impose a constant heat-flux condition at the wall.
Definition CNSSolver.cpp:424
~CNSSolver()=default
Destructor of the class.
su2double GetSurface_Buffet_Metric(unsigned short val_marker) const override
Provide the buffet metric.
Definition CNSSolver.hpp:150
void Buffet_Monitoring(const CGeometry *geometry, const CConfig *config) override
Compute the buffet sensor.
Definition CNSSolver.cpp:187
su2double GetBuffetSensor(unsigned short val_marker, unsigned long val_vertex) const override
Get the value of the buffet sensor.
Definition CNSSolver.hpp:252
void BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) override
Impose the Navier-Stokes boundary condition (strong).
Definition CNSSolver.cpp:787
su2double GetTotal_Buffet_Metric() const override
Get the buffet metric.
Definition CNSSolver.hpp:156
void Preprocessing(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh, unsigned short iRKStep, unsigned short RunTime_EqSystem, bool Output) override
Restart residual and compute gradients.
Definition CNSSolver.cpp:71
void BC_HeatTransfer_Wall(const CGeometry *geometry, const CConfig *config, const unsigned short val_marker) override
Impose a heat flux by prescribing a heat transfer coefficient and a temperature at infinity.
Definition CNSSolver.cpp:431
Class for defining the numerical methods.
Definition CNumerics.hpp:48
Definition CSolver.hpp:71
su2double ** Jacobian_i
Auxiliary matrices for storing point to point Jacobians at point i.
Definition CSolver.hpp:128
su2double * Res_Conv
Auxiliary nVar vector for storing the convective residual.
Definition CSolver.hpp:121
su2double * Res_Visc
Auxiliary nVar vector for storing the viscous residual.
Definition CSolver.hpp:122
passivedouble su2double
Definition code_config.hpp:181
Return type used in some "ComputeResidual" overloads to give a const-view of the internally stored fl...
Definition CNumerics.hpp:218