Documentation 6b54b78464
Loading...
Searching...
No Matches
roe.hpp
Go to the documentation of this file.
1/*!
2 * \file roe.hpp
3 * \brief Declarations of numerics classes for Roe-type schemes,
4 * implemented in roe.cpp.
5 * \author F. Palacios, T. Economon
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 "../../CNumerics.hpp"
32
33/*!
34 * \class CUpwRoeBase_Flow
35 * \brief Intermediate base class for Roe schemes on ideal gas.
36 * \ingroup ConvDiscr
37 * \author A. Bueno, F. Palacios, P. Gomes
38 */
40protected:
43 su2double *Diff_U = nullptr, *Lambda = nullptr;
44 su2double *ProjFlux_i = nullptr, *Conservatives_i = nullptr;
45 su2double *ProjFlux_j = nullptr, *Conservatives_j = nullptr;
46 su2double **P_Tensor = nullptr, **invP_Tensor = nullptr;
48
49 su2double* Flux = nullptr; /*!< \brief The flux accross the face. */
50 su2double** Jacobian_i = nullptr; /*!< \brief The Jacobian w.r.t. point i after computation. */
51 su2double** Jacobian_j = nullptr; /*!< \brief The Jacobian w.r.t. point j after computation. */
52
53 /*!
54 * \brief Derived classes must specialize this method to add the specifics of the scheme they implement (e.g. low-Mach precond.).
55 * \param[out] val_residual - Convective flux.
56 * \param[out] val_Jacobian_i - Flux Jacobian wrt node i conservatives (implicit computation).
57 * \param[out] val_Jacobian_j - Flux Jacobian wrt node j conservatives (implicit computation).
58 * \param[in] config - Definition of the particular problem.
59 */
60 virtual void FinalizeResidual(su2double *val_residual, su2double **val_Jacobian_i,
61 su2double **val_Jacobian_j, const CConfig* config) = 0;
62
63public:
64 /*!
65 * \brief Constructor of the class.
66 * \param[in] val_nDim - Number of dimensions of the problem.
67 * \param[in] val_nVar - Number of variables of the problem.
68 * \param[in] config - Definition of the particular problem.
69 * \param[in] val_low_dissipation - Use a low dissipation formulation.
70 */
71 CUpwRoeBase_Flow(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config, bool val_low_dissipation);
72
73 /*!
74 * \brief Destructor of the class.
75 */
76 ~CUpwRoeBase_Flow(void) override;
77
78 /*!
79 * \brief Compute the flux from node i to node j, part common to most Roe schemes.
80 * \param[in] config - Definition of the particular problem.
81 * \return A lightweight const-view (read-only) of the residual/flux and Jacobians.
82 */
83 ResidualType<> ComputeResidual(const CConfig* config) final;
84
85};
86
87/*!
88 * \class CUpwRoe_Flow
89 * \brief Class for solving an approximate Riemann solver of Roe for the flow equations.
90 * \ingroup ConvDiscr
91 * \author A. Bueno, F. Palacios, P. Gomes
92 */
93class CUpwRoe_Flow final : public CUpwRoeBase_Flow {
94private:
95 /*!
96 * \brief Add standard Roe dissipation to the flux.
97 * \param[out] val_residual - Convective flux.
98 * \param[out] val_Jacobian_i - Flux Jacobian wrt node i conservatives (implicit computation).
99 * \param[out] val_Jacobian_j - Flux Jacobian wrt node j conservatives (implicit computation).
100 * \param[in] config - Definition of the particular problem.
101 */
102 void FinalizeResidual(su2double *val_residual, su2double **val_Jacobian_i,
103 su2double **val_Jacobian_j, const CConfig* config) override;
104
105public:
106 /*!
107 * \brief Constructor of the class.
108 * \param[in] val_nDim - Number of dimensions of the problem.
109 * \param[in] val_nVar - Number of variables of the problem.
110 * \param[in] config - Definition of the particular problem.
111 * \param[in] val_low_dissipation - Use a low dissipation formulation.
112 */
113 CUpwRoe_Flow(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config, bool val_low_dissipation);
114
115};
116
117/*!
118 * \class CUpwL2Roe_Flow
119 * \brief Class for solving an approximate Riemann solver of L2Roe for the flow equations.
120 * \ingroup ConvDiscr
121 * \author E. Molina, A. Bueno, F. Palacios, P. Gomes
122 * \version 8.5.0 "Harrier"
123 */
124class CUpwL2Roe_Flow final : public CUpwRoeBase_Flow {
125private:
126 /*!
127 * \brief Add L^2 Roe dissipation to the flux (low-Mach scheme).
128 * \param[out] val_residual - Convective flux.
129 * \param[out] val_Jacobian_i - Flux Jacobian wrt node i conservatives (implicit computation).
130 * \param[out] val_Jacobian_j - Flux Jacobian wrt node j conservatives (implicit computation).
131 * \param[in] config - Definition of the particular problem.
132 */
133 void FinalizeResidual(su2double *val_residual, su2double **val_Jacobian_i,
134 su2double **val_Jacobian_j, const CConfig* config) override;
135
136public:
137 /*!
138 * \brief Constructor of the class.
139 * \param[in] val_nDim - Number of dimensions of the problem.
140 * \param[in] val_nVar - Number of variables of the problem.
141 * \param[in] config - Definition of the particular problem.
142 */
143 CUpwL2Roe_Flow(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config);
144
145};
146
147/*!
148 * \class CUpwLMRoe_Flow
149 * \brief Class for solving an approximate Riemann solver of LMRoe for the flow equations.
150 * \ingroup ConvDiscr
151 * \author E. Molina, A. Bueno, F. Palacios, P. Gomes
152 * \version 8.5.0 "Harrier"
153 */
154class CUpwLMRoe_Flow final : public CUpwRoeBase_Flow {
155private:
156 /*!
157 * \brief Add LMRoe dissipation to the flux (low-Mach scheme).
158 * \param[out] val_residual - Convective flux.
159 * \param[out] val_Jacobian_i - Flux Jacobian wrt node i conservatives (implicit computation).
160 * \param[out] val_Jacobian_j - Flux Jacobian wrt node j conservatives (implicit computation).
161 * \param[in] config - Definition of the particular problem.
162 */
163 void FinalizeResidual(su2double *val_residual, su2double **val_Jacobian_i,
164 su2double **val_Jacobian_j, const CConfig* config) override;
165
166public:
167 /*!
168 * \brief Constructor of the class.
169 * \param[in] val_nDim - Number of dimensions of the problem.
170 * \param[in] val_nVar - Number of variables of the problem.
171 * \param[in] config - Definition of the particular problem.
172 */
173 CUpwLMRoe_Flow(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config);
174
175};
176
177/*!
178 * \class CUpwTurkel_Flow
179 * \brief Class for solving an approximate Riemann solver of Roe with Turkel Preconditioning for the flow equations.
180 * \ingroup ConvDiscr
181 * \author A. K. Lonkar
182 */
183class CUpwTurkel_Flow final : public CNumerics {
184private:
185 bool implicit, dynamic_grid;
186 su2double *Diff_U;
187 su2double *Velocity_i, *Velocity_j, *RoeVelocity;
188 su2double *ProjFlux_i, *ProjFlux_j;
189 su2double *Lambda, *Epsilon;
190 su2double **absPeJac, **invRinvPe, **R_Tensor, **Matrix, **Art_Visc;
191 su2double sq_vel, Density_i, Energy_i, SoundSpeed_i, Pressure_i, Enthalpy_i,
192 Density_j, Energy_j, SoundSpeed_j, Pressure_j, Enthalpy_j, R, RoePressure, RoeDensity, RoeEnthalpy, RoeSoundSpeed,
193 ProjVelocity, ProjVelocity_i, ProjVelocity_j;
194 unsigned short iDim, iVar, jVar, kVar;
195 su2double Beta, Beta_min, Beta_max;
196 su2double r_hat, s_hat, t_hat, rhoB2a2, sqr_one_m_Betasqr_Lam1;
197 su2double Beta2, one_m_Betasqr, one_p_Betasqr, sqr_two_Beta_c_Area;
198 su2double local_Mach;
199
200 su2double* Flux = nullptr; /*!< \brief The flux accross the face. */
201 su2double** Jacobian_i = nullptr; /*!< \brief The Jacobian w.r.t. point i after computation. */
202 su2double** Jacobian_j = nullptr; /*!< \brief The Jacobian w.r.t. point j after computation. */
203
204public:
205 /*!
206 * \brief Constructor of the class.
207 * \param[in] val_nDim - Number of dimensions of the problem.
208 * \param[in] val_nVar - Number of variables of the problem.
209 * \param[in] config - Definition of the particular problem.
210 */
211 CUpwTurkel_Flow(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config);
212
213 /*!
214 * \brief Destructor of the class.
215 */
216 ~CUpwTurkel_Flow(void) override;
217
218 /*!
219 * \brief Compute the Roe's flux between two nodes i and j.
220 * \param[in] config - Definition of the particular problem.
221 * \return A lightweight const-view (read-only) of the residual/flux and Jacobians.
222 */
223 ResidualType<> ComputeResidual(const CConfig* config) override;
224
225};
226
227/*!
228 * \class CUpwGeneralRoe_Flow
229 * \brief Class for solving an approximate Riemann solver of Roe for the flow equations for a general fluid model.
230 * \ingroup ConvDiscr
231 * \author S.Vitale, G.Gori, M.Pini
232 */
233class CUpwGeneralRoe_Flow final : public CNumerics {
234private:
235
236 bool implicit, dynamic_grid;
237
238 su2double *Diff_U;
239 su2double *Velocity_i, *Velocity_j, *RoeVelocity;
240 su2double *ProjFlux_i, *ProjFlux_j;
241 su2double *delta_wave, *delta_vel;
242 su2double *Lambda, *Epsilon, MaxLambda, Delta;
243 su2double **P_Tensor, **invP_Tensor;
244 su2double sq_vel, Proj_ModJac_Tensor_ij, Density_i, Energy_i, SoundSpeed_i, Pressure_i, Enthalpy_i,
245
246 Density_j, Energy_j, SoundSpeed_j, Pressure_j, Enthalpy_j, R, RoeDensity, RoeEnthalpy, RoeSoundSpeed, RoeSoundSpeed2,
247 ProjVelocity, ProjVelocity_i, ProjVelocity_j, proj_delta_vel, delta_p, delta_rho, kappa;
248 unsigned short iDim, iVar, jVar, kVar;
249
250 su2double StaticEnthalpy_i, StaticEnergy_i, StaticEnthalpy_j, StaticEnergy_j, Kappa_i, Kappa_j, Chi_i, Chi_j, Velocity2_i, Velocity2_j;
251 su2double RoeKappa, RoeChi;
252
253 su2double* Flux = nullptr; /*!< \brief The flux accross the face. */
254 su2double** Jacobian_i = nullptr; /*!< \brief The Jacobian w.r.t. point i after computation. */
255 su2double** Jacobian_j = nullptr; /*!< \brief The Jacobian w.r.t. point j after computation. */
256
257public:
258 /*!
259 * \brief Constructor of the class.
260 * \param[in] val_nDim - Number of dimensions of the problem.
261 * \param[in] val_nVar - Number of variables of the problem.
262 * \param[in] config - Definition of the particular problem.
263 */
264 CUpwGeneralRoe_Flow(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config);
265
266 /*!
267 * \brief Destructor of the class.
268 */
269 ~CUpwGeneralRoe_Flow(void) override;
270
271 /*!
272 * \brief Compute the Roe's flux between two nodes i and j.
273 * \param[in] config - Definition of the particular problem.
274 * \return A lightweight const-view (read-only) of the residual/flux and Jacobians.
275 */
276 ResidualType<> ComputeResidual(const CConfig* config) override;
277
278 /*!
279 * \brief Compute the Average for a general fluid flux between two nodes i and j.
280 * Using the approach of Vinokur and Montagne'
281 */
282 void ComputeRoeAverage();
283
284};
A templated matrix/vector-like object.
Definition C2DContainer.hpp:374
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 solving an approximate Riemann solver of Roe for the flow equations for a general fluid mod...
Definition roe.hpp:233
~CUpwGeneralRoe_Flow(void) override
Destructor of the class.
Definition roe.cpp:714
void ComputeRoeAverage()
Compute the Average for a general fluid flux between two nodes i and j. Using the approach of Vinokur...
Definition roe.cpp:985
ResidualType ComputeResidual(const CConfig *config) override
Compute the Roe's flux between two nodes i and j.
Definition roe.cpp:740
Class for solving an approximate Riemann solver of L2Roe for the flow equations.
Definition roe.hpp:124
Class for solving an approximate Riemann solver of LMRoe for the flow equations.
Definition roe.hpp:154
Intermediate base class for Roe schemes on ideal gas.
Definition roe.hpp:39
su2double Velocity_j[MAXNDIM]
Definition roe.hpp:42
bool roe_low_dissipation
Definition roe.hpp:41
su2double RoeVelocity[MAXNDIM]
Definition roe.hpp:42
su2double RoeEnthalpy
Definition roe.hpp:47
su2double * Conservatives_j
Definition roe.hpp:45
virtual void FinalizeResidual(su2double *val_residual, su2double **val_Jacobian_i, su2double **val_Jacobian_j, const CConfig *config)=0
Derived classes must specialize this method to add the specifics of the scheme they implement (e....
Definition roe.cpp:86
su2double * ProjFlux_i
Definition roe.hpp:44
bool dynamic_grid
Definition roe.hpp:41
su2double * Diff_U
Definition roe.hpp:43
su2double kappa
Definition roe.hpp:47
su2double ** invP_Tensor
Definition roe.hpp:46
su2double ** Jacobian_j
The Jacobian w.r.t. point j after computation.
Definition roe.hpp:51
su2double * ProjFlux_j
Definition roe.hpp:45
su2double RoeSoundSpeed
Definition roe.hpp:47
su2double * Flux
The flux accross the face.
Definition roe.hpp:49
su2double ProjVelocity
Definition roe.hpp:47
~CUpwRoeBase_Flow(void) override
Destructor of the class.
Definition roe.cpp:64
su2double * Conservatives_i
Definition roe.hpp:44
su2double Velocity_i[MAXNDIM]
Definition roe.hpp:42
su2double RoeDensity
Definition roe.hpp:47
su2double ** Jacobian_i
The Jacobian w.r.t. point i after computation.
Definition roe.hpp:50
su2double * Lambda
Definition roe.hpp:43
ResidualType ComputeResidual(const CConfig *config) final
Compute the flux from node i to node j, part common to most Roe schemes.
Definition roe.cpp:95
su2double ** P_Tensor
Definition roe.hpp:46
su2double RoeSoundSpeed2
Definition roe.hpp:47
bool implicit
Definition roe.hpp:41
Class for solving an approximate Riemann solver of Roe for the flow equations.
Definition roe.hpp:93
Class for solving an approximate Riemann solver of Roe with Turkel Preconditioning for the flow equat...
Definition roe.hpp:183
~CUpwTurkel_Flow(void) override
Destructor of the class.
Definition roe.cpp:482
ResidualType ComputeResidual(const CConfig *config) override
Compute the Roe's flux between two nodes i and j.
Definition roe.cpp:512
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