Documentation 6b54b78464
Loading...
Searching...
No Matches
CSolverFactory.hpp
Go to the documentation of this file.
1/*!
2 * \file CSolverFactory.hpp
3 * \brief Headers of the CSolverFactory class
4 * \author T. Albring
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#pragma once
28
29#include "../../../Common/include/option_structure.hpp"
30
31/*!
32 * \brief Enum of different sub solvers the main solver can use. There is not a 1-to-1 correspondence between the actual classes
33 * and the types of sub solvers, as one class can be used for several sub solvers.
34 */
35enum class SUB_SOLVER_TYPE {
36 CONT_ADJ_EULER, /*!< \brief Continuous Adjoint Euler solver */
37 CONT_ADJ_NAVIER_STOKES, /*!< \brief Continuous Adjoint Navier Stokes solver */
38 CONT_ADJ_TURB, /*!< \brief Continuous Adjoint Turbulent solver */
39 BASELINE, /*!< \brief Baseline solver */
40 TEMPLATE, /*!< \brief Template solver */
41 BASELINE_FEM, /*!< \brief Baseline FEM solver */
42 DISC_ADJ_FEA, /*!< \brief Discrete adjoint FEA solver */
43 DISC_ADJ_MESH, /*!< \brief Discrete adjoint mesh solver */
44 DISC_ADJ_FLOW, /*!< \brief Discrete adjoint flow solver */
45 DISC_ADJ_TURB, /*!< \brief Discrete adjoint turbulence solver */
46 DISC_ADJ_SPECIES, /*!< \brief Discrete adjoint species solver */
47 DISC_ADJ_HEAT, /*!< \brief Discrete adjoint heat solver */
48 EULER, /*!< \brief Compressible Euler solver */
49 NAVIER_STOKES, /*!< \brief Compressible Navier-Stokes solver */
50 NEMO_EULER, /*!< \brief NEMO Euler solver */
51 NEMO_NAVIER_STOKES, /*!< \brief NEMO Navier-Stokes solver */
52 INC_EULER, /*!< \brief Incompressible Euler solver */
53 INC_NAVIER_STOKES, /*!< \brief Incompressible Navier-stokes solver */
54 FEA, /*!< \brief Structural Finite-Element solver */
55 DG_EULER, /*!< \brief Higher-order DG Euler solver*/
56 DG_NAVIER_STOKES, /*!< \brief Higher-order DG Navier-Stokes solver*/
57 HEAT, /*!< \brief Heat solver */
58 TRANSITION, /*!< \brief Transition model solver*/
59 TURB_SA, /*!< \brief SA turbulence model solver */
60 TURB_SST, /*!< \brief SST turbulence model solver */
61 TURB, /*!< \brief Turbulence model solver */
62 SPECIES, /*!< \brief Species model solver */
63 MESH, /*!< \brief Mesh solver */
64 RADIATION, /*!< \brief Radiation solver */
65 DISC_ADJ_RADIATION, /*!< \brief Discrete adjoint radiation solver */
66 POISSON, /*!< \brief Poisson equation solver */
67 NONE
68};
69
72 NEWTON,
74 DEFAULT,
75 FEM_DG,
77 NONE
78};
79
84
85class CSolver;
86class CGeometry;
87class CConfig;
88
90
91private:
92
93 static std::map<const CSolver*, SolverMetaData> allocatedSolvers;
94
95 /*!
96 * \brief Create a turbulent solver
97 * \param[in] kindTurbModel - Kind of turbulent solver
98 * \param[in] solver - The solver container (used to call preprocessing of the flow solver)
99 * \param[in] geometry - The geometry definition
100 * \param[in] config - The configuration
101 * \param[in] iMGLevel - The multigrid level
102 * \param[in] adjoint - Boolean indicating whether a primal or adjoint solver should be allocated
103 * \return - A pointer to the allocated turbulent solver
104 */
105 static CSolver* CreateTurbSolver(TURB_MODEL kindTurbModel, CSolver **solver, CGeometry *geometry, CConfig *config, int iMGLevel, int adjoint);
106
107 /*!
108 * \brief Create a transition solver
109 * \param[in] kindTransModel - Kind of transition solver
110 * \param[in] solver - The solver container (used to call preprocessing of the flow solver)
111 * \param[in] geometry - The geometry definition
112 * \param[in] config - The configuration
113 * \param[in] iMGLevel - The multigrid level
114 * \param[in] adjoint - Boolean indicating whether a primal or adjoint solver should be allocated
115 * \return - A pointer to the allocated transition solver
116 */
117 static CSolver* CreateTransSolver(TURB_TRANS_MODEL kindTransModel , CSolver **solver, CGeometry *geometry, CConfig *config, int iMGLevel, int adjoint);
118
119 /*!
120 * \brief Create a species solver
121 * \param[in] solver - The solver container
122 * \param[in] geometry - The geometry definition
123 * \param[in] config - The configuration
124 * \param[in] iMGLevel - The multigrid level
125 * \param[in] adjoint - Boolean indicating whether a primal or adjoint solver should be allocated
126 * \return - A pointer to the allocated species solver
127 */
128 static CSolver* CreateSpeciesSolver(CSolver **solver, CGeometry *geometry, CConfig *config, int iMGLevel, bool adjoint);
129
130 /*!
131 * \brief Create a heat solver
132 * \param[in] solver - The solver container
133 * \param[in] geometry - The geometry definition
134 * \param[in] config - The configuration
135 * \param[in] iMGLevel - The multigrid level
136 * \param[in] adjoint - Boolean indicating whether a primal or adjoint solver should be allocated
137 * \return - A pointer to the allocated heat solver
138 */
139 static CSolver* CreateHeatSolver(CSolver **solver, CGeometry *geometry, CConfig *config, int iMGLevel, bool adjoint);
140
141 /*!
142 * \brief Create a mesh solver
143 * \param[in] solver - The solver container
144 * \param[in] geometry - The geometry definition
145 * \param[in] config - The configuration
146 * \param[in] iMGLevel - The multigrid level
147 * \param[in] adjoint - Boolean indicating whether a primal or adjoint solver should be allocated
148 * \return - A pointer to the allocated mesh solver
149 */
150 static CSolver* CreateMeshSolver(CSolver **solver, CGeometry *geometry, CConfig *config, int iMGLevel, bool adjoint);
151
152 /*!
153 * \brief Create a DG solver
154 * \param[in] kindTurbModel - Kind of DG solver
155 * \param[in] geometry - The geometry definition
156 * \param[in] config - The configuration
157 * \param[in] iMGLevel - The multigrid level
158 * \return - A pointer to the allocated DG solver
159 */
160 static CSolver* CreateDGSolver(SUB_SOLVER_TYPE kindDGSolver, CGeometry *geometry, CConfig *config, int iMGLevel);
161
162 /*!
163 * \brief Create a flow solver
164 * \param[in] kindFlowSolver - Kind of flow solver
165 * \param[in] solver - The solver container
166 * \param[in] geometry - The geometry definition
167 * \param[in] config - The configuration
168 * \param[in] iMGLevel - The multigrid level
169 * \return - A pointer to the allocated flow solver
170 */
171 static CSolver* CreateFlowSolver(SUB_SOLVER_TYPE kindFlowSolver, CSolver **solver, CGeometry *geometry, CConfig *config, int iMGLevel);
172
173 /*!
174 * \brief Generic routine to create a solver
175 * \param[in] kindSolver - Kind of solver
176 * \param[in] solver - The solver container
177 * \param[in] geometry - The geometry definition
178 * \param[in] config - The configuration
179 * \param[in] iMGLevel - The multigrid level
180 * \return - A pointer to the allocated solver
181 */
182 static CSolver* CreateSubSolver(SUB_SOLVER_TYPE kindSolver, CSolver **solver, CGeometry *geometry, CConfig *config, int iMGLevel);
183
184public:
185
186 /*!
187 * \brief Deleted constructor to avoid creating instances of this class
188 */
189 CSolverFactory() = delete;
190
191 /*!
192 * \brief Create the solver container by allocating the primary solver
193 * and secondary solvers like heat solver, turbulent solver etc
194 * \param[in] kindSolver - The kind of primary solver
195 * \param[in] config - The configuration
196 * \param[in] geometry - The geometry definition
197 * \param[in] iMGLevel - The multigrid level
198 * \return - Pointer to the allocated solver array
199 */
200 static CSolver** CreateSolverContainer(MAIN_SOLVER kindSolver, CConfig *config, CGeometry *geometry, int iMGLevel);
201
202
203 /*!
204 * \brief Return a sub solver object that contains information about the solver allocated at a specific memory address
205 * \param[in] solver - Address of the solver
206 * \return sub solver info struct.
207 */
208 static SolverMetaData GetSolverMeta(const CSolver* solver) { return allocatedSolvers.at(solver); }
209
210 /*!
211 * \brief Clear the solver meta data
212 */
213 static void ClearSolverMeta() { allocatedSolvers.clear(); }
214
215};
SUB_SOLVER_TYPE
Enum of different sub solvers the main solver can use. There is not a 1-to-1 correspondence between t...
Definition CSolverFactory.hpp:35
@ TURB_SA
SA turbulence model solver.
@ CONT_ADJ_TURB
Continuous Adjoint Turbulent solver
@ HEAT
Heat solver.
@ DISC_ADJ_FEA
Discrete adjoint FEA solver
@ CONT_ADJ_EULER
Continuous Adjoint Euler solver
@ BASELINE_FEM
Baseline FEM solver.
@ BASELINE
Baseline solver
@ TURB
Turbulence model solver.
@ FEA
Structural Finite-Element solver.
@ DG_NAVIER_STOKES
Higher-order DG Navier-Stokes solver.
@ NAVIER_STOKES
Compressible Navier-Stokes solver.
@ DISC_ADJ_SPECIES
Discrete adjoint species solver.
@ DISC_ADJ_RADIATION
Discrete adjoint radiation solver.
@ MESH
Mesh solver.
@ TRANSITION
Transition model solver.
@ TURB_SST
SST turbulence model solver.
@ NEMO_NAVIER_STOKES
NEMO Navier-Stokes solver.
@ EULER
Compressible Euler solver.
@ INC_EULER
Incompressible Euler solver.
@ TEMPLATE
Template solver
@ POISSON
Poisson equation solver.
@ DG_EULER
Higher-order DG Euler solver.
@ DISC_ADJ_MESH
Discrete adjoint mesh solver.
@ SPECIES
Species model solver.
@ DISC_ADJ_HEAT
Discrete adjoint heat solver.
@ INC_NAVIER_STOKES
Incompressible Navier-stokes solver.
@ DISC_ADJ_TURB
Discrete adjoint turbulence solver.
@ RADIATION
Radiation solver.
@ CONT_ADJ_NAVIER_STOKES
Continuous Adjoint Navier Stokes solver
@ DISC_ADJ_FLOW
Discrete adjoint flow solver.
@ NEMO_EULER
NEMO Euler solver.
INTEGRATION_TYPE
Definition CSolverFactory.hpp:70
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
Definition CSolverFactory.hpp:89
static CSolver ** CreateSolverContainer(MAIN_SOLVER kindSolver, CConfig *config, CGeometry *geometry, int iMGLevel)
Create the solver container by allocating the primary solver and secondary solvers like heat solver,...
Definition CSolverFactory.cpp:60
CSolverFactory()=delete
Deleted constructor to avoid creating instances of this class.
static void ClearSolverMeta()
Clear the solver meta data.
Definition CSolverFactory.hpp:213
static SolverMetaData GetSolverMeta(const CSolver *solver)
Return a sub solver object that contains information about the solver allocated at a specific memory ...
Definition CSolverFactory.hpp:208
Definition CSolver.hpp:71
TURB_MODEL
Types of turbulent models.
Definition option_structure.hpp:1066
MAIN_SOLVER
different solver types for the CFD component
Definition option_structure.hpp:302
TURB_TRANS_MODEL
Types of transition models.
Definition option_structure.hpp:1363
Definition CSolverFactory.hpp:80
INTEGRATION_TYPE integrationType
Definition CSolverFactory.hpp:82
SUB_SOLVER_TYPE solverType
Definition CSolverFactory.hpp:81