Documentation 6b54b78464
Loading...
Searching...
No Matches
CPoissonSolver.hpp
Go to the documentation of this file.
1/*!
2 * \file CPoissonSolver.hpp
3 * \brief Headers of the CPoissonSolver class
4 * \author T. Aalbers
5 * \version 8.5.0 "Harrier"
6 *
7 * SU2 Project Website: https://su2code.github.io
8 *
9 * The SU2 Project is maintained by the SU2 Foundation
10 * (http://su2foundation.org)
11 *
12 * Copyright 2012-2026, SU2 Contributors (cf. AUTHORS.md)
13 *
14 * SU2 is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Lesser General Public
16 * License as published by the Free Software Foundation; either
17 * version 2.1 of the License, or (at your option) any later version.
18 *
19 * SU2 is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Lesser General Public License for more details.
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with SU2. If not, see <http://www.gnu.org/licenses/>.
26 */
27
28#pragma once
29
30#include "CScalarSolver.hpp"
31#include "../variables/CPoissonVariable.hpp"
32
33/*!
34 * \class CPoissonSolver
35 * \brief Main class for defining the finite-volume poisson equation solver.
36 * \author T. Aalbers
37 * \version 8.5.0 "Harrier"
38 */
39class CPoissonSolver final : public CScalarSolver<CPoissonVariable> {
40protected:
41 static constexpr size_t MAXNDIM = 3; /*!< \brief Max number of space dimensions, used in some static arrays. */
42 static constexpr size_t MAXNVAR = 1; /*!< \brief Max number of variables, for static arrays. */
43
44public:
45
46 /*
47 * \overload
48 * \param[in] geometry - Geometrical definition of the problem
49 * \param[in] config - Definition of the particular problem
50 */
51 CPoissonSolver(CGeometry *geometry, CConfig *config, unsigned short iMesh);
52
53 /*!
54 * \brief Restart residual and compute gradients.
55 * \param[in] geometry - Geometrical definition of the problem.
56 * \param[in] solver_container - Container vector with all the solutions.
57 * \param[in] config - Definition of the particular problem.
58 * \param[in] iMesh - Index of the mesh in multigrid computations.
59 * \param[in] iRKStep - Current step of the Runge-Kutta iteration.
60 * \param[in] RunTime_EqSystem - System of equations which is going to be solved.
61 * \param[in] Output - boolean to determine whether to print output.
62 */
63 void Preprocessing(CGeometry *geometry,
64 CSolver **solver_container,
65 CConfig *config,
66 unsigned short iMesh,
67 unsigned short iRKStep,
68 unsigned short RunTime_EqSystem,
69 bool Output) override;
70
71 /*!
72 * \brief Correct the pressure and velocities for the flow solution
73 * \param[in] geometry - Geometrical definition of the problem.
74 * \param[in] solver_container - Container vector with all the solutions.
75 * \param[in] config - Definition of the particular problem.
76 * \param[in] iMesh - Index of the mesh in multigrid computations.
77 */
78 void Postprocessing(CGeometry *geometry,
79 CSolver **solver_container,
80 CConfig *config,
81 unsigned short iMesh) final;
82
83 /*!
84 * \brief Compute the diffusion of the pressure correction, through the CScalarFlux_Poisson
85 * edge kernel; the equation has no convective term, see Upwind_Residual.
86 * \param[in] geometry - Geometrical definition of the problem.
87 * \param[in] solver_container - Container vector with all the solutions.
88 * \param[in] config - Definition of the particular problem.
89 * \param[in] iMesh - Index of the mesh in multigrid computations.
90 * \param[in] iRKStep - Current step of the Runge-Kutta iteration.
91 */
92 void Viscous_Residual(CGeometry *geometry,
93 CSolver **solver_container,
94 CNumerics **numerics_container,
95 CConfig *config,
96 unsigned short iMesh,
97 unsigned short iRKStep) override;
98
99 /*!
100 * \brief Source term computation.
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 */
107 void Source_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics **numerics_container,
108 CConfig *config, unsigned short iMesh) override;
109
110 /*!
111 * \brief No upwind residual for poisson equation.
112 */
113 void Upwind_Residual(CGeometry* geometry, CSolver** solver_container, CNumerics** numerics_container,
114 CConfig* config, unsigned short iMesh) override {}
115
116 /*!
117 * \brief Update the solution using an implicit solver.
118 * \param[in] geometry - Geometrical definition of the problem.
119 * \param[in] solver_container - Container vector with all the solutions.
120 * \param[in] config - Definition of the particular problem.
121 */
122 void ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_container, CConfig *config) override;
123
124 /*!
125 * \brief No time step as it is a stationary problem
126 */
127 void SetTime_Step(CGeometry *geometry,
128 CSolver **solver_container,
129 CConfig *config,
130 unsigned short iMesh,
131 unsigned long Iteration) override {}
132
133 /*!
134 * \brief Add the change of density in time to the mass balance (variable density only).
135 * \param[in] geometry - Geometrical definition of the problem.
136 * \param[in] solver_container - Container vector with all the solutions.
137 * \param[in] config - Definition of the particular problem.
138 * \param[in] iRKStep - Current step of the Runge-Kutta iteration.
139 * \param[in] iMesh - Index of the mesh in multigrid computations.
140 * \param[in] RunTime_EqSystem - System of equations which is going to be solved.
141 */
142 void SetResidual_DualTime(CGeometry* geometry, CSolver** solver_container, CConfig* config, unsigned short iRKStep,
143 unsigned short iMesh, unsigned short RunTime_EqSystem) override;
144
145 /*!
146 * \brief The pressure correction is reset to zero every iteration (see Preprocessing), so it
147 * carries no state that a restart file needs to provide.
148 */
149 void LoadRestart(CGeometry** geometry, CSolver*** solver, CConfig* config, int val_iter,
150 bool val_update_geo) override {}
151
152 /*!
153 * \brief Compute the coefficients for the pressure correction equation based
154 * on the residuals from the solution of the momentum equation.
155 * \param[in] geometry - Geometrical definition of the problem.
156 * \param[in] solver_container - Container with all the solutions.
157 * \param[in] config - Definition of the particular problem.
158 * \param[in] periodic - Flag for periodic boundary conditions.
159 * \param[in] iMesh - Index of the mesh in multigrid computations.
160 */
161 void SetMomCoeff(CGeometry *geometry, CSolver **solver_container, CConfig *config, bool periodic, unsigned short iMesh) final;
162
163
164 /*!
165 * \brief Compute the HbyA based on the momentum correction to be used in second PISO
166 * correction equation.
167 * \param[in] geometry - Geometrical definition of the problem.
168 * \param[in] solver_container - Container with all the solutions.
169 * \param[in] config - Definition of the particular problem.
170 * \param[in] iMesh - Index of the mesh in multigrid computations.
171 */
172 void ComputeHbyA(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh) final;
173
174 /*!
175 * \brief Impose a constant heat-flux condition at the wall.
176 * \param[in] geometry - Geometrical definition of the problem.
177 * \param[in] solver_container - Container vector with all the solutions.
178 * \param[in] conv_numerics - Description of the numerical method.
179 * \param[in] visc_numerics - Description of the numerical method.
180 * \param[in] config - Definition of the particular problem.
181 * \param[in] val_marker - Surface marker where the boundary condition is applied.
182 */
183 void BC_HeatFlux_Wall(CGeometry *geometry,
184 CSolver **solver_container,
185 CNumerics *conv_numerics,
186 CNumerics *visc_numerics,
187 CConfig *config,
188 unsigned short val_marker) final;
189
190 /*!
191 * \brief A virtual member.
192 * \param[in] geometry - Geometrical definition of the problem.
193 * \param[in] solver_container - Container vector with all the solutions.
194 * \param[in] conv_numerics - Description of the numerical method.
195 * \param[in] visc_numerics - Description of the numerical method.
196 * \param[in] config - Definition of the particular problem.
197 * \param[in] val_marker - Surface marker where the boundary condition is applied.
198 */
199 void BC_Far_Field(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config,
200 unsigned short val_marker) final;
201
202 /*!
203 * \brief Impose the inlet boundary condition.
204 * \param[in] geometry - Geometrical definition of the problem.
205 * \param[in] solver_container - Container vector with all the solutions.
206 * \param[in] conv_numerics - Description of the numerical method.
207 * \param[in] visc_numerics - Description of the numerical method.
208 * \param[in] config - Definition of the particular problem.
209 * \param[in] val_marker - Surface marker where the boundary condition is applied.
210 */
211 void BC_Inlet(CGeometry *geometry,
212 CSolver **solver_container,
213 CNumerics *conv_numerics,
214 CNumerics *visc_numerics,
215 CConfig *config,
216 unsigned short val_marker) override;
217 /*!
218 * \brief Impose the outlet boundary condition.
219 * \param[in] geometry - Geometrical definition of the problem.
220 * \param[in] solver_container - Container vector with all the solutions.
221 * \param[in] conv_numerics - Description of the numerical method.
222 * \param[in] visc_numerics - Description of the numerical method.
223 * \param[in] config - Definition of the particular problem.
224 * \param[in] val_marker - Surface marker where the boundary condition is applied.
225 */
226 void BC_Outlet(CGeometry *geometry,
227 CSolver **solver_container,
228 CNumerics *conv_numerics,
229 CNumerics *visc_numerics,
230 CConfig *config,
231 unsigned short val_marker) override;
232
233};
Headers of the CScalarSolver class.
Main class for defining the problem; basically this class reads the configuration file,...
Definition CConfig.hpp:64
Parent class for defining the geometry of the problem (complete geometry, multigrid agglomerated geom...
Definition CGeometry.hpp:75
Class for defining the numerical methods.
Definition CNumerics.hpp:48
Main class for defining the finite-volume poisson equation solver.
Definition CPoissonSolver.hpp:39
void BC_Far_Field(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) final
A virtual member.
Definition CPoissonSolver.cpp:589
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 CPoissonSolver.cpp:619
static constexpr size_t MAXNVAR
Max number of variables, for static arrays.
Definition CPoissonSolver.hpp:42
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 CPoissonSolver.cpp:615
static constexpr size_t MAXNDIM
Max number of space dimensions, used in some static arrays.
Definition CPoissonSolver.hpp:41
void ComputeHbyA(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh) final
Compute the HbyA based on the momentum correction to be used in second PISO correction equation.
Definition CPoissonSolver.cpp:258
void Postprocessing(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh) final
Correct the pressure and velocities for the flow solution.
Definition CPoissonSolver.cpp:138
void BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) final
Impose a constant heat-flux condition at the wall.
Definition CPoissonSolver.cpp:585
void Source_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics **numerics_container, CConfig *config, unsigned short iMesh) override
Source term computation.
Definition CPoissonSolver.cpp:318
void SetMomCoeff(CGeometry *geometry, CSolver **solver_container, CConfig *config, bool periodic, unsigned short iMesh) final
Compute the coefficients for the pressure correction equation based on the residuals from the solutio...
Definition CPoissonSolver.cpp:155
void SetResidual_DualTime(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iRKStep, unsigned short iMesh, unsigned short RunTime_EqSystem) override
Add the change of density in time to the mass balance (variable density only).
Definition CPoissonSolver.cpp:492
void Viscous_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics **numerics_container, CConfig *config, unsigned short iMesh, unsigned short iRKStep) override
Compute the diffusion of the pressure correction, through the CScalarFlux_Poisson edge kernel; the eq...
Definition CPoissonSolver.cpp:305
void ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_container, CConfig *config) override
Update the solution using an implicit solver.
Definition CPoissonSolver.cpp:521
void SetTime_Step(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh, unsigned long Iteration) override
No time step as it is a stationary problem.
Definition CPoissonSolver.hpp:127
void Preprocessing(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh, unsigned short iRKStep, unsigned short RunTime_EqSystem, bool Output) override
Restart residual and compute gradients.
Definition CPoissonSolver.cpp:101
void Upwind_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics **numerics_container, CConfig *config, unsigned short iMesh) override
No upwind residual for poisson equation.
Definition CPoissonSolver.hpp:113
void LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig *config, int val_iter, bool val_update_geo) override
The pressure correction is reset to zero every iteration (see Preprocessing), so it carries no state ...
Definition CPoissonSolver.hpp:149
Main class for defining a scalar solver.
Definition CScalarSolver.hpp:59
Definition CSolver.hpp:71