Documentation 6b54b78464
Loading...
Searching...
No Matches
flow_sources.hpp
Go to the documentation of this file.
1/*!
2 * \file flow_sources.hpp
3 * \brief Declarations of numerics classes for source-term integration.
4 * \author F. Palacios, T. Economon
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 "../CNumerics.hpp"
31
32/*!
33 * \class CSourceBase_Flow
34 * \brief Intermediate source term class to allocate the internally
35 * stored residual and Jacobian. Not for stand alone use,
36 * just a helper to build more complicated classes.
37 * \ingroup SourceDiscr
38 */
40protected:
41 su2double* residual = nullptr;
42 su2double** jacobian = nullptr;
44
45 /*!
46 * \brief Constructor of the class.
47 * \param[in] val_nDim - Number of dimensions of the problem.
48 * \param[in] val_nVar - Number of variables of the problem.
49 * \param[in] config - Definition of the particular problem.
50 */
51 CSourceBase_Flow(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config);
52
53public:
54 /*!
55 * \brief Destructor of the class.
56 */
57 ~CSourceBase_Flow() override;
58
59 /*!
60 * \brief Set massflow, heatflow & inlet temperature for streamwise periodic flow.
61 * \param[in] SolverSPvals - Struct holding the values.
62 */
63 void SetStreamwisePeriodicValues(const StreamwisePeriodicValues SolverSPvals) final { SPvals = SolverSPvals; }
64
65};
66
67/*!
68 * \class CSourceAxisymmetric_Flow
69 * \brief Class for source term for solving axisymmetric problems.
70 * \ingroup SourceDiscr
71 * \author F. Palacios
72 */
74protected:
77
78 /*!
79 * \brief Diffusion residual of the axisymmetric source term.
80 */
81 void ResidualDiffusion();
82
83public:
84 /*!
85 * \brief Constructor of the class.
86 * \param[in] val_nDim - Number of dimensions of the problem.
87 * \param[in] val_nVar - Number of variables of the problem.
88 * \param[in] config - Definition of the particular problem.
89 */
90 CSourceAxisymmetric_Flow(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config);
91
92 /*!
93 * \brief Residual of the axisymmetric source term.
94 * \param[in] config - Definition of the particular problem.
95 * \return Lightweight const-view of residual and Jacobian.
96 */
97 ResidualType<> ComputeResidual(const CConfig* config) override;
98
99};
100
101/*!
102 * \class CSourceGeneralAxisymmetric_Flow
103 * \brief Class for source term for solving axisymmetric problems for a general (non ideal) fluid.
104 * \ingroup SourceDiscr
105 * \author F. Dittmann
106 */
108public:
109
111 /*!
112 * \brief Residual of the general axisymmetric source term.
113 * \param[in] config - Definition of the particular problem.
114 * \return Lightweight const-view of residual and Jacobian.
115 */
116 ResidualType<> ComputeResidual(const CConfig* config) override;
117
118};
119
120/*!
121 * \class CSourceIncAxisymmetric_Flow
122 * \brief Class for source term for solving incompressible axisymmetric problems.
123 * \ingroup SourceDiscr
124 * \author T. Economon
125 */
127 bool implicit, /*!< \brief Implicit calculation. */
128 viscous, /*!< \brief Viscous incompressible flows. */
129 energy, /*!< \brief computation with the energy equation. */
130 multicomponent; /*!< \brief multicomponent incompressible flows. */
131
132public:
133 /*!
134 * \brief Constructor of the class.
135 * \param[in] val_nDim - Number of dimensions of the problem.
136 * \param[in] val_nVar - Number of variables of the problem.
137 * \param[in] config - Definition of the particular problem.
138 */
139 CSourceIncAxisymmetric_Flow(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config);
140
141 /*!
142 * \brief Residual of the rotational frame source term.
143 * \param[in] config - Definition of the particular problem.
144 * \return Lightweight const-view of residual and Jacobian.
145 */
146 ResidualType<> ComputeResidual(const CConfig* config) override;
147
148};
149
150/*!
151 * \class CSourceBodyForce
152 * \brief Class for the source term integration of a body force.
153 * \ingroup SourceDiscr
154 * \author T. Economon
155 */
156class CSourceBodyForce final : public CSourceBase_Flow {
157 su2double Body_Force_Vector[3];
158
159public:
160 /*!
161 * \param[in] val_nDim - Number of dimensions of the problem.
162 * \param[in] val_nVar - Number of variables of the problem.
163 * \param[in] config - Definition of the particular problem.
164 */
165 CSourceBodyForce(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config);
166
167 /*!
168 * \brief Source term integration for a body force.
169 * \param[in] config - Definition of the particular problem.
170 * \return Lightweight const-view of residual and Jacobian.
171 */
172 ResidualType<> ComputeResidual(const CConfig* config) override;
173
174};
175
176/*!
177 * \class CSourceIncBodyForce
178 * \brief Class for the source term integration of a body force in the incompressible solver.
179 * \ingroup SourceDiscr
180 * \author T. Economon
181 * \version 8.5.0 "Harrier"
182 */
184 su2double Body_Force_Vector[3];
185
186public:
187 /*!
188 * \param[in] val_nDim - Number of dimensions of the problem.
189 * \param[in] val_nVar - Number of variables of the problem.
190 * \param[in] config - Definition of the particular problem.
191 */
192 CSourceIncBodyForce(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config);
193
194 /*!
195 * \brief Source term integration for a body force.
196 * \param[in] config - Definition of the particular problem.
197 * \return Lightweight const-view of residual and Jacobian.
198 */
199 ResidualType<> ComputeResidual(const CConfig* config) override;
200
201};
202
203/*!
204 * \class CSourceBoussinesq
205 * \brief Class for the source term integration of the Boussinesq approximation for incompressible flow.
206 * \ingroup SourceDiscr
207 * \author T. Economon
208 * \version 8.5.0 "Harrier"
209 */
211 su2double Gravity_Vector[3];
212
213public:
214 /*!
215 * \param[in] val_nDim - Number of dimensions of the problem.
216 * \param[in] val_nVar - Number of variables of the problem.
217 * \param[in] config - Definition of the particular problem.
218 */
219 CSourceBoussinesq(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config);
220
221 /*!
222 * \brief Source term integration for the Boussinesq approximation.
223 * \param[in] config - Definition of the particular problem.
224 * \return Lightweight const-view of residual and Jacobian.
225 */
226 ResidualType<> ComputeResidual(const CConfig* config) override;
227
228};
229
230/*!
231 * \class CSourceGravity
232 * \brief Class for the source term integration of the gravity force.
233 * \ingroup SourceDiscr
234 * \author F. Palacios
235 */
236class CSourceGravity final : public CSourceBase_Flow {
237 su2double Force_Ref;
238
239public:
240 /*!
241 * \param[in] val_nDim - Number of dimensions of the problem.
242 * \param[in] val_nVar - Number of variables of the problem.
243 * \param[in] config - Definition of the particular problem.
244 */
245 CSourceGravity(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config);
246
247 /*!
248 * \brief Source term integration for the poissonal potential.
249 * \param[in] config - Definition of the particular problem.
250 * \return Lightweight const-view of residual and Jacobian.
251 */
252 ResidualType<> ComputeResidual(const CConfig* config) override;
253
254};
255
256/*!
257 * \class CSourceRotatingFrame_Flow
258 * \brief Class for a rotating frame source term.
259 * \ingroup SourceDiscr
260 * \author F. Palacios, T. Economon.
261 */
263public:
264 /*!
265 * \brief Constructor of the class.
266 * \param[in] val_nDim - Number of dimensions of the problem.
267 * \param[in] val_nVar - Number of variables of the problem.
268 * \param[in] config - Definition of the particular problem.
269 */
270 CSourceRotatingFrame_Flow(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config);
271
272 /*!
273 * \brief Residual of the rotational frame source term.
274 * \param[in] config - Definition of the particular problem.
275 * \return Lightweight const-view of residual and Jacobian.
276 */
277 ResidualType<> ComputeResidual(const CConfig* config) override;
278
279};
280
281/*!
282 * \class CSourceIncRotatingFrame_Flow
283 * \brief Class for a rotating frame source term.
284 * \ingroup SourceDiscr
285 */
287
288private:
289 su2double Omega[3]; /*!< \brief Angular velocity */
290 bool implicit; /*!< \brief Implicit calculation. */
291
292public:
293 /*!
294 * \brief Constructor of the class.
295 * \param[in] val_nDim - Number of dimensions of the problem.
296 * \param[in] val_nVar - Number of variables of the problem.
297 * \param[in] config - Definition of the particular problem.
298 */
299 CSourceIncRotatingFrame_Flow(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config);
300
301 /*!
302 * \brief Residual of the rotational frame source term.
303 * \param[in] config - Definition of the particular problem.
304 * \return Lightweight const-view of residual and Jacobian.
305 */
306 ResidualType<> ComputeResidual(const CConfig* config) override;
307
308};
309
310/*!
311 * \class CSourceVorticityConfinement
312 * \brief Class for a source term due to vorticity confinement.
313 * \ingroup SourceDiscr
314 * \brief Vorticity Confinement (VC) technique to counter the numerical
315 * diffusion offered by the numerical scheme
316 * \author: Y Chandukrishna, Josy P Pullockara, T N Venkatesh.
317 * Computational and Theoretical Fluid Dynamics division,
318 * CSIR-National Aerospace Laboratories (NAL), Bangalore.
319 * Academy of Scientific and Innovative Research (AcSIR), Ghaziabad.
320 * First release date : 23 December 2022
321 * modified on:
322 *
323 * VC technique introduces an additional term to the N-S equations that
324 * counters the numerical difusion offerd by the numerical schemes. The
325 * additional term is introduced as a source term. VC technique requires an
326 * input confinement parameter that controls the magnitude of the source
327 * term. A suitable Confinement parameter is problem, scheme and grid
328 * dependant.
329 *
330 * Required changes in config file -
331 * VORTICITY_CONFINEMENT = YES
332 * CONFINEMENT_PARAMETER = <0.0(default)>
333 * Currently have support for Viscous, Inviscid cases for both 2D and 3D
334 * problems. Can be used along with other source terms also.
335 *
336 * The current implementation follows,
337 * R. Loehner and C. Yang, Vorticity confinement on unstructured grids, 2002.
338 * N. Butsuntorn and A. Jameson, Time Spectral Method for Rotorcraft Flow, 2008.
339 */
341public:
342 /*!
343 * \brief Constructor of the class.
344 * \param[in] val_nDim - Number of dimensions of the problem.
345 * \param[in] val_nVar - Number of variables of the problem.
346 * \param[in] config - Definition of the particular problem.
347 */
348 CSourceVorticityConfinement(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config);
349
350 /*!
351 * \brief Residual of the rotational frame source term.
352 * \param[in] config - Definition of the particular problem.
353 * \return Lightweight const-view of residual and Jacobian.
354 */
355 ResidualType<> ComputeResidual(const CConfig* config) override;
356};
357
358/*!
359 * \class CSourceWindGust
360 * \brief Class for a source term due to a wind gust.
361 * \ingroup SourceDiscr
362 * \author S. PadrĂ³n
363 */
364class CSourceWindGust final : public CSourceBase_Flow {
365public:
366 /*!
367 * \brief Constructor of the class.
368 * \param[in] val_nDim - Number of dimensions of the problem.
369 * \param[in] val_nVar - Number of variables of the problem.
370 * \param[in] config - Definition of the particular problem.
371 */
372 CSourceWindGust(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config);
373
374 /*!
375 * \brief Residual of the wind gust source term.
376 * \param[in] config - Definition of the particular problem.
377 * \return Lightweight const-view of residual and Jacobian.
378 */
379 ResidualType<> ComputeResidual(const CConfig* config) override;
380
381};
382
383/*!
384 * \class CSourceIncStreamwise_Periodic
385 * \brief Class for the source term integration of a streamwise periodic body force in the incompressible solver.
386 * \ingroup SourceDiscr
387 * \author T. Kattmann
388 */
390private:
391
392 bool turbulent; /*!< \brief Turbulence model used. */
393 bool energy; /*!< \brief Energy equation on. */
394 bool streamwisePeriodic_temperature; /*!< \brief Periodicity in energy equation */
395 su2double Streamwise_Coord_Vector[MAXNDIM] = {0.0}; /*!< \brief Translation vector between streamwise periodic surfaces. */
396
397 su2double norm2_translation, /*!< \brief Square of distance between the 2 periodic surfaces. */
398 dot_product, /*!< \brief Container for various dot-products. */
399 scalar_factor; /*!< \brief Holds scalar factors to simplify final equations. */
400
401public:
402
403 /*!
404 * \brief Constructor of the class.
405 * \param[in] val_nDim - Number of dimensions of the problem.
406 * \param[in] val_nVar - Number of variables of the problem.
407 * \param[in] config - Definition of the particular problem.
408 */
409 CSourceIncStreamwise_Periodic(unsigned short val_nDim,
410 unsigned short val_nVar,
411 CConfig *config);
412
413 /*!
414 * \brief Source term integration for a body force.
415 * \param[in] config - Definition of the particular problem.
416 */
417 ResidualType<> ComputeResidual(const CConfig *config) override;
418
419};
420
421/*!
422 * \class CSourceIncStreamwisePeriodic_Outlet
423 * \brief Class for the outlet heat sink. Acts like a heatflux boundary on the outlet and not as a volume source.
424 * \ingroup SourceDiscr
425 * \author T. Kattmann
426 */
428public:
429
430 /*!
431 * \brief Constructor of the class.
432 * \param[in] val_nDim - Number of dimensions of the problem.
433 * \param[in] val_nVar - Number of variables of the problem.
434 * \param[in] config - Definition of the particular problem.
435 */
436 CSourceIncStreamwisePeriodic_Outlet(unsigned short val_nDim,
437 unsigned short val_nVar,
438 CConfig *config);
439
440 /*!
441 * \brief Source term integration for boundary heat sink.
442 * \param[in] config - Definition of the particular problem.
443 */
444 ResidualType<> ComputeResidual(const CConfig *config) override;
445
446};
447
448
449/*!
450 * \class CSourceRadiation
451 * \brief Class for a source term due to radiation.
452 * \ingroup SourceDiscr
453 * \author Ruben Sanchez
454 */
456private:
457 bool implicit;
458
459public:
460
461 CSourceRadiation(unsigned short val_nDim, unsigned short val_nVar, const CConfig *config);
462
463 /*!
464 * \brief Source term integration for a radiation source.
465 * \param[in] config - Definition of the particular problem.
466 * \return Lightweight const-view of residual and Jacobian.
467 */
468 ResidualType<> ComputeResidual(const CConfig* config) override;
469
470};
Main class for defining the problem; basically this class reads the configuration file,...
Definition CConfig.hpp:64
Class for defining the numerical methods.
Definition CNumerics.hpp:48
static constexpr size_t MAXNDIM
Max number of space dimensions, used in some static arrays.
Definition CNumerics.hpp:50
Class for source term for solving axisymmetric problems.
Definition flow_sources.hpp:73
bool viscous
Definition flow_sources.hpp:75
void ResidualDiffusion()
Diffusion residual of the axisymmetric source term.
Definition flow_sources.cpp:162
ResidualType ComputeResidual(const CConfig *config) override
Residual of the axisymmetric source term.
Definition flow_sources.cpp:61
bool rans
Definition flow_sources.hpp:75
su2double yinv
Definition flow_sources.hpp:76
CSourceAxisymmetric_Flow(unsigned short val_nDim, unsigned short val_nVar, const CConfig *config)
Constructor of the class.
Definition flow_sources.cpp:49
bool implicit
Definition flow_sources.hpp:75
Intermediate source term class to allocate the internally stored residual and Jacobian....
Definition flow_sources.hpp:39
su2double * residual
Definition flow_sources.hpp:41
struct StreamwisePeriodicValues SPvals
Definition flow_sources.hpp:43
su2double ** jacobian
Definition flow_sources.hpp:42
void SetStreamwisePeriodicValues(const StreamwisePeriodicValues SolverSPvals) final
Set massflow, heatflow & inlet temperature for streamwise periodic flow.
Definition flow_sources.hpp:63
~CSourceBase_Flow() override
Destructor of the class.
Definition flow_sources.cpp:40
Class for the source term integration of a body force.
Definition flow_sources.hpp:156
ResidualType ComputeResidual(const CConfig *config) override
Source term integration for a body force.
Definition flow_sources.cpp:415
Class for the source term integration of the Boussinesq approximation for incompressible flow.
Definition flow_sources.hpp:210
ResidualType ComputeResidual(const CConfig *config) override
Source term integration for the Boussinesq approximation.
Definition flow_sources.cpp:492
Class for source term for solving axisymmetric problems for a general (non ideal) fluid.
Definition flow_sources.hpp:107
ResidualType ComputeResidual(const CConfig *config) override
Residual of the general axisymmetric source term.
Definition flow_sources.cpp:190
Class for the source term integration of the gravity force.
Definition flow_sources.hpp:236
ResidualType ComputeResidual(const CConfig *config) override
Source term integration for the poissonal potential.
Definition flow_sources.cpp:522
Class for source term for solving incompressible axisymmetric problems.
Definition flow_sources.hpp:126
ResidualType ComputeResidual(const CConfig *config) override
Residual of the rotational frame source term.
Definition flow_sources.cpp:294
Class for the source term integration of a body force in the incompressible solver.
Definition flow_sources.hpp:183
ResidualType ComputeResidual(const CConfig *config) override
Source term integration for a body force.
Definition flow_sources.cpp:448
Class for a rotating frame source term.
Definition flow_sources.hpp:286
ResidualType ComputeResidual(const CConfig *config) override
Residual of the rotational frame source term.
Definition flow_sources.cpp:605
Class for the outlet heat sink. Acts like a heatflux boundary on the outlet and not as a volume sourc...
Definition flow_sources.hpp:427
ResidualType ComputeResidual(const CConfig *config) override
Source term integration for boundary heat sink.
Definition flow_sources.cpp:815
Class for the source term integration of a streamwise periodic body force in the incompressible solve...
Definition flow_sources.hpp:389
ResidualType ComputeResidual(const CConfig *config) override
Source term integration for a body force.
Definition flow_sources.cpp:771
Class for a source term due to radiation.
Definition flow_sources.hpp:455
ResidualType ComputeResidual(const CConfig *config) override
Source term integration for a radiation source.
Definition flow_sources.cpp:846
Class for a rotating frame source term.
Definition flow_sources.hpp:262
ResidualType ComputeResidual(const CConfig *config) override
Residual of the rotational frame source term.
Definition flow_sources.cpp:539
Class for a source term due to vorticity confinement.
Definition flow_sources.hpp:340
ResidualType ComputeResidual(const CConfig *config) override
Residual of the rotational frame source term.
Definition flow_sources.cpp:661
Class for a source term due to a wind gust.
Definition flow_sources.hpp:364
ResidualType ComputeResidual(const CConfig *config) override
Residual of the wind gust source term.
CSourceWindGust(unsigned short val_nDim, unsigned short val_nVar, const CConfig *config)
Constructor of the class.
passivedouble su2double
Definition code_config.hpp:181
Return type used in some "ComputeResidual" overloads to give a const-view of the internally stored fl...
Definition CNumerics.hpp:218
Container to hold Variables for streamwise Periodic flow as they are often used together in places.
Definition option_structure.hpp:3003