Documentation a537f1bdf2
Loading...
Searching...
No Matches
CIteration.hpp
Go to the documentation of this file.
1/*!
2 * \file CIteration.hpp
3 * \brief Headers of the iteration classes used by SU2_CFD.
4 * Each CIteration class represents an available physics package.
5 * \author F. Palacios, T. Economon
6 * \version 8.5.0 "Harrier"
7 *
8 * SU2 Project Website: https://su2code.github.io
9 *
10 * The SU2 Project is maintained by the SU2 Foundation
11 * (http://su2foundation.org)
12 *
13 * Copyright 2012-2026, SU2 Contributors (cf. AUTHORS.md)
14 *
15 * SU2 is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU Lesser General Public
17 * License as published by the Free Software Foundation; either
18 * version 2.1 of the License, or (at your option) any later version.
19 *
20 * SU2 is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 * Lesser General Public License for more details.
24 *
25 * You should have received a copy of the GNU Lesser General Public
26 * License along with SU2. If not, see <http://www.gnu.org/licenses/>.
27 */
28
29#pragma once
30
31#include "../../../Common/include/CConfig.hpp"
32#include "../../../Common/include/geometry/CGeometry.hpp"
33#include "../../../Common/include/grid_movement/CSurfaceMovement.hpp"
34#include "../../../Common/include/grid_movement/CVolumetricMovement.hpp"
35#include "../../../Common/include/grid_movement/CFreeFormDefBox.hpp"
36#include "../../../Common/include/parallelization/mpi_structure.hpp"
37#include "../integration/CIntegration.hpp"
38#include "../output/CTurboOutput.hpp"
39
40using namespace std;
41
42class COutput;
43
44/*!
45 * \class CIteration
46 * \ingroup Drivers
47 * \brief Parent class for defining a single iteration of a physics problem.
48 * \author T. Economon
49 */
51 protected:
52 const int rank, /*!< \brief MPI Rank. */
53 size; /*!< \brief MPI Size. */
54 const unsigned short nZone; /*!< \brief Total number of zones in the problem. */
55 const unsigned short nInst; /*!< \brief Total number of instances in the problem. */
56
57 const bool multizone, /*!< \brief Flag for multizone problems. */
58 singlezone; /*!< \brief Flag for singlezone problems. */
59
60 su2double StartTime{0.0}, /*!< \brief Tracking wall time. */
61 StopTime{0.0}, UsedTime{0.0};
62
63 std::shared_ptr<CTurbomachineryStagePerformance> TurbomachineryStagePerformance; /*!< \brief turbo stage performance calculator. */
64 public:
65 /*!
66 * \brief Constructor of the class.
67 */
68 explicit CIteration(const CConfig* config)
69 : rank(SU2_MPI::GetRank()),
70 size(SU2_MPI::GetSize()),
71 nZone(config->GetnZone()),
72 nInst(config->GetnTimeInstances()),
73 multizone(config->GetMultizone_Problem()),
75
76 /*!
77 * \brief Destructor of the class.
78 */
79 virtual ~CIteration(void) = default;
80
81 /*!
82 * \brief Updates the positions and grid velocities for dynamic meshes between physical time steps.
83 * \author T. Economon
84 * \param[in] geometry - Geometrical definition of the problem.
85 * \param[in] surface_movement - Surface movement classes of the problem.
86 * \param[in] grid_movement - Volume grid movement classes of the problem.
87 * \param[in] solver - Container vector with all the solutions.
88 * \param[in] config - Definition of the particular problem.
89 * \param[in] IntIter - Current psuedo time iteration number.
90 * \param[in] TimeIter - Current physical time iteration number.
91 */
92 virtual void SetGrid_Movement(CGeometry** geometry, CSurfaceMovement* surface_movement,
93 CVolumetricMovement* grid_movement, CSolver*** solver, CConfig* config,
94 unsigned long IntIter, unsigned long TimeIter);
95 /*!
96 * \brief Run the mesh deformation algorithms.
97 * \author R. Sanchez
98 * \param[in] geometry - Geometrical definition of the problem.
99 * \param[in] solver_container - Container vector with all the solutions.
100 * \param[in] config_container - Definition of the particular problem.
101 * \param[in] kind_recording - Current kind of recording.
102 */
103 void SetMesh_Deformation(CGeometry** geometry, CSolver** solver_container, CNumerics*** numerics_container,
104 CConfig* config_container, RECORDING kind_recording);
105
106 /*!
107 * \brief A virtual member.
108 * \param[in] output - Pointer to the COutput class.
109 * \param[in] integration - Container vector with all the integration methods.
110 * \param[in] geometry - Geometrical definition of the problem.
111 * \param[in] solver - Container vector with all the solutions.
112 * \param[in] numerics - Description of the numerical method (the way in which the equations are solved).
113 * \param[in] config - Definition of the particular problem.
114 * \param[in] surface_movement - Surface movement classes of the problem.
115 * \param[in] grid_movement - Volume grid movement classes of the problem.
116 * \param[in] FFDBox - FFD FFDBoxes of the problem.
117 * \param[in] val_iZone - Index of the zone.
118 * \param[in] val_iInst - Index of the instantiation.
119 */
120 virtual void Preprocess(COutput* output, CIntegration**** integration, CGeometry**** geometry, CSolver***** solver,
121 CNumerics****** numerics, CConfig** config, CSurfaceMovement** surface_movement,
122 CVolumetricMovement*** grid_movement, CFreeFormDefBox*** FFDBox, unsigned short val_iZone,
123 unsigned short val_iInst){}
124
125 /*!
126 * \brief A virtual member.
127 * \param[in] output - Pointer to the COutput class.
128 * \param[in] integration - Container vector with all the integration methods.
129 * \param[in] geometry - Geometrical definition of the problem.
130 * \param[in] solver - Container vector with all the solutions.
131 * \param[in] numerics - Description of the numerical method (the way in which the equations are solved).
132 * \param[in] config - Definition of the particular problem.
133 * \param[in] surface_movement - Surface movement classes of the problem.
134 * \param[in] grid_movement - Volume grid movement classes of the problem.
135 * \param[in] FFDBox - FFD FFDBoxes of the problem.
136 * \param[in] val_iZone - Index of the zone.
137 * \param[in] val_iInst - Index of the instantiation.
138 */
139 virtual void Iterate(COutput* output, CIntegration**** integration, CGeometry**** geometry, CSolver***** solver,
140 CNumerics****** numerics, CConfig** config, CSurfaceMovement** surface_movement,
141 CVolumetricMovement*** grid_movement, CFreeFormDefBox*** FFDBox, unsigned short val_iZone,
142 unsigned short val_iInst){}
143
144 /*!
145 * \brief A virtual member.
146 * \param[in] geometry - Geometrical definition of the problem.
147 * \param[in] solver - Container vector with all the solutions.
148 * \param[in] config - Definition of the particular problem.
149 * \param[in] val_iZone - Index of the zone.
150 * \param[in] val_iInst - Index of the instantiation.
151 * \param[in] CrossTerm - Boolean for CrossTerm.
152 */
153 virtual void IterateDiscAdj(CGeometry**** geometry, CSolver***** solver, CConfig** config,
154 unsigned short val_iZone, unsigned short val_iInst, bool CrossTerm) {}
155
156 /*!
157 * \brief A virtual member.
158 * \param[in] output - Pointer to the COutput class.
159 * \param[in] integration - Container vector with all the integration methods.
160 * \param[in] geometry - Geometrical definition of the problem.
161 * \param[in] solver - Container vector with all the solutions.
162 * \param[in] numerics - Description of the numerical method (the way in which the equations are solved).
163 * \param[in] config - Definition of the particular problem.
164 * \param[in] surface_movement - Surface movement classes of the problem.
165 * \param[in] grid_movement - Volume grid movement classes of the problem.
166 * \param[in] FFDBox - FFD FFDBoxes of the problem.
167 * \param[in] val_iZone - Index of the zone.
168 * \param[in] val_iInst - Index of the instantiation.
169 */
170 virtual void Solve(COutput* output, CIntegration**** integration, CGeometry**** geometry, CSolver***** solver,
171 CNumerics****** numerics, CConfig** config, CSurfaceMovement** surface_movement,
172 CVolumetricMovement*** grid_movement, CFreeFormDefBox*** FFDBox, unsigned short val_iZone,
173 unsigned short val_iInst){}
174
175 /*!
176 * \brief A virtual member.
177 * \param[in] output - Pointer to the COutput class.
178 * \param[in] integration - Container vector with all the integration methods.
179 * \param[in] geometry - Geometrical definition of the problem.
180 * \param[in] solver - Container vector with all the solutions.
181 * \param[in] numerics - Description of the numerical method (the way in which the equations are solved).
182 * \param[in] config - Definition of the particular problem.
183 * \param[in] surface_movement - Surface movement classes of the problem.
184 * \param[in] grid_movement - Volume grid movement classes of the problem.
185 * \param[in] FFDBox - FFD FFDBoxes of the problem.
186 * \param[in] val_iZone - Index of the zone.
187 * \param[in] val_iInst - Index of the instantiation.
188 */
189 virtual void Update(COutput* output, CIntegration**** integration, CGeometry**** geometry, CSolver***** solver,
190 CNumerics****** numerics, CConfig** config, CSurfaceMovement** surface_movement,
191 CVolumetricMovement*** grid_movement, CFreeFormDefBox*** FFDBox, unsigned short val_iZone,
192 unsigned short val_iInst){}
193
194 /*!
195 * \brief A virtual member.
196 * \param[in] output - Pointer to the COutput class.
197 * \param[in] integration - Container vector with all the integration methods.
198 * \param[in] geometry - Geometrical definition of the problem.
199 * \param[in] solver - Container vector with all the solutions.
200 * \param[in] numerics - Description of the numerical method (the way in which the equations are solved).
201 * \param[in] config - Definition of the particular problem.
202 * \param[in] surface_movement - Surface movement classes of the problem.
203 * \param[in] grid_movement - Volume grid movement classes of the problem.
204 * \param[in] FFDBox - FFD FFDBoxes of the problem.
205 * \param[in] val_iZone - Index of the zone.
206 * \param[in] val_iInst - Index of the instantiation.
207 */
208 virtual void Predictor(COutput* output, CIntegration**** integration, CGeometry**** geometry, CSolver***** solver,
209 CNumerics****** numerics, CConfig** config, CSurfaceMovement** surface_movement,
210 CVolumetricMovement*** grid_movement, CFreeFormDefBox*** FFDBox, unsigned short val_iZone,
211 unsigned short val_iInst){}
212
213 /*!
214 * \brief A virtual member.
215 * \param[in] output - Pointer to the COutput class.
216 * \param[in] integration - Container vector with all the integration methods.
217 * \param[in] geometry - Geometrical definition of the problem.
218 * \param[in] solver - Container vector with all the solutions.
219 * \param[in] numerics - Description of the numerical method (the way in which the equations are solved).
220 * \param[in] config - Definition of the particular problem.
221 * \param[in] surface_movement - Surface movement classes of the problem.
222 * \param[in] grid_movement - Volume grid movement classes of the problem.
223 * \param[in] FFDBox - FFD FFDBoxes of the problem.
224 * \param[in] val_iZone - Index of the zone.
225 * \param[in] val_iInst - Index of the instantiation.
226 */
227 virtual void Relaxation(COutput* output, CIntegration**** integration, CGeometry**** geometry, CSolver***** solver,
228 CNumerics****** numerics, CConfig** config, CSurfaceMovement** surface_movement,
229 CVolumetricMovement*** grid_movement, CFreeFormDefBox*** FFDBox, unsigned short val_iZone,
230 unsigned short val_iInst){}
231
232 /*!
233 * \brief A virtual member.
234 * \param[in] output - Pointer to the COutput class.
235 * \param[in] integration - Container vector with all the integration methods.
236 * \param[in] geometry - Geometrical definition of the problem.
237 * \param[in] solver - Container vector with all the solutions.
238 * \param[in] numerics - Description of the numerical method (the way in which the equations are solved).
239 * \param[in] config - Definition of the particular problem.
240 * \param[in] surface_movement - Surface movement classes of the problem.
241 * \param[in] grid_movement - Volume grid movement classes of the problem.
242 * \param[in] FFDBox - FFD FFDBoxes of the problem.
243 * \param[in] val_iZone - Index of the zone.
244 * \param[in] val_iInst - Index of the instantiation.
245 */
246 virtual bool Monitor(COutput* output, CIntegration**** integration, CGeometry**** geometry, CSolver***** solver,
247 CNumerics****** numerics, CConfig** config, CSurfaceMovement** surface_movement,
248 CVolumetricMovement*** grid_movement, CFreeFormDefBox*** FFDBox, unsigned short val_iZone,
249 unsigned short val_iInst) {
250 return false;
251 }
252 /*!
253 * \brief A virtual member.
254 * \param[in] output - Pointer to the COutput class.
255 * \param[in] geometry - Geometrical definition of the problem.
256 * \param[in] solver - Container vector with all the solutions.
257 * \param[in] config - Definition of the particular problem.
258 * \param[in] InnerIter - Current psuedo time iteration number.
259 * \param[in] StopCalc - Boolean storing whether to stop the simulation
260 * \param[in] val_iZone - Index of the zone.
261 * \param[in] val_iInst - Index of the instantiation.
262 */
263 void Output(COutput* output, CGeometry**** geometry, CSolver***** solver, CConfig** config, unsigned long InnerIter,
264 bool StopCalc, unsigned short val_iZone, unsigned short val_iInst);
265
266 /*!
267 * \brief A virtual member.
268 * \param[in] output - Pointer to the COutput class.
269 * \param[in] integration - Container vector with all the integration methods.
270 * \param[in] geometry - Geometrical definition of the problem.
271 * \param[in] solver - Container vector with all the solutions.
272 * \param[in] numerics - Description of the numerical method (the way in which the equations are solved).
273 * \param[in] config - Definition of the particular problem.
274 * \param[in] surface_movement - Surface movement classes of the problem.
275 * \param[in] grid_movement - Volume grid movement classes of the problem.
276 * \param[in] FFDBox - FFD FFDBoxes of the problem.
277 * \param[in] val_iZone - Index of the zone.
278 * \param[in] val_iInst - Index of the instantiation.
279 */
280 virtual void Postprocess(COutput* output, CIntegration**** integration, CGeometry**** geometry, CSolver***** solver,
281 CNumerics****** numerics, CConfig** config, CSurfaceMovement** surface_movement,
282 CVolumetricMovement*** grid_movement, CFreeFormDefBox*** FFDBox, unsigned short val_iZone,
283 unsigned short val_iInst) {}
284
285 virtual void InitializeAdjoint(CSolver***** solver, CGeometry**** geometry, CConfig** config, unsigned short iZone,
286 unsigned short iInst) {}
287
288 virtual void RegisterInput(CSolver***** solver, CGeometry**** geometry, CConfig** config, unsigned short iZone,
289 unsigned short iInst, RECORDING kind_recording) {}
290
291 virtual void SetDependencies(CSolver***** solver, CGeometry**** geometry, CNumerics****** numerics, CConfig** config,
292 unsigned short iZone, unsigned short iInst, RECORDING kind_recording) {}
293
294 virtual void RegisterOutput(CSolver***** solver, CGeometry**** geometry, CConfig** config,
295 unsigned short iZone, unsigned short iInst) {}
296
297 /*!
298 * \brief Computes turboperformance.
299 */
300 void ComputeTurboPerformance(CSolver***** solver, CGeometry**** geometry_container, CConfig** config_container);
301
302 /*!
303 * \brief Initialises turboperformance classes.
304 */
305 void InitTurboPerformance(CGeometry *geometry, CConfig** config, CFluidModel *fluid, unsigned short val_iZone);
306
307 inline su2vector<std::shared_ptr<CTurboOutput>> GetBladesPerformanceVector(CSolver***** solver, unsigned short nBladeRow){
308 su2vector<std::shared_ptr<CTurboOutput>> bladePerformances(nBladeRow);
309 for (auto iBladeRow = 0u; iBladeRow < nBladeRow; iBladeRow++) {
310 bladePerformances[iBladeRow] = solver[iBladeRow][INST_0][MESH_0][FLOW_SOL]->GetTurboBladePerformance();
311 }
312 return bladePerformances;
313 }
314};
A templated matrix/vector-like object.
Definition C2DContainer.hpp:374
Definition mpi_structure.hpp:501
Main class for defining the problem; basically this class reads the configuration file,...
Definition CConfig.hpp:64
Main class for defining the Thermo-Physical Model.
Definition CFluidModel.hpp:47
Class for defining the free form FFDBox structure.
Definition CFreeFormDefBox.hpp:38
Parent class for defining the geometry of the problem (complete geometry, multigrid agglomerated geom...
Definition CGeometry.hpp:75
Main class for doing the space integration, time integration, and monitoring of a system of Partial D...
Definition CIntegration.hpp:47
Parent class for defining a single iteration of a physics problem.
Definition CIteration.hpp:50
std::shared_ptr< CTurbomachineryStagePerformance > TurbomachineryStagePerformance
turbo stage performance calculator.
Definition CIteration.hpp:63
su2double StartTime
Tracking wall time.
Definition CIteration.hpp:60
virtual void IterateDiscAdj(CGeometry ****geometry, CSolver *****solver, CConfig **config, unsigned short val_iZone, unsigned short val_iInst, bool CrossTerm)
A virtual member.
Definition CIteration.hpp:153
virtual void InitializeAdjoint(CSolver *****solver, CGeometry ****geometry, CConfig **config, unsigned short iZone, unsigned short iInst)
Definition CIteration.hpp:285
virtual void Preprocess(COutput *output, CIntegration ****integration, CGeometry ****geometry, CSolver *****solver, CNumerics ******numerics, CConfig **config, CSurfaceMovement **surface_movement, CVolumetricMovement ***grid_movement, CFreeFormDefBox ***FFDBox, unsigned short val_iZone, unsigned short val_iInst)
A virtual member.
Definition CIteration.hpp:120
void ComputeTurboPerformance(CSolver *****solver, CGeometry ****geometry_container, CConfig **config_container)
Computes turboperformance.
Definition CIteration.cpp:221
const int size
MPI Size.
Definition CIteration.hpp:53
virtual void Update(COutput *output, CIntegration ****integration, CGeometry ****geometry, CSolver *****solver, CNumerics ******numerics, CConfig **config, CSurfaceMovement **surface_movement, CVolumetricMovement ***grid_movement, CFreeFormDefBox ***FFDBox, unsigned short val_iZone, unsigned short val_iInst)
A virtual member.
Definition CIteration.hpp:189
CIteration(const CConfig *config)
Constructor of the class.
Definition CIteration.hpp:68
su2double StopTime
Definition CIteration.hpp:61
const bool singlezone
Flag for singlezone problems.
Definition CIteration.hpp:58
virtual ~CIteration(void)=default
Destructor of the class.
void InitTurboPerformance(CGeometry *geometry, CConfig **config, CFluidModel *fluid, unsigned short val_iZone)
Initialises turboperformance classes.
Definition CIteration.cpp:217
virtual void Solve(COutput *output, CIntegration ****integration, CGeometry ****geometry, CSolver *****solver, CNumerics ******numerics, CConfig **config, CSurfaceMovement **surface_movement, CVolumetricMovement ***grid_movement, CFreeFormDefBox ***FFDBox, unsigned short val_iZone, unsigned short val_iInst)
A virtual member.
Definition CIteration.hpp:170
virtual void SetGrid_Movement(CGeometry **geometry, CSurfaceMovement *surface_movement, CVolumetricMovement *grid_movement, CSolver ***solver, CConfig *config, unsigned long IntIter, unsigned long TimeIter)
Updates the positions and grid velocities for dynamic meshes between physical time steps.
Definition CIteration.cpp:33
void Output(COutput *output, CGeometry ****geometry, CSolver *****solver, CConfig **config, unsigned long InnerIter, bool StopCalc, unsigned short val_iZone, unsigned short val_iInst)
A virtual member.
Definition CIteration.cpp:210
const int rank
MPI Rank.
Definition CIteration.hpp:52
su2double UsedTime
Definition CIteration.hpp:61
const bool multizone
Flag for multizone problems.
Definition CIteration.hpp:57
virtual void RegisterOutput(CSolver *****solver, CGeometry ****geometry, CConfig **config, unsigned short iZone, unsigned short iInst)
Definition CIteration.hpp:294
virtual void Iterate(COutput *output, CIntegration ****integration, CGeometry ****geometry, CSolver *****solver, CNumerics ******numerics, CConfig **config, CSurfaceMovement **surface_movement, CVolumetricMovement ***grid_movement, CFreeFormDefBox ***FFDBox, unsigned short val_iZone, unsigned short val_iInst)
A virtual member.
Definition CIteration.hpp:139
virtual void Predictor(COutput *output, CIntegration ****integration, CGeometry ****geometry, CSolver *****solver, CNumerics ******numerics, CConfig **config, CSurfaceMovement **surface_movement, CVolumetricMovement ***grid_movement, CFreeFormDefBox ***FFDBox, unsigned short val_iZone, unsigned short val_iInst)
A virtual member.
Definition CIteration.hpp:208
virtual void RegisterInput(CSolver *****solver, CGeometry ****geometry, CConfig **config, unsigned short iZone, unsigned short iInst, RECORDING kind_recording)
Definition CIteration.hpp:288
su2vector< std::shared_ptr< CTurboOutput > > GetBladesPerformanceVector(CSolver *****solver, unsigned short nBladeRow)
Definition CIteration.hpp:307
const unsigned short nInst
Total number of instances in the problem.
Definition CIteration.hpp:55
const unsigned short nZone
Total number of zones in the problem.
Definition CIteration.hpp:54
virtual void Postprocess(COutput *output, CIntegration ****integration, CGeometry ****geometry, CSolver *****solver, CNumerics ******numerics, CConfig **config, CSurfaceMovement **surface_movement, CVolumetricMovement ***grid_movement, CFreeFormDefBox ***FFDBox, unsigned short val_iZone, unsigned short val_iInst)
A virtual member.
Definition CIteration.hpp:280
virtual void Relaxation(COutput *output, CIntegration ****integration, CGeometry ****geometry, CSolver *****solver, CNumerics ******numerics, CConfig **config, CSurfaceMovement **surface_movement, CVolumetricMovement ***grid_movement, CFreeFormDefBox ***FFDBox, unsigned short val_iZone, unsigned short val_iInst)
A virtual member.
Definition CIteration.hpp:227
virtual bool Monitor(COutput *output, CIntegration ****integration, CGeometry ****geometry, CSolver *****solver, CNumerics ******numerics, CConfig **config, CSurfaceMovement **surface_movement, CVolumetricMovement ***grid_movement, CFreeFormDefBox ***FFDBox, unsigned short val_iZone, unsigned short val_iInst)
A virtual member.
Definition CIteration.hpp:246
void SetMesh_Deformation(CGeometry **geometry, CSolver **solver_container, CNumerics ***numerics_container, CConfig *config_container, RECORDING kind_recording)
Run the mesh deformation algorithms.
Definition CIteration.cpp:184
virtual void SetDependencies(CSolver *****solver, CGeometry ****geometry, CNumerics ******numerics, CConfig **config, unsigned short iZone, unsigned short iInst, RECORDING kind_recording)
Definition CIteration.hpp:291
Class for defining the numerical methods.
Definition CNumerics.hpp:48
Class for writing the convergence history and to write solution data to file.
Definition COutput.hpp:68
Definition CSolver.hpp:71
virtual std::shared_ptr< CTurboOutput > GetTurboBladePerformance() const
Definition CSolver.hpp:1152
Class for moving the surface numerical grid.
Definition CSurfaceMovement.hpp:38
Class for moving the volumetric numerical grid.
Definition CVolumetricMovement.hpp:37
passivedouble su2double
Definition code_config.hpp:181
const unsigned int INST_0
Definition of the first instance per grid level.
Definition option_structure.hpp:92
const unsigned int MESH_0
Definition of the finest grid level.
Definition option_structure.hpp:88
@ FLOW_SOL
Position of the mean flow solution in the solver container array.
Definition option_structure.hpp:577
RECORDING
Definition option_structure.hpp:2820