Documentation 6b54b78464
Loading...
Searching...
No Matches
CTurbSolver.hpp
Go to the documentation of this file.
1/*!
2 * \file CTurbSolver.hpp
3 * \brief Headers of the CTurbSolver class
4 * \author A. Bueno.
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 "CScalarSolver.hpp"
31#include "../variables/CTurbVariable.hpp"
32#include "../../../Common/include/parallelization/omp_structure.hpp"
33
34/*!
35 * \class CTurbSolver
36 * \brief Main class for defining the turbulence model solver.
37 * \ingroup Turbulence_Model
38 * \author A. Bueno.
39 */
40class CTurbSolver : public CScalarSolver<CTurbVariable> {
41protected:
42
43 vector<su2activematrix> Inlet_TurbVars; /*!< \brief Turbulence variables at inlet profiles */
44
45public:
46 /*!
47 * \brief Destructor of the class.
48 */
49 ~CTurbSolver() override;
50
51 /*!
52 * \brief Constructor of the class.
53 * \param[in] geometry - Geometrical definition of the problem.
54 * \param[in] config - Definition of the particular problem.
55 * \param[in] flow_solver - Flow solver the boundary ghost states mirror.
56 */
57 CTurbSolver(CGeometry* geometry, CConfig *config, const CSolver* flow_solver, bool conservative);
58
59
60 /*!
61 * \brief Impose via the residual the Euler wall boundary condition.
62 * \param[in] geometry - Geometrical definition of the problem.
63 * \param[in] solver_container - Container vector with all the solutions.
64 * \param[in] numerics - Description of the numerical method.
65 * \param[in] config - Definition of the particular problem.
66 * \param[in] val_marker - Surface marker where the boundary condition is applied.
67 */
68 void BC_TurboRiemann(CGeometry *geometry,
69 CSolver **solver_container,
70 CNumerics *conv_numerics,
71 CNumerics *visc_numerics,
72 CConfig *config,
73 unsigned short val_marker) final;
74
75 /*!
76 * \brief Impose via the residual the Euler wall boundary condition.
77 * \param[in] geometry - Geometrical definition of the problem.
78 * \param[in] solver_container - Container vector with all the solutions.
79 * \param[in] numerics - Description of the numerical method.
80 * \param[in] config - Definition of the particular problem.
81 * \param[in] val_marker - Surface marker where the boundary condition is applied.
82 */
83 void BC_Giles(CGeometry *geometry,
84 CSolver **solver_container,
85 CNumerics *conv_numerics,
86 CNumerics *visc_numerics,
87 CConfig *config,
88 unsigned short val_marker) final;
89
90 /*!
91 * \brief Load a solution from a restart file.
92 * \param[in] geometry - Geometrical definition of the problem.
93 * \param[in] solver - Container vector with all of the solvers.
94 * \param[in] config - Definition of the particular problem.
95 * \param[in] val_iter - Current external iteration number.
96 * \param[in] val_update_geo - Flag for updating coords and grid velocity.
97 */
98 void LoadRestart(CGeometry** geometry, CSolver*** solver, CConfig* config, int val_iter, bool val_update_geo) override;
99
100 /*!
101 * \brief Impose fixed values to turbulence quantities.
102 * \details Turbulence quantities are set to far-field values in an upstream half-plane
103 * in order to keep them from decaying.
104 */
105 void Impose_Fixed_Values(const CGeometry *geometry, const CConfig *config) final;
106
107 /*!
108 * \brief Set custom turbulence variables at the vertex of an inlet.
109 * \param[in] iMarker - Marker identifier.
110 * \param[in] iVertex - Vertex identifier.
111 * \param[in] iDim - Index of the turbulence variable (i.e. k is 0 in SST)
112 * \param[in] val_turb_var - Value of the turbulence variable to be used.
113 */
114 inline void SetInlet_TurbVar(unsigned short val_marker,
115 unsigned long val_vertex,
116 unsigned short val_dim,
117 su2double val_turb_var) final {
118 /*--- Since this call can be accessed indirectly using python, do some error
119 * checking to prevent segmentation faults ---*/
120 if (val_marker >= nMarker)
121 SU2_MPI::Error("Out-of-bounds marker index used on inlet.", CURRENT_FUNCTION);
122 else if (val_vertex >= nVertex[val_marker])
123 SU2_MPI::Error("Out-of-bounds vertex index used on inlet.", CURRENT_FUNCTION);
124 else if (val_dim >= nVar)
125 SU2_MPI::Error("Out-of-bounds index used for inlet turbulence variable.", CURRENT_FUNCTION);
126 else
127 Inlet_TurbVars[val_marker][val_vertex][val_dim] = val_turb_var;
128 }
129
130 /*!
131 * \brief Register additional In- or Outputs for RANS.
132 * \param[in] input - Boolean whether In- or Output should be registered.
133 * \param[in] config - The particular config.
134 * \returns The number of extra variables.
135 */
136 unsigned long RegisterSolutionExtra(bool input, const CConfig* config) final;
137
138 /*!
139 * \brief Compute a suitable under-relaxation parameter to limit the change in the solution variables over
140 * a nonlinear iteration for stability.
141 * \param[in] allowableRatio - Maximum percentage update in variable per iteration.
142 */
143 void ComputeUnderRelaxationFactorHelper(CSolver** solver_container, su2double allowableRatio);
144};
Headers of the CScalarSolver class.
static void Error(const std::string &ErrorMsg, const std::string &FunctionName)
Definition mpi_structure.cpp:131
Main class for defining the problem; basically this class reads the configuration file,...
Definition CConfig.hpp:64
Parent class for defining the geometry of the problem (complete geometry, multigrid agglomerated geom...
Definition CGeometry.hpp:75
Class for defining the numerical methods.
Definition CNumerics.hpp:48
Main class for defining a scalar solver.
Definition CScalarSolver.hpp:59
Definition CSolver.hpp:71
vector< unsigned long > nVertex
Store nVertex at each marker for deallocation.
Definition CSolver.hpp:146
unsigned short nVar
Number of variables of the problem.
Definition CSolver.hpp:85
unsigned long nMarker
Total number of markers using the grid information.
Definition CSolver.hpp:145
Main class for defining the turbulence model solver.
Definition CTurbSolver.hpp:40
void SetInlet_TurbVar(unsigned short val_marker, unsigned long val_vertex, unsigned short val_dim, su2double val_turb_var) final
Set custom turbulence variables at the vertex of an inlet.
Definition CTurbSolver.hpp:114
void Impose_Fixed_Values(const CGeometry *geometry, const CConfig *config) final
Impose fixed values to turbulence quantities.
Definition CTurbSolver.cpp:234
void BC_Giles(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) final
Impose via the residual the Euler wall boundary condition.
Definition CTurbSolver.cpp:68
vector< su2activematrix > Inlet_TurbVars
Turbulence variables at inlet profiles.
Definition CTurbSolver.hpp:43
~CTurbSolver() override
Destructor of the class.
Definition CTurbSolver.cpp:43
void LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig *config, int val_iter, bool val_update_geo) override
Load a solution from a restart file.
Definition CTurbSolver.cpp:93
unsigned long RegisterSolutionExtra(bool input, const CConfig *config) final
Register additional In- or Outputs for RANS.
Definition CTurbSolver.cpp:270
void BC_TurboRiemann(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) final
Impose via the residual the Euler wall boundary condition.
Definition CTurbSolver.cpp:51
void ComputeUnderRelaxationFactorHelper(CSolver **solver_container, su2double allowableRatio)
Compute a suitable under-relaxation parameter to limit the change in the solution variables over a no...
Definition CTurbSolver.cpp:280
passivedouble su2double
Definition code_config.hpp:181
#define CURRENT_FUNCTION
Definition mpi_structure.hpp:59