Documentation 6b54b78464
Loading...
Searching...
No Matches
CDriver.hpp
Go to the documentation of this file.
1/*!
2 * \file CDriver.hpp
3 * \brief Headers of the main subroutines for driving single or multi-zone problems.
4 * The subroutines and functions are in the <i>driver_structure.cpp</i> file.
5 * \author T. Economon, H. Kline, R. Sanchez
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/geometry/CGeometry.hpp"
32#include "../../../Common/include/parallelization/mpi_structure.hpp"
33#include "../integration/CIntegration.hpp"
34#include "../interfaces/CInterface.hpp"
35#include "../solvers/CSolver.hpp"
36#include "CDriverBase.hpp"
37
38using namespace std;
39
40class CInterpolator;
41class CIteration;
42class COutput;
43
44/*!
45 * \class CDriver
46 * \ingroup Drivers
47 * \brief Parent class for driving an iteration of a single or multi-zone problem.
48 * \author T. Economon
49 */
50
51class CDriver : public CDriverBase {
52 protected:
54 UsedTimeOutput; /*!< \brief Elapsed time between Start and Stop point of the timer for tracking output phase.*/
55
57 0.0; /*!< \brief Aggregate value of the bandwidth for writing restarts (to be average later).*/
58 unsigned long IterCount, /*!< \brief Iteration count stored for performance benchmarking.*/
59 OutputCount; /*!< \brief Output count stored for performance benchmarking.*/
60 unsigned long DOFsPerPoint; /*!< \brief Number of unknowns at each vertex, i.e., number of equations solved. */
61 su2double Mpoints; /*!< \brief Total number of grid points in millions in the calculation (including ghost points).*/
63 MpointsDomain; /*!< \brief Total number of grid points in millions in the calculation (excluding ghost points).*/
64 su2double MDOFs; /*!< \brief Total number of DOFs in millions in the calculation (including ghost points).*/
65 su2double MDOFsDomain; /*!< \brief Total number of DOFs in millions in the calculation (excluding ghost points).*/
66
67 bool StopCalc, /*!< \brief Stop computation flag.*/
68 mixingplane, /*!< \brief mixing-plane simulation flag.*/
69 fsi, /*!< \brief FSI simulation flag.*/
70 fem_solver; /*!< \brief FEM fluid solver simulation flag. */
71
72 CFreeFormDefBox*** FFDBox; /*!< \brief FFD FFDBoxes of the problem. */
73
74 CIteration*** iteration_container; /*!< \brief Container vector with all the iteration methods. */
75 CIntegration**** integration_container; /*!< \brief Container vector with all the integration methods. */
76 vector<vector<unique_ptr<CInterpolator>>>
77 interpolator_container; /*!< \brief Definition of the interpolation method between non-matching discretizations of
78 the interface. */
79 CInterface*** interface_container; /*!< \brief Definition of the interface of information and physics. */
80 unsigned short** interface_types; /*!< \brief Type of coupling between the distinct (physical) zones. */
81 bool dry_run; /*!< \brief Flag if SU2_CFD was started as dry-run via "SU2_CFD -d <config>.cfg" */
82
83 public:
84 /*!
85 * \brief Constructor of the class.
86 * \param[in] confFile - Configuration file name.
87 * \param[in] val_nZone - Total number of zones.
88 * \param[in] MPICommunicator - MPI communicator for SU2.
89 * \param[in] dummy_geo - Dummy geometric definition of the problem.
90 */
91 CDriver(char* confFile, unsigned short val_nZone, SU2_Comm MPICommunicator, bool dummy_geo);
92
93 /*!
94 * \brief Destructor of the class.
95 */
96 ~CDriver(void) override;
97
98 /*!
99 * \brief A virtual member.
100 */
101 void Run() override{};
102
103 protected:
104 /*!
105 * \brief Initialize containers.
106 */
108
109 /*!
110 * \brief Read in the config and mesh files.
111 * \param[in] config - Definition of the particular problem.
112 * \param[in] driver_config - Definition of the driver configuration.
113 */
114 void PreprocessInput(CConfig**& config, CConfig*& driver_config);
115
116 /*!
117 * \brief Construction of the edge-based data structure and the multi-grid structure.
118 * \param[in] config - Definition of the particular problem.
119 * \param[in] geometry - Geometrical definition of the problem.
120 * \param[in] dummy - Definition of the dummy driver.
121 */
122 void InitializeGeometry(CConfig* config, CGeometry**& geometry, bool dummy);
123
124 /*!
125 * \brief Do the geometrical preprocessing for the DG FEM solver.
126 * \param[in] config - Definition of the particular problem.
127 * \param[in] geometry - Geometrical definition of the problem.
128 */
129 void InitializeGeometryDGFEM(CConfig* config, CGeometry**& geometry);
130
131 /*!
132 * \brief InitializeGeometryFVM
133 * \param[in] config - Definition of the particular problem.
134 * \param[in] geometry - Geometrical definition of the problem.
135 */
136 void InitializeGeometryFVM(CConfig* config, CGeometry**& geometry);
137
138 /*!
139 * \brief Definition of the physics iteration class or within a single zone.
140 * \param[in] config - Definition of the particular problem.
141 * \param[in] iteration - Pointer to the iteration container to be instantiated.
142 */
143 void PreprocessIteration(CConfig* config, CIteration*& iteration) const;
144
145 /*!
146 * \brief Definition and allocation of all solution classes.
147 * \param[in] config - Definition of the particular problem.
148 * \param[in] geometry - Geometrical definition of the problem.
149 * \param[in] solver - Container vector with all the solutions.
150 */
151 void InitializeSolver(CConfig* config, CGeometry** geometry, CSolver***& solver);
152
153 /*!
154 * \brief Preprocess the inlets via file input for all solvers.
155 * \param[in] solver_container - Container vector with all the solutions.
156 * \param[in] geometry - Geometrical definition of the problem.
157 * \param[in] config - Definition of the particular problem.
158 */
159 void PreprocessInlet(CSolver*** solver, CGeometry** geometry, CConfig* config) const;
160
161 /*!
162 * \brief Restart of the solvers from the restart files.
163 * \param[in] solver - Container vector with all the solutions.
164 * \param[in] geometry - Geometrical definition of the problem.
165 * \param[in] config - Definition of the particular problem.
166 * \param[in] update_geo - Boolean to indicate if geometry should be updated.
167 */
168 void RestartSolver(CSolver*** solver, CGeometry** geometry, CConfig* config, bool update_geo);
169
170 /*!
171 * \brief Definition and allocation of all solution classes.
172 * \param[in] solver - Container vector with all the solutions.
173 * \param[in] geometry - Geometrical definition of the problem.
174 * \param[in] config - Definition of the particular problem.
175 * \param[in] val_iInst - Current solver instance.
176 */
177 void FinalizeSolver(CSolver**** solver, CGeometry** geometry, CConfig* config, unsigned short val_iInst);
178
179 /*!
180 * \brief Definition and allocation of all integration classes.
181 * \param[in] config - Definition of the particular problem.
182 * \param[in] solver - Container vector with all the solutions.
183 * \param[in] integration - Container vector with all the integration methods.
184 */
185 void InitializeIntegration(CConfig* config, CSolver** solver, CIntegration**& integration) const;
186
187 /*!
188 * \brief Definition and allocation of all integration classes.
189 * \param[in] integration - Container vector with all the integration methods.
190 * \param[in] geometry - Geometrical definition of the problem.
191 * \param[in] config - Definition of the particular problem.
192 * \param[in] val_iInst - Current solver instance.
193 */
194 void FinalizeIntegration(CIntegration*** integration, CGeometry** geometry, CConfig* config,
195 unsigned short val_iInst);
196
197 /*!
198 * \brief Definition and allocation of all interface classes.
199 * \param[in] config - Definition of the particular problem.
200 * \param[in] solver - Container vector with all the solutions.
201 * \param[in] geometry - Geometrical definition of the problem.
202 * \param[in] interface_types - Type of coupling between the distinct (physical) zones.
203 * \param[in] interface - Class defining the physical transfer of information.
204 * \param[in] interpolation - Object defining the interpolation.
205 */
206 void InitializeInterface(CConfig** config, CSolver***** solver, CGeometry**** geometry,
207 unsigned short** interface_types, CInterface*** interface,
208 vector<vector<unique_ptr<CInterpolator>>>& interpolation);
209
210 /*!
211 * \brief Definition and allocation of all solver classes.
212 * \param[in] config - Definition of the particular problem.
213 * \param[in] geometry - Geometrical definition of the problem.
214 * \param[in] solver - Container vector with all the solutions.
215 * \param[in] numerics - Description of the numerical method (the way in which the equations are solved).
216 */
217 void InitializeNumerics(CConfig* config, CGeometry** geometry, CSolver*** solver, CNumerics****& numerics) const;
218
219 /*!
220 * \brief Helper to instantiate turbulence numerics specialized for different flow solvers.
221 */
222 template <class FlowIndices>
223 void InstantiateTurbulentNumerics(unsigned short nVar_Turb, int offset, const CConfig* config,
224 const CSolver* turb_solver, CNumerics****& numerics) const;
225
226 /*!
227 * \brief Helper to instantiate transition numerics specialized for different flow solvers.
228 */
229 template <class FlowIndices>
230 void InstantiateTransitionNumerics(unsigned short nVar_Trans, int offset, const CConfig* config,
231 const CSolver* trans_solver, CNumerics****& numerics) const;
232 /*!
233 * \brief Helper to instantiate species transport numerics specialized for different flow solvers.
234 */
235 template <class FlowIndices>
236 void InstantiateSpeciesNumerics(unsigned short nVar_Species, int offset, const CConfig* config,
237 const CSolver* species_solver, CNumerics****& numerics) const;
238
239 /*!
240 * \brief Definition and allocation of all solver classes.
241 * \param[in] numerics - Description of the numerical method (the way in which the equations are solved).
242 * \param[in] solver - Container vector with all the solutions.
243 * \param[in] geometry - Geometrical definition of the problem.
244 * \param[in] config - Definition of the particular problem.
245 * \param[in] val_iInst - Current solver instance.
246 */
247 void FinalizeNumerics(CNumerics***** numerics, CSolver*** solver, CGeometry** geometry, CConfig* config,
248 unsigned short val_iInst);
249
250 /*!
251 * \brief GridMovement_Preprocessing
252 * \param[in] config - Definition of the particular problem.
253 * \param[in] geometry - Geometrical definition of the problem.
254 * \param[in] solver - Container vector with all the solutions.
255 * \param[in] iteration - Container vector with all the iteration methods.
256 * \param[in] grid_movement - Volume grid movement classes of the problem.
257 * \param[in] surface_movement - Surface movement classes of the problem.
258 */
259 void PreprocessDynamicMesh(CConfig* config, CGeometry** geometry, CSolver*** solver, CIteration* iteration,
261
262 /*!
263 * \brief Initialize Python interface functionalities. When using multigrid,
264 * it is important to call this after modifying custom boundary values.
265 * \param[in] config - Definition of the particular problem.
266 * \param[in] geometry - Geometrical definition of the problem.
267 * \param[in] solver - Container vector with all the solutions.
268 */
269 void PreprocessPythonInterface(CConfig** config, CGeometry**** geometry, CSolver***** solver);
270
271 /*!
272 * \brief Preprocess the output container.
273 * \param[in] config - Definition of the particular problem.
274 * \param[in] driver_config - Definition of the driver configuration.
275 * \param[in] output_container - Container vector with all the outputs.
276 * \param[in] driver_output - Definition of the driver output.
277 */
280
281 /*!
282 * \brief Initiate value for static mesh movement such as the gridVel for the ROTATING frame.
283 * \param[in] config - Definition of the particular problem.
284 * \param[in] geometry - Geometrical definition of the problem.
285 */
286 void PreprocessStaticMesh(const CConfig* config, CGeometry** geometry);
287
288 /*!
289 * \brief Initiate value for static mesh movement such as the gridVel for the ROTATING frame.
290 * \param[in] config - Definition of the particular problem.
291 * \param[in] geometry - Geometrical definition of the problem.
292 * \param[in] solver - Container vector with all the solutions.
293 * \param[in] interface - Class defining the physical transfer of information.
294 * \param[in] iteration - Class defining the iteration strcuture.
295 * \param[in] dummy - Definition of dummy driver
296 */
297 void PreprocessTurbomachinery(CConfig** config, CGeometry**** geometry, CSolver***** solver,
298 CInterface*** interface, CIteration*** iteration, bool dummy);
299
300 void PreprocessTurboVertex(CConfig** config, CGeometry**** geometry, CSolver***** solver,
301 CInterface*** interface, CIteration*** iteration, bool dummy);
302
303 /*!
304 * \brief A virtual member.
305 * \param[in] donorZone - zone in which the displacements will be predicted.
306 * \param[in] targetZone - zone which receives the predicted displacements.
307 */
308 virtual void PredictDisplacements(unsigned short donorZone, unsigned short targetZone) {}
309
310 /*!
311 * \brief A virtual member.
312 * \param[in] donorZone - zone in which the tractions will be predicted.
313 * \param[in] targetZone - zone which receives the predicted traction.
314 */
315 virtual void PredictTractions(unsigned short donorZone, unsigned short targetZone) {}
316
317 /*!
318 * \brief A virtual member.
319 * \param[in] donorZone - zone in which the displacements will be transferred.
320 * \param[in] targetZone - zone which receives the tractions transferred.
321 */
322 virtual void TransferDisplacements(unsigned short donorZone, unsigned short targetZone) {}
323
324 /*!
325 * \brief A virtual member.
326 * \param[in] donorZone - zone from which the tractions will be transferred.
327 * \param[in] targetZone - zone which receives the tractions transferred.
328 */
329 virtual void TransferTractions(unsigned short donorZone, unsigned short targetZone) {}
330
331 /*!
332 * \brief A virtual member.
333 * \param[in] donorZone - origin of the information.
334 * \param[in] targetZone - destination of the information.
335 * \param[in] iOuterIter - Fluid-Structure Interaction subiteration.
336 */
337 virtual void RelaxationDisplacements(unsigned short donorZone, unsigned short targetZone, unsigned long iOuterIter) {}
338
339 /*!
340 * \brief A virtual member.
341 * \param[in] donorZone - origin of the information.
342 * \param[in] targetZone - destination of the information.
343 * \param[in] iOuterIter - Fluid-Structure Interaction subiteration.
344 */
345 virtual void RelaxationTractions(unsigned short donorZone, unsigned short targetZone, unsigned long iOuterIter) {}
346
347 /*!
348 * \brief Print out the direct residuals.
349 * \param[in] kind_recording - Type of recording (full list in ENUM_RECORDING, option_structure.hpp)
350 */
351 void PrintDirectResidual(RECORDING kind_recording);
352
353 public:
354 /*!
355 * \brief Set the solution of all solvers (adjoint or primal) in a zone.
356 * \param[in] iZone - Index of the zone.
357 * \param[in] adjoint - True to consider adjoint solvers instead of primal.
358 * \param[in] solution - Solution object with interface (iPoint,iVar).
359 * \tparam Old - If true set "old solutions" instead.
360 */
361 template <class Container, bool Old = false>
362 void SetAllSolutions(unsigned short iZone, bool adjoint, const Container& solution) {
363 const auto nPoint = geometry_container[iZone][INST_0][MESH_0]->GetnPoint();
364 for (auto iSol = 0u, offset = 0u; iSol < MAX_SOLS; ++iSol) {
365 auto solver = solver_container[iZone][INST_0][MESH_0][iSol];
366 if (!solver || solver->GetAdjoint() != adjoint) continue;
367 for (auto iPoint = 0ul; iPoint < nPoint; ++iPoint)
368 for (auto iVar = 0ul; iVar < solver->GetnVar(); ++iVar)
369 if (!Old) {
370 solver->GetNodes()->SetSolution(iPoint, iVar, solution(iPoint, offset + iVar));
371 } else {
372 solver->GetNodes()->SetSolution_Old(iPoint, iVar, solution(iPoint, offset + iVar));
373 }
374 offset += solver->GetnVar();
375 }
376 }
377
378 /*!
379 * \brief Set the "old solution" of all solvers (adjoint or primal) in a zone.
380 */
381 template <class Container>
382 void SetAllSolutionsOld(unsigned short iZone, bool adjoint, const Container& solution) {
383 SetAllSolutions<Container, true>(iZone, adjoint, solution);
384 }
385
386 /*!
387 * \brief Get the solution of all solvers (adjoint or primal) in a zone.
388 * \param[in] iZone - Index of the zone.
389 * \param[in] adjoint - True to consider adjoint solvers instead of primal.
390 * \param[out] solution - Solution object with interface (iPoint,iVar).
391 */
392 template <class Container>
393 void GetAllSolutions(unsigned short iZone, bool adjoint, Container& solution) const {
394 const auto nPoint = geometry_container[iZone][INST_0][MESH_0]->GetnPoint();
395 for (auto iSol = 0u, offset = 0u; iSol < MAX_SOLS; ++iSol) {
396 auto solver = solver_container[iZone][INST_0][MESH_0][iSol];
397 if (!solver || solver->GetAdjoint() != adjoint) continue;
398 const auto& sol = solver->GetNodes()->GetSolution();
399 for (auto iPoint = 0ul; iPoint < nPoint; ++iPoint)
400 for (auto iVar = 0ul; iVar < solver->GetnVar(); ++iVar)
401 solution(iPoint, offset + iVar) = SU2_TYPE::GetValue(sol(iPoint, iVar));
402 offset += solver->GetnVar();
403 }
404 }
405
406 /*!
407 * \brief Sum the number of primal or adjoint variables for all solvers in a given zone.
408 * \param[in] iZone - Index of the zone.
409 * \param[in] adjoint - True to consider adjoint solvers instead of primal.
410 * \return Total number of solution variables.
411 */
412 unsigned short GetTotalNumberOfVariables(unsigned short iZone, bool adjoint) const {
413 unsigned short nVar = 0;
414 for (auto iSol = 0u; iSol < MAX_SOLS; iSol++) {
415 auto solver = solver_container[iZone][INST_0][MESH_0][iSol];
416 if (solver && (solver->GetAdjoint() == adjoint)) nVar += solver->GetnVar();
417 }
418 return nVar;
419 }
420
421 /*!
422 * \brief Launch the computation for all zones and all physics.
423 */
424 virtual void StartSolver() {}
425
426 /*!
427 * \brief Deallocation routine
428 */
429 void Finalize() override;
430
431 /*!
432 * \brief Perform some pre-processing before an iteration of the physics.
433 */
434 virtual void Preprocess(unsigned long TimeIter) {}
435
436 /*!
437 * \brief Monitor the computation.
438 */
439 virtual bool Monitor(unsigned long TimeIter) { return false; }
440
441 /*!
442 * \brief Output the solution in solution file.
443 */
444 virtual void Output(unsigned long TimeIter) {}
445
446 /*!
447 * \brief Perform a dynamic mesh deformation, including grid velocity computation and update of the multi-grid
448 * structure.
449 */
450 virtual void DynamicMeshUpdate(unsigned long TimeIter) {}
451
452 /*!
453 * \brief Update the dual-time solution.
454 */
455 virtual void Update() {}
456
457 /*!
458 * \brief Perform a mesh deformation as initial condition.
459 */
460 virtual void SetInitialMesh() {}
461
462/// \addtogroup PySU2
463/// \{
464
465 /*!
466 * \brief Process the boundary conditions and update the multi-grid structure.
467 */
469
470 /*!
471 * \brief Get the number of time iterations.
472 * \return Number of time iterations.
473 */
474 unsigned long GetNumberTimeIter() const;
475
476 /*!
477 * \brief Get the current time iteration.
478 * \return Current time iteration.
479 */
480 unsigned long GetTimeIter() const;
481
482 /*!
483 * \brief Get the unsteady time step.
484 * \return Unsteady time step.
485 */
487
488 /*!
489 * \brief Get the name of the output file for the surface.
490 * \return File name for the surface output.
491 */
492 string GetSurfaceFileName() const;
493
494 /*!
495 * \brief Set the position of the heat source.
496 * \param[in] alpha - Angle of rotation respect to Z axis.
497 * \param[in] pos_x - Position X.
498 * \param[in] pos_y - Position Y.
499 * \param[in] pos_z - Position Z.
500 */
502
503 /*!
504 * \brief Set the direction of the inlet.
505 * \param[in] iMarker - Marker index.
506 * \param[in] alpha - Angle around z axis.
507 */
508 void SetInletAngle(unsigned short iMarker, passivedouble alpha);
509
510 /*!
511 * \brief Set the angle of attack of the farfield.
512 * \param[in] alpha - Angle (degree).
513 */
514 void SetFarFieldAoA(passivedouble alpha);
515
516 /*!
517 * \brief Set the angle of sideslip of the farfield.
518 * \param[in] beta - Angle (degree).
519 */
520 void SetFarFieldAoS(passivedouble beta);
521
522 /*!
523 * \brief Set the dynamic mesh translation rates.
524 * \param[in] xDot - Value of translational velocity in x-direction.
525 * \param[in] yDot - Value of translational velocity in y-direction.
526 * \param[in] zDot - Value of translational velocity in z-direction.
527 */
529
530 /*!
531 * \brief Set the dynamic mesh rotation rates.
532 * \param[in] rot_x - Value of Angular velocity about x-axes.
533 * \param[in] rot_y - Value of Angular velocity about y-axes.
534 * \param[in] rot_z - Value of Angular velocity about z-axes.
535 */
537
538 /*!
539 * \brief Set the moving wall marker rotation rates.
540 * \param[in] iMaker - Index of moving wall marker.
541 * \param[in] rot_x - Value of Angular velocity about x-axes.
542 * \param[in] rot_y - Value of Angular velocity about y-axes.
543 * \param[in] rot_z - Value of Angular velocity about z-axes.
544 */
545 void SetMarkerRotationRate(unsigned short iMarker, passivedouble rot_x, passivedouble rot_y, passivedouble rot_z);
546
547 /*!
548 * \brief Set the moving wall marker translation rates.
549 * \param[in] iMaker - Index of moving wall marker.
550 * \param[in] vel_x - Value of velocity along x-axis.
551 * \param[in] vel_y - Value of velocity along y-axis.
552 * \param[in] vel_z - Value of velocity along z-axis.
553 */
554 void SetMarkerTranslationRate(unsigned short iMarker, passivedouble vel_x, passivedouble vel_y, passivedouble vel_z);
555
556 /*!
557 * \brief Get the Freestream Density for nondimensionalization
558 * \return Freestream Density
559 */
561
562 /*!
563 * \brief Get the reference Body force for nondimensionalization
564 * \return reference Body Force
565 */
567
568
569/// \}
570};
571
572/*!
573 * \class CFluidDriver
574 * \ingroup Drivers
575 * \brief Class for driving an iteration of the physics within multiple zones.
576 * \author T. Economon, G. Gori
577 */
578class CFluidDriver : public CDriver {
579 protected:
580 unsigned long Max_Iter;
581
582 /*!
583 * \brief Constructor of the class.
584 * \param[in] confFile - Configuration file name.
585 * \param[in] val_nZone - Total number of zones.
586 * \param[in] MPICommunicator - MPI communicator for SU2.
587 */
588 CFluidDriver(char* confFile, unsigned short val_nZone, SU2_Comm MPICommunicator);
589
590 /*!
591 * \brief Transfer data among different zones (multiple zone).
592 */
593 void TransferData(unsigned short donorZone, unsigned short targetZone);
594
595 public:
596 /*!
597 * \brief Destructor of the class.
598 */
599 ~CFluidDriver(void) override;
600
601 /*!
602 * \brief Launch the computation for all zones and all physics.
603 */
604 void StartSolver() override;
605
606 /*!
607 * \brief Run a single iteration of the physics within multiple zones.
608 */
609 void Run() override;
610
611 /*!
612 * \brief Update the dual-time solution within multiple zones.
613 */
614 void Update() override;
615
616 /*!
617 * \brief Output the solution in solution file.
618 */
619 void Output(unsigned long InnerIter) override;
620
621 /*!
622 * \brief Monitor the computation.
623 */
624 bool Monitor(unsigned long ExtIter) override;
625
626 /*!
627 * \brief Perform some pre-processing before an iteration of the physics.
628 */
629 void Preprocess(unsigned long Iter) override;
630
631 /*!
632 * \brief Perform a dynamic mesh deformation, included grid velocity computation and the update of the multi-grid
633 * structure (multiple zone).
634 */
635 void DynamicMeshUpdate(unsigned long TimeIter) override;
636};
637
638/*!
639 * \class CHBDriver
640 * \ingroup Drivers
641 * \brief Class for driving an iteration of Harmonic Balance (HB) method problem using multiple time zones.
642 * \author T. Economon
643 */
644class CHBDriver : public CFluidDriver {
645 private:
646 unsigned short nInstHB;
647 su2double** D; /*!< \brief Harmonic Balance operator. */
648
649 /*!
650 * \brief Computation and storage of the Harmonic Balance method source terms.
651 * \author T. Economon, K. Naik
652 * \param[in] iZone - Current zone number.
653 */
654 void SetHarmonicBalance(unsigned short iZone);
655
656 /*!
657 * \brief Precondition Harmonic Balance source term for stability
658 * \author J. Howison
659 */
660 void StabilizeHarmonicBalance();
661
662 /*!
663 * \brief Computation of the Harmonic Balance operator matrix for harmonic balance.
664 * \author A. Rubino, S. Nimmagadda
665 */
666 void ComputeHBOperator();
667
668 public:
669 /*!
670 * \brief Constructor of the class.
671 * \param[in] confFile - Configuration file name.
672 * \param[in] val_nZone - Total number of zones.
673 * \param[in] MPICommunicator - MPI communicator for SU2.
674 */
675 CHBDriver(char* confFile, unsigned short val_nZone, SU2_Comm MPICommunicator);
676
677 /*!
678 * \brief Destructor of the class.
679 */
680 ~CHBDriver(void) override;
681
682 /*!
683 * \brief Run a single iteration of a Harmonic Balance problem.
684 */
685 void Run() override;
686
687 /*!
688 * \brief Update the solution for the Harmonic Balance.
689 */
690 void Update() override;
691};
Base class for all drivers.
Main class for defining the problem; basically this class reads the configuration file,...
Definition CConfig.hpp:64
Base class for all drivers.
Definition CDriverBase.hpp:43
CSolver ***** solver_container
Container vector with all the solutions.
Definition CDriverBase.hpp:71
COutput * driver_output
Definition of the driver output.
Definition CDriverBase.hpp:66
CConfig * driver_config
Definition of the driver configuration.
Definition CDriverBase.hpp:65
CVolumetricMovement *** grid_movement
Volume grid movement classes of the problem.
Definition CDriverBase.hpp:75
CSurfaceMovement ** surface_movement
Surface movement classes of the problem.
Definition CDriverBase.hpp:74
unsigned long TimeIter
Definition CDriverBase.hpp:56
CGeometry **** geometry_container
Geometrical definition of the problem.
Definition CDriverBase.hpp:70
unsigned short iZone
Iterator on zones.
Definition CDriverBase.hpp:59
COutput ** output_container
Pointer to the COutput class.
Definition CDriverBase.hpp:69
Parent class for driving an iteration of a single or multi-zone problem.
Definition CDriver.hpp:51
void GetAllSolutions(unsigned short iZone, bool adjoint, Container &solution) const
Get the solution of all solvers (adjoint or primal) in a zone.
Definition CDriver.hpp:393
unsigned short GetTotalNumberOfVariables(unsigned short iZone, bool adjoint) const
Sum the number of primal or adjoint variables for all solvers in a given zone.
Definition CDriver.hpp:412
void FinalizeNumerics(CNumerics *****numerics, CSolver ***solver, CGeometry **geometry, CConfig *config, unsigned short val_iInst)
Definition and allocation of all solver classes.
Definition CDriver.cpp:2332
void InitializeGeometry(CConfig *config, CGeometry **&geometry, bool dummy)
Construction of the edge-based data structure and the multi-grid structure.
Definition CDriver.cpp:591
virtual void Preprocess(unsigned long TimeIter)
Perform some pre-processing before an iteration of the physics.
Definition CDriver.hpp:434
void PreprocessDynamicMesh(CConfig *config, CGeometry **geometry, CSolver ***solver, CIteration *iteration, CVolumetricMovement *&grid_movement, CSurfaceMovement *&surface_movement) const
GridMovement_Preprocessing.
Definition CDriver.cpp:2361
virtual void TransferDisplacements(unsigned short donorZone, unsigned short targetZone)
A virtual member.
Definition CDriver.hpp:322
virtual void DynamicMeshUpdate(unsigned long TimeIter)
Perform a dynamic mesh deformation, including grid velocity computation and update of the multi-grid ...
Definition CDriver.hpp:450
bool dry_run
Flag if SU2_CFD was started as dry-run via "SU2_CFD -d <config>.cfg".
Definition CDriver.hpp:81
su2double MDOFs
Total number of DOFs in millions in the calculation (including ghost points).
Definition CDriver.hpp:64
~CDriver(void) override
Destructor of the class.
CFreeFormDefBox *** FFDBox
FFD FFDBoxes of the problem.
Definition CDriver.hpp:72
void PreprocessPythonInterface(CConfig **config, CGeometry ****geometry, CSolver *****solver)
Initialize Python interface functionalities. When using multigrid, it is important to call this after...
Definition python_wrapper_structure.cpp:32
virtual void PredictTractions(unsigned short donorZone, unsigned short targetZone)
A virtual member.
Definition CDriver.hpp:315
virtual void Output(unsigned long TimeIter)
Output the solution in solution file.
Definition CDriver.hpp:444
virtual void StartSolver()
Launch the computation for all zones and all physics.
Definition CDriver.hpp:424
void SetAllSolutionsOld(unsigned short iZone, bool adjoint, const Container &solution)
Set the "old solution" of all solvers (adjoint or primal) in a zone.
Definition CDriver.hpp:382
void InitializeIntegration(CConfig *config, CSolver **solver, CIntegration **&integration) const
Definition and allocation of all integration classes.
Definition CDriver.cpp:1223
su2double MpointsDomain
Total number of grid points in millions in the calculation (excluding ghost points).
Definition CDriver.hpp:63
CInterface *** interface_container
Definition of the interface of information and physics.
Definition CDriver.hpp:79
void FinalizeIntegration(CIntegration ***integration, CGeometry **geometry, CConfig *config, unsigned short val_iInst)
Definition and allocation of all integration classes.
Definition CDriver.cpp:1235
void PreprocessStaticMesh(const CConfig *config, CGeometry **geometry)
Initiate value for static mesh movement such as the gridVel for the ROTATING frame.
Definition CDriver.cpp:2564
CIteration *** iteration_container
Container vector with all the iteration methods.
Definition CDriver.hpp:74
su2double UsedTimeOutput
Elapsed time between Start and Stop point of the timer for tracking output phase.
Definition CDriver.hpp:54
void InitializeNumerics(CConfig *config, CGeometry **geometry, CSolver ***solver, CNumerics ****&numerics) const
Definition and allocation of all solver classes.
Definition CDriver.cpp:1404
void PrintDirectResidual(RECORDING kind_recording)
Print out the direct residuals.
Definition CDriver.cpp:2763
void PreprocessTurboVertex(CConfig **config, CGeometry ****geometry, CSolver *****solver, CInterface ***interface, CIteration ***iteration, bool dummy)
Definition CDriver.cpp:2649
unsigned long IterCount
Iteration count stored for performance benchmarking.
Definition CDriver.hpp:58
virtual void Update()
Update the dual-time solution.
Definition CDriver.hpp:455
bool mixingplane
mixing-plane simulation flag.
Definition CDriver.hpp:68
void InstantiateTurbulentNumerics(unsigned short nVar_Turb, int offset, const CConfig *config, const CSolver *turb_solver, CNumerics ****&numerics) const
Helper to instantiate turbulence numerics specialized for different flow solvers.
Definition CDriver.cpp:1247
void PreprocessInput(CConfig **&config, CConfig *&driver_config)
Read in the config and mesh files.
Definition CDriver.cpp:538
void InitializeInterface(CConfig **config, CSolver *****solver, CGeometry ****geometry, unsigned short **interface_types, CInterface ***interface, vector< vector< unique_ptr< CInterpolator > > > &interpolation)
Definition and allocation of all interface classes.
Definition CDriver.cpp:2404
void PreprocessTurbomachinery(CConfig **config, CGeometry ****geometry, CSolver *****solver, CInterface ***interface, CIteration ***iteration, bool dummy)
Initiate value for static mesh movement such as the gridVel for the ROTATING frame.
Definition CDriver.cpp:2682
su2double MDOFsDomain
Total number of DOFs in millions in the calculation (excluding ghost points).
Definition CDriver.hpp:65
void Finalize() override
Deallocation routine.
Definition CDriver.cpp:338
bool StopCalc
Stop computation flag.
Definition CDriver.hpp:67
void InstantiateTransitionNumerics(unsigned short nVar_Trans, int offset, const CConfig *config, const CSolver *trans_solver, CNumerics ****&numerics) const
Helper to instantiate transition numerics specialized for different flow solvers.
Definition CDriver.cpp:1321
void SetAllSolutions(unsigned short iZone, bool adjoint, const Container &solution)
Set the solution of all solvers (adjoint or primal) in a zone.
Definition CDriver.hpp:362
unsigned short ** interface_types
Type of coupling between the distinct (physical) zones.
Definition CDriver.hpp:80
virtual void SetInitialMesh()
Perform a mesh deformation as initial condition.
Definition CDriver.hpp:460
virtual bool Monitor(unsigned long TimeIter)
Monitor the computation.
Definition CDriver.hpp:439
void FinalizeSolver(CSolver ****solver, CGeometry **geometry, CConfig *config, unsigned short val_iInst)
Definition and allocation of all solution classes.
Definition CDriver.cpp:1208
bool fsi
FSI simulation flag.
Definition CDriver.hpp:69
CIntegration **** integration_container
Container vector with all the integration methods.
Definition CDriver.hpp:75
su2double BandwidthSum
Aggregate value of the bandwidth for writing restarts (to be average later).
Definition CDriver.hpp:56
virtual void RelaxationDisplacements(unsigned short donorZone, unsigned short targetZone, unsigned long iOuterIter)
A virtual member.
Definition CDriver.hpp:337
su2double Mpoints
Total number of grid points in millions in the calculation (including ghost points).
Definition CDriver.hpp:61
unsigned long DOFsPerPoint
Number of unknowns at each vertex, i.e., number of equations solved.
Definition CDriver.hpp:60
virtual void RelaxationTractions(unsigned short donorZone, unsigned short targetZone, unsigned long iOuterIter)
A virtual member.
Definition CDriver.hpp:345
void PreprocessOutput(CConfig **config, CConfig *driver_config, COutput **&output_container, COutput *&driver_output)
Preprocess the output container.
Definition CDriver.cpp:2610
bool fem_solver
FEM fluid solver simulation flag.
Definition CDriver.hpp:70
void InstantiateSpeciesNumerics(unsigned short nVar_Species, int offset, const CConfig *config, const CSolver *species_solver, CNumerics ****&numerics) const
Helper to instantiate species transport numerics specialized for different flow solvers.
Definition CDriver.cpp:1363
unsigned long OutputCount
Output count stored for performance benchmarking.
Definition CDriver.hpp:59
void PreprocessInlet(CSolver ***solver, CGeometry **geometry, CConfig *config) const
Preprocess the inlets via file input for all solvers.
Definition CDriver.cpp:1081
void PreprocessIteration(CConfig *config, CIteration *&iteration) const
Definition of the physics iteration class or within a single zone.
Definition CDriver.cpp:2351
virtual void PredictDisplacements(unsigned short donorZone, unsigned short targetZone)
A virtual member.
Definition CDriver.hpp:308
void InitializeSolver(CConfig *config, CGeometry **geometry, CSolver ***&solver)
Definition and allocation of all solution classes.
Definition CDriver.cpp:1049
void Run() override
A virtual member.
Definition CDriver.hpp:101
void RestartSolver(CSolver ***solver, CGeometry **geometry, CConfig *config, bool update_geo)
Restart of the solvers from the restart files.
Definition CDriver.cpp:1153
void InitializeGeometryFVM(CConfig *config, CGeometry **&geometry)
InitializeGeometryFVM.
Definition CDriver.cpp:679
void InitializeGeometryDGFEM(CConfig *config, CGeometry **&geometry)
Do the geometrical preprocessing for the DG FEM solver.
Definition CDriver.cpp:956
vector< vector< unique_ptr< CInterpolator > > > interpolator_container
Definition of the interpolation method between non-matching discretizations of the interface.
Definition CDriver.hpp:77
virtual void TransferTractions(unsigned short donorZone, unsigned short targetZone)
A virtual member.
Definition CDriver.hpp:329
void InitializeContainers()
Initialize containers.
Definition CDriver.cpp:291
Class for driving an iteration of the physics within multiple zones.
Definition CDriver.hpp:578
void Preprocess(unsigned long Iter) override
Perform some pre-processing before an iteration of the physics.
Definition CDriver.cpp:2933
~CFluidDriver(void) override
Destructor of the class.
void DynamicMeshUpdate(unsigned long TimeIter) override
Perform a dynamic mesh deformation, included grid velocity computation and the update of the multi-gr...
Definition CDriver.cpp:3049
void TransferData(unsigned short donorZone, unsigned short targetZone)
Transfer data among different zones (multiple zone).
Definition CDriver.cpp:3021
bool Monitor(unsigned long ExtIter) override
Monitor the computation.
Definition CDriver.cpp:3064
unsigned long Max_Iter
Definition CDriver.hpp:580
void Run() override
Run a single iteration of the physics within multiple zones.
Definition CDriver.cpp:2961
void StartSolver() override
Launch the computation for all zones and all physics.
Definition CDriver.cpp:2880
void Update() override
Update the dual-time solution within multiple zones.
Definition CDriver.cpp:3040
void Output(unsigned long InnerIter) override
Output the solution in solution file.
Definition CDriver.cpp:3088
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
unsigned long GetnPoint() const
Get number of points.
Definition CGeometry.hpp:587
Class for driving an iteration of Harmonic Balance (HB) method problem using multiple time zones.
Definition CDriver.hpp:644
~CHBDriver(void) override
Destructor of the class.
Definition CDriver.cpp:3120
void Update() override
Update the solution for the Harmonic Balance.
Definition CDriver.cpp:3154
void Run() override
Run a single iteration of a Harmonic Balance problem.
Definition CDriver.cpp:3131
Main class for doing the space integration, time integration, and monitoring of a system of Partial D...
Definition CIntegration.hpp:47
Main class for defining the physical transfer of information.
Definition CInterface.hpp:60
Main class for defining the interpolator, it requires a child class for each particular interpolation...
Definition CInterpolator.hpp:47
Parent class for defining a single iteration of a physics problem.
Definition CIteration.hpp:50
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
unsigned short GetnVar(void) const
Get the number of variables of the problem.
Definition CSolver.hpp:416
CVariable * GetNodes()
Allow outside access to the nodes of the solver, containing conservatives, primitives,...
Definition CSolver.hpp:229
Class for moving the surface numerical grid.
Definition CSurfaceMovement.hpp:38
void SetSolution(unsigned long iPoint, const su2double *solution)
Set the value of the solution, all variables.
Definition CVariable.hpp:198
su2double GetSolution(unsigned long iPoint, unsigned long iVar) const
Get the solution.
Definition CVariable.hpp:248
Class for moving the volumetric numerical grid.
Definition CVolumetricMovement.hpp:37
double passivedouble
Definition code_config.hpp:129
passivedouble su2double
Definition code_config.hpp:181
void SetFarFieldAoA(passivedouble alpha)
Set the angle of attack of the farfield.
Definition python_wrapper_structure.cpp:104
passivedouble GetDensityFreeStreamND() const
Get the Freestream Density for nondimensionalization.
Definition python_wrapper_structure.cpp:61
void SetMarkerRotationRate(unsigned short iMarker, passivedouble rot_x, passivedouble rot_y, passivedouble rot_z)
Set the moving wall marker rotation rates.
Definition python_wrapper_structure.cpp:170
unsigned long GetNumberTimeIter() const
Get the number of time iterations.
Definition python_wrapper_structure.cpp:59
void SetHeatSourcePosition(passivedouble alpha, passivedouble pos_x, passivedouble pos_y, passivedouble pos_z)
Set the position of the heat source.
Definition python_wrapper_structure.cpp:81
void SetMarkerTranslationRate(unsigned short iMarker, passivedouble vel_x, passivedouble vel_y, passivedouble vel_z)
Set the moving wall marker translation rates.
Definition python_wrapper_structure.cpp:176
passivedouble GetUnsteadyTimeStep() const
Get the unsteady time step.
Definition python_wrapper_structure.cpp:71
void BoundaryConditionsUpdate()
Process the boundary conditions and update the multi-grid structure.
Definition python_wrapper_structure.cpp:143
unsigned long GetTimeIter() const
Get the current time iteration.
Definition python_wrapper_structure.cpp:69
passivedouble GetForceRef() const
Get the reference Body force for nondimensionalization.
Definition python_wrapper_structure.cpp:65
void SetRotationRate(passivedouble rot_x, passivedouble rot_y, passivedouble rot_z)
Set the dynamic mesh rotation rates.
Definition python_wrapper_structure.cpp:164
void SetInletAngle(unsigned short iMarker, passivedouble alpha)
Set the direction of the inlet.
Definition python_wrapper_structure.cpp:91
string GetSurfaceFileName() const
Get the name of the output file for the surface.
Definition python_wrapper_structure.cpp:75
void SetTranslationRate(passivedouble xDot, passivedouble yDot, passivedouble zDot)
Set the dynamic mesh translation rates.
Definition python_wrapper_structure.cpp:158
void SetFarFieldAoS(passivedouble beta)
Set the angle of sideslip of the farfield.
Definition python_wrapper_structure.cpp:109
int SU2_Comm
Definition mpi_structure.hpp:619
passivedouble GetValue(const su2double &data)
Get the (primitive) value of the datatype (needs to be specialized for active types).
Definition datatype_structure.hpp:113
const unsigned int INST_0
Definition of the first instance per grid level.
Definition option_structure.hpp:92
@ MAX_SOLS
Definition option_structure.hpp:80
const unsigned int MESH_0
Definition of the finest grid level.
Definition option_structure.hpp:88
RECORDING
Definition option_structure.hpp:2820