Documentation 6b54b78464
Loading...
Searching...
No Matches
adj_convection.hpp
Go to the documentation of this file.
1/*!
2 * \file adj_convection.hpp
3 * \brief Declarations of numerics classes for continuous adjoint
4 * convective discretization. Implemented in adj_convection.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 CCentLax_AdjFlow
35 * \brief Class for computing the Lax-Friedrich adjoint centered scheme.
36 * \ingroup ConvDiscr
37 * \author F. Palacios
38 */
40private:
41 su2double *Diff_Psi;
42 su2double *Velocity_i, *Velocity_j;
43 su2double *MeanPhi;
44 unsigned short iDim, jDim, iVar, jVar;
45 su2double Residual, ProjVelocity_i, ProjVelocity_j, ProjPhi, ProjPhi_Vel, sq_vel, phis1, phis2,
46 MeanPsiRho, MeanPsiE, Param_p, Param_Kappa_0, Local_Lambda_i, Local_Lambda_j, MeanLambda,
47 Phi_i, Phi_j, sc2, StretchingFactor, Epsilon_0;
48 bool implicit, grid_movement;
49
50public:
51 /*!
52 * \brief Constructor of the class.
53 * \param[in] val_nDim - Number of dimensions of the problem.
54 * \param[in] val_nVar - Number of variables of the problem.
55 * \param[in] config - Definition of the particular problem.
56 */
57 CCentLax_AdjFlow(unsigned short val_nDim, unsigned short val_nVar, CConfig *config);
58
59 /*!
60 * \brief Destructor of the class.
61 */
62 ~CCentLax_AdjFlow(void) override;
63
64 /*!
65 * \brief Compute the adjoint flow residual using a Lax method.
66 * \param[out] val_resconv_i - Pointer to the convective residual at point i.
67 * \param[out] val_resvisc_i - Pointer to the artificial viscosity residual at point i.
68 * \param[out] val_resconv_j - Pointer to the convective residual at point j.
69 * \param[out] val_resvisc_j - Pointer to the artificial viscosity residual at point j.
70 * \param[out] val_Jacobian_ii - Jacobian of the numerical method at node i (implicit computation) from node i.
71 * \param[out] val_Jacobian_ij - Jacobian of the numerical method at node i (implicit computation) from node j.
72 * \param[out] val_Jacobian_ji - Jacobian of the numerical method at node j (implicit computation) from node i.
73 * \param[out] val_Jacobian_jj - Jacobian of the numerical method at node j (implicit computation) from node j.
74 * \param[in] config - Definition of the particular problem.
75 */
76 void ComputeResidual (su2double *val_resconv_i, su2double *val_resvisc_i,
77 su2double *val_resconv_j, su2double *val_resvisc_j,
78 su2double **val_Jacobian_ii, su2double **val_Jacobian_ij,
79 su2double **val_Jacobian_ji, su2double **val_Jacobian_jj,
80 CConfig *config) override;
81};
82
83/*!
84 * \class CCentJST_AdjFlow
85 * \brief Class for and adjoint centered scheme - JST.
86 * \ingroup ConvDiscr
87 * \author F. Palacios
88 */
90private:
91 su2double *Diff_Psi, *Diff_Lapl;
92 su2double *Velocity_i, *Velocity_j;
93 su2double *MeanPhi;
94 unsigned short iDim, jDim, iVar, jVar;
95 su2double Residual, ProjVelocity_i, ProjVelocity_j, ProjPhi, ProjPhi_Vel, sq_vel, phis1, phis2;
96 su2double MeanPsiRho, MeanPsiE, Param_p, Param_Kappa_4, Param_Kappa_2, Local_Lambda_i, Local_Lambda_j, MeanLambda;
97 su2double Phi_i, Phi_j, sc4, StretchingFactor, Epsilon_4, Epsilon_2;
98 bool implicit, grid_movement;
99
100public:
101 /*!
102 * \brief Constructor of the class.
103 * \param[in] val_nDim - Number of dimensions of the problem.
104 * \param[in] val_nVar - Number of variables of the problem.
105 * \param[in] config - Definition of the particular problem.
106 */
107 CCentJST_AdjFlow(unsigned short val_nDim, unsigned short val_nVar, CConfig *config);
108
109 /*!
110 * \brief Destructor of the class.
111 */
112 ~CCentJST_AdjFlow(void) override;
113
114 /*!
115 * \brief Compute the adjoint flow residual using a JST method.
116 * \param[out] val_resconv_i - Pointer to the convective residual at point i.
117 * \param[out] val_resvisc_i - Pointer to the artificial viscosity residual at point i.
118 * \param[out] val_resconv_j - Pointer to the convective residual at point j.
119 * \param[out] val_resvisc_j - Pointer to the artificial viscosity residual at point j.
120 * \param[out] val_Jacobian_ii - Jacobian of the numerical method at node i (implicit computation) from node i.
121 * \param[out] val_Jacobian_ij - Jacobian of the numerical method at node i (implicit computation) from node j.
122 * \param[out] val_Jacobian_ji - Jacobian of the numerical method at node j (implicit computation) from node i.
123 * \param[out] val_Jacobian_jj - Jacobian of the numerical method at node j (implicit computation) from node j.
124 * \param[in] config - Definition of the particular problem.
125 */
126 void ComputeResidual (su2double *val_resconv_i, su2double *val_resvisc_i,
127 su2double *val_resconv_j, su2double *val_resvisc_j,
128 su2double **val_Jacobian_ii, su2double **val_Jacobian_ij,
129 su2double **val_Jacobian_ji, su2double **val_Jacobian_jj,
130 CConfig *config) override;
131};
132
133/*!
134 * \class CUpwRoe_AdjFlow
135 * \brief Class for solving an approximate Riemann solver of Roe
136 * for the adjoint flow equations.
137 * \ingroup ConvDiscr
138 * \author F. Palacios
139 */
141private:
142 su2double *Residual_Roe;
143 su2double area, Sx, Sy, Sz, rarea, nx, ny, nz, rho_l, u_l, v_l, w_l, h_l, rho_r,
144 u_r, v_r, w_r, h_r, psi1, psi2, psi3, psi4, psi5;
145 su2double h, u, v, w, c, psi1_l, psi2_l, psi3_l, psi4_l, psi5_l,
146 psi1_r, psi2_r, psi3_r, psi4_r, psi5_r, q_l, q_r, Q_l, Q_r, vn,
147 rrho_l, weight, rweight1, cc;
148 su2double l1psi, l2psi, absQ, absQp, absQm, q2, alpha, beta_u, beta_v, beta_w, Q, l1l2p, l1l2m, eta;
149 su2double RoeDensity, RoeSoundSpeed, *RoeVelocity, *Lambda, *Velocity_i, *Velocity_j, **ProjFlux_i, **ProjFlux_j,
150 Proj_ModJac_Tensor_ij, **Proj_ModJac_Tensor, Energy_i, Energy_j, **P_Tensor, **invP_Tensor;
151 unsigned short iDim, iVar, jVar, kVar;
152 bool implicit, grid_movement;
153
154public:
155 /*!
156 * \brief Constructor of the class.
157 * \param[in] val_nDim - Number of dimensions of the problem.
158 * \param[in] val_nVar - Number of variables of the problem.
159 * \param[in] config - Definition of the particular problem.
160 */
161 CUpwRoe_AdjFlow(unsigned short val_nDim, unsigned short val_nVar, CConfig *config);
162
163 /*!
164 * \brief Destructor of the class.
165 */
166 ~CUpwRoe_AdjFlow(void) override;
167
168 /*!
169 * \brief Compute the adjoint Roe's flux between two nodes i and j.
170 * \param[out] val_residual_i - Pointer to the total residual at point i.
171 * \param[out] val_residual_j - Pointer to the total residual at point j.
172 * \param[out] val_Jacobian_ii - Jacobian of the numerical method at node i (implicit computation) from node i.
173 * \param[out] val_Jacobian_ij - Jacobian of the numerical method at node i (implicit computation) from node j.
174 * \param[out] val_Jacobian_ji - Jacobian of the numerical method at node j (implicit computation) from node i.
175 * \param[out] val_Jacobian_jj - Jacobian of the numerical method at node j (implicit computation) from node j.
176 * \param[in] config - Definition of the particular problem.
177 */
178 void ComputeResidual(su2double *val_residual_i, su2double *val_residual_j,
179 su2double **val_Jacobian_ii, su2double **val_Jacobian_ij,
180 su2double **val_Jacobian_ji, su2double **val_Jacobian_jj, CConfig *config) override;
181};
182
183/*!
184 * \class CUpwLin_AdjTurb
185 * \brief Class for performing a linear upwind solver for the adjoint turbulence equations.
186 * \ingroup ConvDiscr
187 * \author A. Bueno.
188 */
190private:
191 su2double *Velocity_i;
192
193public:
194 /*!
195 * \brief Constructor of the class.
196 * \param[in] val_nDim - Number of dimensions of the problem.
197 * \param[in] val_nVar - Number of variables of the problem.
198 * \param[in] config - Definition of the particular problem.
199 */
200 CUpwLin_AdjTurb(unsigned short val_nDim, unsigned short val_nVar, CConfig *config);
201
202 /*!
203 * \brief Destructor of the class.
204 */
205 ~CUpwLin_AdjTurb(void) override;
206
207 /*!
208 * \brief Compute the adjoint upwind flux between two nodes i and j.
209 * \param[out] val_residual - Pointer to the total residual.
210 * \param[out] val_Jacobian_i - Jacobian of the numerical method at node i (implicit computation).
211 * \param[out] val_Jacobian_j - Jacobian of the numerical method at node j (implicit computation).
212 * \param[in] config - Definition of the particular problem.
213 */
214 void ComputeResidual (su2double *val_residual, su2double **val_Jacobian_i, su2double **val_Jacobian_j, CConfig *config) override;
215};
216
217/*!
218 * \class CUpwSca_AdjTurb
219 * \brief Class for doing a scalar upwind solver for the adjoint turbulence equations.
220 * \ingroup ConvDiscr
221 * \author A. Bueno.
222 */
224private:
225 su2double *Velocity_i, *Velocity_j;
226
227public:
228
229 /*!
230 * \brief Constructor of the class.
231 * \param[in] val_nDim - Number of dimensions of the problem.
232 * \param[in] val_nVar - Number of variables of the problem.
233 * \param[in] config - Definition of the particular problem.
234 */
235 CUpwSca_AdjTurb(unsigned short val_nDim, unsigned short val_nVar, CConfig *config);
236
237 /*!
238 * \brief Destructor of the class.
239 */
240 ~CUpwSca_AdjTurb(void) override;
241
242 /*!
243 * \param[out] val_residual_i - Pointer to the total residual at point i.
244 * \param[out] val_residual_j - Pointer to the total viscosity residual at point j.
245 * \param[out] val_Jacobian_ii - Jacobian of the numerical method at node i (implicit computation) from node i.
246 * \param[out] val_Jacobian_ij - Jacobian of the numerical method at node i (implicit computation) from node j.
247 * \param[out] val_Jacobian_ji - Jacobian of the numerical method at node j (implicit computation) from node i.
248 * \param[out] val_Jacobian_jj - Jacobian of the numerical method at node j (implicit computation) from node j.
249 * \param[in] config - Definition of the particular problem.
250 */
251 void ComputeResidual(su2double *val_residual_i, su2double *val_residual_j,
252 su2double **val_Jacobian_ii, su2double **val_Jacobian_ij,
253 su2double **val_Jacobian_ji, su2double **val_Jacobian_jj, CConfig *config) override;
254};
Class for and adjoint centered scheme - JST.
Definition adj_convection.hpp:89
~CCentJST_AdjFlow(void) override
Destructor of the class.
Definition adj_convection.cpp:256
void ComputeResidual(su2double *val_resconv_i, su2double *val_resvisc_i, su2double *val_resconv_j, su2double *val_resvisc_j, su2double **val_Jacobian_ii, su2double **val_Jacobian_ij, su2double **val_Jacobian_ji, su2double **val_Jacobian_jj, CConfig *config) override
Compute the adjoint flow residual using a JST method.
Definition adj_convection.cpp:263
Class for computing the Lax-Friedrich adjoint centered scheme.
Definition adj_convection.hpp:39
~CCentLax_AdjFlow(void) override
Destructor of the class.
Definition adj_convection.cpp:48
void ComputeResidual(su2double *val_resconv_i, su2double *val_resvisc_i, su2double *val_resconv_j, su2double *val_resvisc_j, su2double **val_Jacobian_ii, su2double **val_Jacobian_ij, su2double **val_Jacobian_ji, su2double **val_Jacobian_jj, CConfig *config) override
Compute the adjoint flow residual using a Lax method.
Definition adj_convection.cpp:55
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
Class for performing a linear upwind solver for the adjoint turbulence equations.
Definition adj_convection.hpp:189
void ComputeResidual(su2double *val_residual, su2double **val_Jacobian_i, su2double **val_Jacobian_j, CConfig *config) override
Compute the adjoint upwind flux between two nodes i and j.
Definition adj_convection.cpp:776
~CUpwLin_AdjTurb(void) override
Destructor of the class.
Definition adj_convection.cpp:772
Class for solving an approximate Riemann solver of Roe for the adjoint flow equations.
Definition adj_convection.hpp:140
void ComputeResidual(su2double *val_residual_i, su2double *val_residual_j, su2double **val_Jacobian_ii, su2double **val_Jacobian_ij, su2double **val_Jacobian_ji, su2double **val_Jacobian_jj, CConfig *config) override
Compute the adjoint Roe's flux between two nodes i and j.
Definition adj_convection.cpp:508
~CUpwRoe_AdjFlow(void) override
Destructor of the class.
Definition adj_convection.cpp:486
Class for doing a scalar upwind solver for the adjoint turbulence equations.
Definition adj_convection.hpp:223
void ComputeResidual(su2double *val_residual_i, su2double *val_residual_j, su2double **val_Jacobian_ii, su2double **val_Jacobian_ij, su2double **val_Jacobian_ji, su2double **val_Jacobian_jj, CConfig *config) override
Definition adj_convection.cpp:816
~CUpwSca_AdjTurb(void) override
Destructor of the class.
Definition adj_convection.cpp:811
passivedouble su2double
Definition code_config.hpp:181