Documentation 6b54b78464
Loading...
Searching...
No Matches
CSpeciesSolver.hpp
Go to the documentation of this file.
1/*!
2 * \file CSpeciesSolver.hpp
3 * \brief Headers of the CSpeciesSolver class
4 * \author T. Kattmann.
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 "../../../Common/include/parallelization/omp_structure.hpp"
31#include "../variables/CSpeciesVariable.hpp"
32#include "CScalarSolver.hpp"
33
34/*!
35 * \brief Main class for defining the species transport solver.
36 * \author T. Kattmann.
37 * \ingroup Scalar_Transport
38 */
39class CSpeciesSolver : public CScalarSolver<CSpeciesVariable> {
40 protected:
41 unsigned short Inlet_Position; /*!< \brief Column index for scalar variables in inlet files. */
42 vector<su2activematrix> Inlet_SpeciesVars; /*!< \brief Species variables at inlet profiles. */
43 vector<su2activematrix> Wall_SpeciesVars; /*!< \brief Species variables at profiles. */
44 vector<su2matrix<su2double>> CustomBoundaryScalar;
45
46 /*!
47 * \brief Resolve the compile-time parameters of CScalarFlux_Species and run one of this solver's
48 * boundaries through the shared boundary flux pass.
49 * \param[in] opt - Flags of the boundary, from one of ScalarFluxOptions' named constructors.
50 */
51 void BoundaryFlux(CGeometry* geometry, CSolver** solver_container, CConfig* config, const ScalarFluxOptions& opt,
52 unsigned short val_marker);
53
54 public:
55 /*!
56 * \brief Constructor of the class.
57 */
59
60 /*!
61 * \brief Constructor of the class.
62 * \param[in] geometry - Geometrical definition of the problem.
63 * \param[in] config - Definition of the particular problem.
64 * \param[in] iMesh - Index of the mesh in multigrid computations.
65 */
66 CSpeciesSolver(CGeometry* geometry, CConfig* config, const CSolver* flow_solver, unsigned short iMesh);
67
68 /*!
69 * \brief Load a solution from a restart file.
70 * \param[in] geometry - Geometrical definition of the problem.
71 * \param[in] solver - Container vector with all of the solvers.
72 * \param[in] config - Definition of the particular problem.
73 * \param[in] val_iter - Current external iteration number.
74 * \param[in] val_update_geo - Flag for updating coords and grid velocity.
75 */
76 void LoadRestart(CGeometry** geometry, CSolver*** solver, CConfig* config, int val_iter, bool val_update_geo) final;
77
78 void Initialize(CGeometry* geometry, CConfig* config, unsigned short iMesh, unsigned short nVar);
79
80 /*!
81 * \brief Restart residual and compute gradients.
82 * \param[in] geometry - Geometrical definition of the problem.
83 * \param[in] solver_container - Container vector with all the solutions.
84 * \param[in] config - Definition of the particular problem.
85 * \param[in] iMesh - Index of the mesh in multigrid computations.
86 * \param[in] iRKStep - Current step of the Runge-Kutta iteration.
87 * \param[in] RunTime_EqSystem - System of equations which is going to be solved.
88 * \param[in] Output - boolean to determine whether to print output.
89 */
90 void Preprocessing(CGeometry* geometry, CSolver** solver_container, CConfig* config, unsigned short iMesh,
91 unsigned short iRKStep, unsigned short RunTime_EqSystem, bool Output) override;
92
93 /*!
94 * \brief Compute the spatial integration using the CScalarFlux_Species edge kernel, which
95 * computes and writes both the convective and the diffusive term of every edge.
96 * \param[in] geometry - Geometrical definition of the problem.
97 * \param[in] solver_container - Container vector with all the solutions.
98 * \param[in] numerics_container - Unused, kept only for the boundary conditions.
99 * \param[in] config - Definition of the particular problem.
100 * \param[in] iMesh - Index of the mesh in multigrid computations.
101 */
102 void Upwind_Residual(CGeometry* geometry, CSolver** solver_container, CNumerics** numerics_container,
103 CConfig* config, unsigned short iMesh) override;
104
105 /*!
106 * \brief Impose the inlet boundary condition.
107 * \param[in] geometry - Geometrical definition of the problem.
108 * \param[in] solver_container - Container vector with all the solutions.
109 * \param[in] conv_numerics - Description of the numerical method.
110 * \param[in] visc_numerics - Description of the numerical method.
111 * \param[in] config - Definition of the particular problem.
112 * \param[in] val_marker - Surface marker where the boundary condition is applied.
113 */
114 void BC_Inlet(CGeometry* geometry, CSolver** solver_container, CNumerics* conv_numerics, CNumerics* visc_numerics,
115 CConfig* config, unsigned short val_marker) override;
116
117 /*!
118 * \brief Store of a set of provided inlet profile values at a vertex.
119 * \param[in] val_inlet - vector containing the inlet values for the current vertex.
120 * \param[in] iMarker - Surface marker where the coefficient is computed.
121 * \param[in] iVertex - Vertex of the marker <i>iMarker</i> where the inlet is being set.
122 */
123 void SetInletAtVertex(const su2double* val_inlet, unsigned short iMarker, unsigned long iVertex) override;
124
125 /*!
126 * \brief Get the set of values imposed at an inlet.
127 * \param[in] iMarker - Index of the surface marker.
128 * \param[in] iVertex - Vertex of the marker <i>iMarker</i> where the inlet is being set.
129 * \param[in] geometry - Geometrical definition of the problem.
130 * \param[in,out] val_inlet - vector returning the inlet values for the current vertex.
131 * \return Value of the face area at the vertex.
132 */
133 su2double GetInletAtVertex(unsigned short iMarker, unsigned long iVertex,
134 const CGeometry* geometry, su2double* val_inlet) const override;
135
136 /*!
137 * \brief Set a uniform inlet profile
138 *
139 * The values at the inlet are set to match the values specified for
140 * inlets in the configuration file.
141 *
142 * \param[in] config - Definition of the particular problem.
143 * \param[in] iMarker - Surface marker where the coefficient is computed.
144 */
145 void SetUniformInlet(const CConfig* config, unsigned short iMarker) final;
146
147 /*!
148 * \brief Impose the outlet boundary condition.
149 * \param[in] geometry - Geometrical definition of the problem.
150 * \param[in] solver_container - Container vector with all the solutions.
151 * \param[in] conv_numerics - Description of the numerical method.
152 * \param[in] visc_numerics - Description of the numerical method.
153 * \param[in] config - Definition of the particular problem.
154 * \param[in] val_marker - Surface marker where the boundary condition is applied.
155 */
156 void BC_Outlet(CGeometry* geometry, CSolver** solver_container, CNumerics* conv_numerics, CNumerics* visc_numerics,
157 CConfig* config, unsigned short val_marker) final;
158
159 /*!
160 * \brief Impose the far-field boundary condition, via the CScalarFlux_Species edge kernel.
161 * \param[in] geometry - Geometrical definition of the problem.
162 * \param[in] solver_container - Container vector with all the solutions.
163 * \param[in] conv_numerics - Unused, kept only for the boundary condition dispatch.
164 * \param[in] visc_numerics - Unused, kept only for the boundary condition dispatch.
165 * \param[in] config - Definition of the particular problem.
166 * \param[in] val_marker - Surface marker where the boundary condition is applied.
167 */
168 void BC_Far_Field(CGeometry* geometry, CSolver** solver_container, CNumerics* conv_numerics,
169 CNumerics* visc_numerics, CConfig* config, unsigned short val_marker) final;
170
171 /*!
172 * \brief Impose the isothermal wall Dirichlet boundary condition (value).
173 * \param[in] geometry - Geometrical definition of the problem.
174 * \param[in] solver_container - Container vector with all the solutions.
175 * \param[in] conv_numerics - Description of the numerical method.
176 * \param[in] visc_numerics - Description of the numerical method.
177 * \param[in] config - Definition of the particular problem.
178 * \param[in] val_marker - Surface marker where the boundary condition is applied.
179 */
180 void BC_Isothermal_Wall(CGeometry* geometry, CSolver** solver_container,
181 CNumerics* conv_numerics, CNumerics* visc_numerics,
182 CConfig* config, unsigned short val_marker) override;
183
184 /*!
185 * \brief Impose the heat flux Neumann wall boundary condition (flux).
186 * \param[in] geometry - Geometrical definition of the problem.
187 * \param[in] solver_container - Container vector with all the solutions.
188 * \param[in] conv_numerics - Description of the numerical method.
189 * \param[in] visc_numerics - Description of the numerical method.
190 * \param[in] config - Definition of the particular problem.
191 * \param[in] val_marker - Surface marker where the boundary condition is applied.
192 */
193 void BC_HeatFlux_Wall(CGeometry* geometry, CSolver** solver_container,
194 CNumerics* conv_numerics, CNumerics* visc_numerics,
195 CConfig* config, unsigned short val_marker) override;
196
197 /*!
198 * \brief Generic wall boundary condition implementation.
199 * \param[in] geometry - Geometrical definition of the problem.
200 * \param[in] solver_container - Container vector with all the solutions.
201 * \param[in] config - Definition of the particular problem.
202 * \param[in] val_marker - Surface marker where the boundary condition is applied.
203 */
204 void BC_Wall_Generic(CGeometry* geometry, CSolver** solver_container,
205 CConfig* config, unsigned short val_marker);
206
207 /*--- Note that BC_Sym_Plane, BC_HeatFlux_Wall, BC_Isothermal_Wall are all treated as zero-flux BC for the
208 * mass-factions, which can be fulfilled by no additional residual contribution on these nodes.
209 * If a specified mass-fractions flux (like BC_HeatFlux_Wall) or a constant mass-fraction on the boundary
210 * (like BC_Isothermal_Wall) are implemented the respective CHeatSolver implementations can act as a starting
211 * point ---*/
212
213 /*!
214 * \brief Source term computation for axisymmetric flow.
215 * \param[in] geometry - Geometrical definition of the problem.
216 * \param[in] solver_container - Container vector with all the solutions.
217 * \param[in] numerics_container - Container for description of the numerical method.
218 * \param[in] config - Definition of the particular problem.
219 * \param[in] iMesh - Index of the mesh in multigrid computations.
220 */
221 void Source_Residual(CGeometry* geometry, CSolver** solver_container, CNumerics** numerics_container, CConfig* config,
222 unsigned short iMesh) override;
223
224 /*!
225 * \brief Set the initial condition for the Species transport problem.
226 * \param[in] geometry - Geometrical definition of the problem.
227 * \param[in] solver_container - Container with all the solutions.
228 * \param[in] config - Definition of the particular problem.
229 * \param[in] TimeIter - Time iteration.
230 */
231 void SetInitialCondition(CGeometry **geometry,
232 CSolver ***solver_container,
233 CConfig *config,
234 unsigned long TimeIter) override;
235
236 /*!
237 * \brief Impose the fluid interface (sliding mesh) boundary condition, via the
238 * CScalarFlux_Species edge kernel. The convective term is a per-donor weighted average,
239 * computed in the same pass that fills the ghost row of each donor; the diffusive term is
240 * computed once per vertex, after the donor loop, from the interior point's own
241 * diffusivity mirrored into the ghost row, so both sides of the edge diffuse with it.
242 * \param[in] geometry - Geometrical definition of the problem.
243 * \param[in] solver_container - Container vector with all the solutions.
244 * \param[in] conv_numerics - Unused, kept only for the boundary condition dispatch.
245 * \param[in] visc_numerics - Unused, kept only for the boundary condition dispatch.
246 * \param[in] config - Definition of the particular problem.
247 */
248 void BC_Fluid_Interface(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics,
249 CNumerics *visc_numerics, CConfig *config) final;
250
251 /*!
252 * \brief Set custom boundary scalar values from Python.
253 * \param[in] val_marker - Boundary marker index
254 * \param[in] val_vertex - Boundary vertex index
255 * \param[in] val_customBoundaryScalar - Vector of scalar values
256 */
257 inline void SetCustomBoundaryScalar(unsigned short val_marker, unsigned long val_vertex,
258 vector<passivedouble> val_customBoundaryScalar) final {
259 for (auto iVar = 0u; iVar < nVar; iVar++) {
260 CustomBoundaryScalar[val_marker](val_vertex, iVar) = val_customBoundaryScalar[iVar];
261 }
262 }
263
264};
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 a scalar solver.
Definition CScalarSolver.hpp:59
Definition CSolver.hpp:71
unsigned short nVar
Number of variables of the problem.
Definition CSolver.hpp:85
Main class for defining the species transport solver.
Definition CSpeciesSolver.hpp:39
unsigned short Inlet_Position
Column index for scalar variables in inlet files.
Definition CSpeciesSolver.hpp:41
void Source_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics **numerics_container, CConfig *config, unsigned short iMesh) override
Source term computation for axisymmetric flow.
Definition CSpeciesSolver.cpp:617
CSpeciesSolver()
Constructor of the class.
void BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) override
Impose the heat flux Neumann wall boundary condition (flux).
Definition CSpeciesSolver.cpp:418
void BC_Wall_Generic(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short val_marker)
Generic wall boundary condition implementation.
Definition CSpeciesSolver.cpp:425
void Initialize(CGeometry *geometry, CConfig *config, unsigned short iMesh, unsigned short nVar)
Definition CSpeciesSolver.cpp:103
void LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig *config, int val_iter, bool val_update_geo) final
Load a solution from a restart file.
Definition CSpeciesSolver.cpp:202
vector< su2activematrix > Inlet_SpeciesVars
Species variables at inlet profiles.
Definition CSpeciesSolver.hpp:42
void BC_Outlet(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) final
Impose the outlet boundary condition.
Definition CSpeciesSolver.cpp:524
void BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) override
Impose the isothermal wall Dirichlet boundary condition (value).
Definition CSpeciesSolver.cpp:411
void SetUniformInlet(const CConfig *config, unsigned short iMarker) final
Set a uniform inlet profile.
Definition CSpeciesSolver.cpp:502
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 CSpeciesSolver.cpp:316
void SetInitialCondition(CGeometry **geometry, CSolver ***solver_container, CConfig *config, unsigned long TimeIter) override
Set the initial condition for the Species transport problem.
Definition CSpeciesSolver.cpp:675
void Upwind_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics **numerics_container, CConfig *config, unsigned short iMesh) override
Compute the spatial integration using the CScalarFlux_Species edge kernel, which computes and writes ...
Definition CSpeciesSolver.cpp:342
void BC_Far_Field(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) final
Impose the far-field boundary condition, via the CScalarFlux_Species edge kernel.
Definition CSpeciesSolver.cpp:575
vector< su2matrix< su2double > > CustomBoundaryScalar
Definition CSpeciesSolver.hpp:44
su2double GetInletAtVertex(unsigned short iMarker, unsigned long iVertex, const CGeometry *geometry, su2double *val_inlet) const override
Get the set of values imposed at an inlet.
Definition CSpeciesSolver.cpp:489
void SetCustomBoundaryScalar(unsigned short val_marker, unsigned long val_vertex, vector< passivedouble > val_customBoundaryScalar) final
Set custom boundary scalar values from Python.
Definition CSpeciesSolver.hpp:257
void BC_Fluid_Interface(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config) final
Impose the fluid interface (sliding mesh) boundary condition, via the CScalarFlux_Species edge kernel...
Definition CSpeciesSolver.cpp:595
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 CSpeciesSolver.cpp:362
void SetInletAtVertex(const su2double *val_inlet, unsigned short iMarker, unsigned long iVertex) override
Store of a set of provided inlet profile values at a vertex.
Definition CSpeciesSolver.cpp:479
vector< su2activematrix > Wall_SpeciesVars
Species variables at profiles.
Definition CSpeciesSolver.hpp:43
void BoundaryFlux(CGeometry *geometry, CSolver **solver_container, CConfig *config, const ScalarFluxOptions &opt, unsigned short val_marker)
Resolve the compile-time parameters of CScalarFlux_Species and run one of this solver's boundaries th...
Definition CSpeciesSolver.cpp:355
passivedouble su2double
Definition code_config.hpp:181
Loop invariant flags for a scalar edge flux, built once outside the edge loop so the compiler can uns...
Definition scalar_edge_flux.hpp:55