Documentation 6b54b78464
Loading...
Searching...
No Matches
CTemplateSolver.hpp
Go to the documentation of this file.
1/*!
2 * \file CTemplateSolver.hpp
3 * \brief Headers of the CTemplateSolver class
4 * \author F. Palacios
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 "CSolver.hpp"
31
32/*!
33 * \class CTemplateSolver
34 * \brief Main class for defining the template model solver.
35 * \ingroup Template_Flow_Equation
36 * \author F. Palacios
37 */
38class CTemplateSolver final : public CSolver {
39private:
40
41 CVariable* nodes = nullptr; /*!< \brief The highest level in the variable hierarchy this solver can safely use. */
42
43 /*!
44 * \brief Return nodes to allow CSolver::base_nodes to be set.
45 */
46 inline CVariable* GetBaseClassPointerToNodes() override { return nodes; }
47
48public:
49
50 /*!
51 * \brief Constructor of the class.
52 */
53 CTemplateSolver(void);
54
55 /*!
56 * \overload
57 * \param[in] geometry - Geometrical definition of the problem.
58 * \param[in] config - Definition of the particular problem.
59 */
60 CTemplateSolver(CGeometry *geometry, CConfig *config);
61
62 /*!
63 * \brief Destructor of the class.
64 */
65 ~CTemplateSolver(void) override;
66
67 /*!
68 * \brief Compute the velocity^2, SoundSpeed, Pressure.
69 * \param[in] geometry - Geometrical definition of the problem.
70 * \param[in] solver_container - Container vector with all the solutions.
71 * \param[in] config - Definition of the particular problem.
72 * \param[in] iMesh - Index of the mesh in multigrid computations.
73 * \param[in] iRKStep - Current step of the Runge-Kutta iteration.
74 * \param[in] RunTime_EqSystem - System of equations which is going to be solved.
75 * \param[in] Output - boolean to determine whether to print output.
76 */
77 void Preprocessing(CGeometry *geometry,
78 CSolver **solver_container,
79 CConfig *config,
80 unsigned short iMesh,
81 unsigned short iRKStep,
82 unsigned short RunTime_EqSystem,
83 bool Output) override;
84
85 /*!
86 * \brief Compute the time step for solving the Euler equations.
87 * \param[in] geometry - Geometrical definition of the problem.
88 * \param[in] solver_container - Container vector with all the solutions.
89 * \param[in] config - Definition of the particular problem.
90 * \param[in] iMesh - Index of the mesh in multigrid computations.
91 * \param[in] Iteration - Index of the current iteration.
92 */
93 void SetTime_Step(CGeometry *geometry,
94 CSolver **solver_container,
95 CConfig *config,
96 unsigned short iMesh,
97 unsigned long Iteration) override;
98
99 /*!
100 * \brief Compute the spatial integration using a centered scheme.
101 * \param[in] geometry - Geometrical definition of the problem.
102 * \param[in] solver_container - Container vector with all the solutions.
103 * \param[in] numerics_container - Description of the numerical method.
104 * \param[in] config - Definition of the particular problem.
105 * \param[in] iMesh - Index of the mesh in multigrid computations.
106 * \param[in] iRKStep - Current step of the Runge-Kutta iteration.
107 */
108 void Centered_Residual(CGeometry *geometry,
109 CSolver **solver_container,
110 CNumerics **numerics_container,
111 CConfig *config,
112 unsigned short iMesh,
113 unsigned short iRKStep) override;
114
115 /*!
116 * \brief Compute the spatial integration using a upwind scheme.
117 * \param[in] geometry - Geometrical definition of the problem.
118 * \param[in] solver_container - Container vector with all the solutions.
119 * \param[in] numerics_container - Description of the numerical method.
120 * \param[in] config - Definition of the particular problem.
121 * \param[in] iMesh - Index of the mesh in multigrid computations.
122 */
123 void Upwind_Residual(CGeometry *geometry,
124 CSolver **solver_container,
125 CNumerics **numerics_container,
126 CConfig *config,
127 unsigned short iMesh) override;
128
129 /*!
130 * \brief Source term integration.
131 * \param[in] geometry - Geometrical definition of the problem.
132 * \param[in] solver_container - Container vector with all the solutions.
133 * \param[in] numerics_container - Description of the numerical method.
134 * \param[in] config - Definition of the particular problem.
135 * \param[in] iMesh - Index of the mesh in multigrid computations.
136 */
137 void Source_Residual(CGeometry *geometry,
138 CSolver **solver_container,
139 CNumerics **numerics_container,
140 CConfig *config,
141 unsigned short iMesh) override;
142
143 /*!
144 * \brief Source term integration.
145 * \param[in] geometry - Geometrical definition of the problem.
146 * \param[in] solver_container - Container vector with all the solutions.
147 * \param[in] numerics - Description of the numerical method.
148 * \param[in] config - Definition of the particular problem.
149 * \param[in] iMesh - Index of the mesh in multigrid computations.
150 */
151 void Source_Template(CGeometry *geometry,
152 CSolver **solver_container,
153 CNumerics *numerics,
154 CConfig *config,
155 unsigned short iMesh) override;
156
157 /*!
158 * \brief Impose via the residual the Euler wall boundary condition.
159 * \param[in] geometry - Geometrical definition of the problem.
160 * \param[in] solver_container - Container vector with all the solutions.
161 * \param[in] numerics - Description of the numerical method.
162 * \param[in] config - Definition of the particular problem.
163 * \param[in] val_marker - Surface marker where the boundary condition is applied.
164 */
165 void BC_Euler_Wall(CGeometry *geometry,
166 CSolver **solver_container,
167 CNumerics *conv_numerics,
168 CNumerics *visc_numerics,
169 CConfig *config,
170 unsigned short val_marker) override;
171
172 /*!
173 * \brief Impose the Navier-Stokes boundary condition (strong).
174 * \param[in] geometry - Geometrical definition of the problem.
175 * \param[in] solver_container - Container vector with all the solutions.
176 * \param[in] conv_numerics - Description of the numerical method.
177 * \param[in] visc_numerics - Description of the numerical method.
178 * \param[in] config - Definition of the particular problem.
179 * \param[in] val_marker - Surface marker where the boundary condition is applied.
180 */
181 void BC_HeatFlux_Wall(CGeometry *geometry,
182 CSolver **solver_container,
183 CNumerics *conv_numerics,
184 CNumerics *visc_numerics,
185 CConfig *config,
186 unsigned short val_marker) override;
187 /*!
188 * \brief Impose the far-field boundary condition.
189 * \param[in] geometry - Geometrical definition of the problem.
190 * \param[in] solver_container - Container vector with all the solutions.
191 * \param[in] conv_numerics - Description of the numerical method.
192 * \param[in] visc_numerics - Description of the numerical method.
193 * \param[in] config - Definition of the particular problem.
194 * \param[in] val_marker - Surface marker where the boundary condition is applied.
195 */
196 void BC_Far_Field(CGeometry *geometry,
197 CSolver **solver_container,
198 CNumerics *conv_numerics,
199 CNumerics *visc_numerics,
200 CConfig *config,
201 unsigned short val_marker) override;
202
203 /*!
204 * \brief Impose the inlet boundary condition.
205 * \param[in] geometry - Geometrical definition of the problem.
206 * \param[in] solver_container - Container vector with all the solutions.
207 * \param[in] conv_numerics - Description of the numerical method.
208 * \param[in] visc_numerics - Description of the numerical method.
209 * \param[in] config - Definition of the particular problem.
210 * \param[in] val_marker - Surface marker where the boundary condition is applied.
211 */
212 void BC_Inlet(CGeometry *geometry,
213 CSolver **solver_container,
214 CNumerics *conv_numerics,
215 CNumerics *visc_numerics,
216 CConfig *config,
217 unsigned short val_marker) override;
218 /*!
219 * \brief Impose the outlet boundary condition.
220 * \param[in] geometry - Geometrical definition of the problem.
221 * \param[in] solver_container - Container vector with all the solutions.
222 * \param[in] conv_numerics - Description of the numerical method.
223 * \param[in] visc_numerics - Description of the numerical method.
224 * \param[in] config - Definition of the particular problem.
225 * \param[in] val_marker - Surface marker where the boundary condition is applied.
226 */
227 void BC_Outlet(CGeometry *geometry,
228 CSolver **solver_container,
229 CNumerics *conv_numerics,
230 CNumerics *visc_numerics,
231 CConfig *config,
232 unsigned short val_marker) override;
233 /*!
234 * \brief Impose the symmetry plane boundary condition.
235 * \param[in] geometry - Geometrical definition of the problem.
236 * \param[in] solver_container - Container vector with all the solutions.
237 * \param[in] conv_numerics - Description of the numerical method.
238 * \param[in] visc_numerics - Description of the numerical method.
239 * \param[in] config - Definition of the particular problem.
240 * \param[in] val_marker - Surface marker where the boundary condition is applied.
241 */
242 void BC_Sym_Plane(CGeometry *geometry,
243 CSolver **solver_container,
244 CNumerics *conv_numerics,
245 CNumerics *visc_numerics,
246 CConfig *config,
247 unsigned short val_marker) override;
248
249 /*!
250 * \brief Impose a custom or verification boundary condition.
251 * \param[in] geometry - Geometrical definition of the problem.
252 * \param[in] solver_container - Container vector with all the solutions.
253 * \param[in] conv_numerics - Description of the convective numerical method.
254 * \param[in] visc_numerics - Description of the viscous numerical method.
255 * \param[in] config - Definition of the particular problem.
256 * \param[in] val_marker - Surface marker where the boundary condition is applied.
257 */
258 void BC_Custom(CGeometry *geometry,
259 CSolver **solver_container,
260 CNumerics *conv_numerics,
261 CNumerics *visc_numerics,
262 CConfig *config,
263 unsigned short val_marker) override;
264
265 /*!
266 * \brief Update the solution using a Runge-Kutta scheme.
267 * \param[in] geometry - Geometrical definition of the problem.
268 * \param[in] solver_container - Container vector with all the solutions.
269 * \param[in] config - Definition of the particular problem.
270 * \param[in] iRKStep - Current step of the Runge-Kutta iteration.
271 */
272 void ExplicitRK_Iteration(CGeometry *geometry,
273 CSolver **solver_container,
274 CConfig *config,
275 unsigned short iRKStep) override;
276
277 /*!
278 * \brief Update the solution using a explicit Euler scheme.
279 * \param[in] geometry - Geometrical definition of the problem.
280 * \param[in] solver_container - Container vector with all the solutions.
281 * \param[in] config - Definition of the particular problem.
282 */
283 void ExplicitEuler_Iteration(CGeometry *geometry,
284 CSolver **solver_container,
285 CConfig *config) override;
286
287 /*!
288 * \brief Update the solution using an implicit solver.
289 * \param[in] geometry - Geometrical definition of the problem.
290 * \param[in] solver_container - Container vector with all the solutions.
291 * \param[in] config - Definition of the particular problem.
292 */
293 void ImplicitEuler_Iteration(CGeometry *geometry,
294 CSolver **solver_container,
295 CConfig *config) override;
296
297};
Headers of the CSolver class which is inherited by all of the other solvers.
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
Definition CSolver.hpp:71
Main class for defining the template model solver.
Definition CTemplateSolver.hpp:38
void Source_Template(CGeometry *geometry, CSolver **solver_container, CNumerics *numerics, CConfig *config, unsigned short iMesh) override
Source term integration.
Definition CTemplateSolver.cpp:50
void SetTime_Step(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh, unsigned long Iteration) override
Compute the time step for solving the Euler equations.
Definition CTemplateSolver.cpp:39
void Centered_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics **numerics_container, CConfig *config, unsigned short iMesh, unsigned short iRKStep) override
Compute the spatial integration using a centered scheme.
Definition CTemplateSolver.cpp:41
void BC_Euler_Wall(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) override
Impose via the residual the Euler wall boundary condition.
Definition CTemplateSolver.cpp:53
void BC_Sym_Plane(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) override
Impose the symmetry plane boundary condition.
Definition CTemplateSolver.cpp:71
void ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_container, CConfig *config) override
Update the solution using an implicit solver.
Definition CTemplateSolver.cpp:85
void ExplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_container, CConfig *config) override
Update the solution using a explicit Euler scheme.
Definition CTemplateSolver.cpp:83
void Preprocessing(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh, unsigned short iRKStep, unsigned short RunTime_EqSystem, bool Output) override
Compute the velocity^2, SoundSpeed, Pressure.
Definition CTemplateSolver.cpp:37
void ExplicitRK_Iteration(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iRKStep) override
Update the solution using a Runge-Kutta scheme.
Definition CTemplateSolver.cpp:80
void BC_Custom(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) override
Impose a custom or verification boundary condition.
Definition CTemplateSolver.cpp:78
~CTemplateSolver(void) override
Destructor of the class.
void BC_Inlet(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) override
Impose the inlet boundary condition.
Definition CTemplateSolver.cpp:65
void BC_Far_Field(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) override
Impose the far-field boundary condition.
Definition CTemplateSolver.cpp:62
CTemplateSolver(void)
Constructor of the class.
Definition CTemplateSolver.cpp:31
void Upwind_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics **numerics_container, CConfig *config, unsigned short iMesh) override
Compute the spatial integration using a upwind scheme.
Definition CTemplateSolver.cpp:44
void BC_Outlet(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) override
Impose the outlet boundary condition.
Definition CTemplateSolver.cpp:68
void Source_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics **numerics_container, CConfig *config, unsigned short iMesh) override
Source term integration.
Definition CTemplateSolver.cpp:47
void BC_HeatFlux_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 CTemplateSolver.cpp:60
Main class for defining the variables.
Definition CVariable.hpp:50