Documentation 6b54b78464
Loading...
Searching...
No Matches
adj_diffusion.hpp
Go to the documentation of this file.
1/*!
2 * \file adj_diffusion.hpp
3 * \brief Declarations of numerics classes for continuous adjoint
4 * diffusion discretization. Implemented in adj_diffusion.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 CAvgGrad_AdjFlow
35 * \brief Class for computing the adjoint viscous terms.
36 * \ingroup ViscDiscr
37 * \author F. Palacios
38 */
40private:
41 su2double *Velocity_i; /*!< \brief Auxiliary vector for storing the velocity of point i. */
42 su2double *Velocity_j; /*!< \brief Auxiliary vector for storing the velocity of point j. */
43 su2double *Mean_Velocity;
44 su2double *Mean_GradPsiE; /*!< \brief Counter for dimensions of the problem. */
45 su2double **Mean_GradPhi; /*!< \brief Counter for dimensions of the problem. */
46 su2double *Edge_Vector; /*!< \brief Vector going from node i to node j. */
47 bool implicit; /*!< \brief Implicit calculus. */
48
49public:
50
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 CAvgGrad_AdjFlow(unsigned short val_nDim, unsigned short val_nVar, CConfig *config);
58
59 /*!
60 * \brief Destructor of the class.
61 */
62 ~CAvgGrad_AdjFlow(void) override;
63
64 /*!
65 * \brief Residual computation.
66 * \param[out] val_residual_i - Pointer to the total residual at point i.
67 * \param[out] val_residual_j - Pointer to the total residual at point j.
68 */
69 void ComputeResidual(su2double *val_residual_i, su2double *val_residual_j,
70 su2double **val_Jacobian_ii, su2double **val_Jacobian_ij,
71 su2double **val_Jacobian_ji, su2double **val_Jacobian_jj, CConfig *config) override;
72};
73
74/*!
75 * \class CAvgGradCorrected_AdjFlow
76 * \brief Class for computing the adjoint viscous terms, including correction.
77 * \ingroup ViscDiscr
78 * \author A. Bueno.
79 */
81private:
82 su2double *Velocity_i; /*!< \brief Auxiliary vector for storing the velocity of point i. */
83 su2double *Velocity_j; /*!< \brief Auxiliary vector for storing the velocity of point j. */
84 su2double *Mean_Velocity;
85 su2double **Mean_GradPsiVar; /*!< \brief Counter for dimensions of the problem. */
86 su2double *Edge_Vector; /*!< \brief Vector going from node i to node j. */
87 su2double *Proj_Mean_GradPsiVar_Edge; /*!< \brief Projection of Mean_GradPsiVar onto Edge_Vector. */
88 su2double *Mean_GradPsiE; /*!< \brief Counter for dimensions of the problem. */
89 su2double **Mean_GradPhi; /*!< \brief Counter for dimensions of the problem. */
90 bool implicit; /*!< \brief Boolean controlling Jacobian calculations. */
91
92public:
93
94 /*!
95 * \brief Constructor of the class.
96 * \param[in] val_nDim - Number of dimensions of the problem.
97 * \param[in] val_nVar - Number of variables of the problem.
98 * \param[in] config - Definition of the particular problem.
99 */
100 CAvgGradCorrected_AdjFlow(unsigned short val_nDim, unsigned short val_nVar, CConfig *config);
101
102 /*!
103 * \brief Destructor of the class.
104 */
105 ~CAvgGradCorrected_AdjFlow(void) override;
106
107 /*!
108 * \brief Compute the adjoint flow viscous residual in a non-conservative way using an average of gradients and derivative correction.
109 * \param[out] val_residual_i - Pointer to the viscous residual at point i.
110 * \param[out] val_residual_j - Pointer to the viscous residual at point j.
111 * \param[out] val_Jacobian_ii - Jacobian of the numerical method at node i (implicit computation) from node i.
112 * \param[out] val_Jacobian_ij - Jacobian of the numerical method at node i (implicit computation) from node j.
113 * \param[out] val_Jacobian_ji - Jacobian of the numerical method at node j (implicit computation) from node i.
114 * \param[out] val_Jacobian_jj - Jacobian of the numerical method at node j (implicit computation) from node j.
115 * \param[in] config - Definition of the particular problem.
116 */
117 void ComputeResidual(su2double *val_residual_i, su2double *val_residual_j,
118 su2double **val_Jacobian_ii, su2double **val_Jacobian_ij,
119 su2double **val_Jacobian_ji, su2double **val_Jacobian_jj, CConfig *config) override;
120};
121
122/*!
123 * \class CAvgGrad_AdjTurb
124 * \brief Class for adjoint turbulent using average of gradients with a correction.
125 * \ingroup ViscDiscr
126 * \author F. Palacios
127 */
129private:
130 su2double **Mean_GradTurbPsi;
131 su2double *Proj_Mean_GradTurbPsi_Kappa, *Proj_Mean_GradTurbPsi_Edge, *Proj_Mean_GradTurbPsi_Corrected;
132 su2double *Edge_Vector;
133
134public:
135
136 /*!
137 * \brief Constructor of the class.
138 * \param[in] val_nDim - Number of dimensions of the problem.
139 * \param[in] val_nVar - Number of variables of the problem.
140 * \param[in] config - Definition of the particular problem.
141 */
142 CAvgGrad_AdjTurb(unsigned short val_nDim, unsigned short val_nVar, CConfig *config);
143
144 /*!
145 * \brief Destructor of the class.
146 */
147 ~CAvgGrad_AdjTurb(void) override;
148
149 /*!
150 * \brief Compute the adjoint turbulent residual using average of gradients and a derivative correction.
151 * \param[out] val_residual - Pointer to the total residual.
152 * \param[out] val_Jacobian_i - Jacobian of the numerical method at node i (implicit computation).
153 * \param[out] val_Jacobian_j - Jacobian of the numerical method at node j (implicit computation).
154 * \param[in] config - Definition of the particular problem.
155 */
156
157 void ComputeResidual(su2double *val_residual, su2double **val_Jacobian_i, su2double **val_Jacobian_j, CConfig *config) override;
158
159 /*!
160 * \overload
161 * \param[out] val_residual_i - Pointer to the total residual at point i.
162 * \param[out] val_residual_j - Pointer to the total viscosity residual at point j.
163 * \param[out] val_Jacobian_ii - Jacobian of the numerical method at node i (implicit computation) from node i.
164 * \param[out] val_Jacobian_ij - Jacobian of the numerical method at node i (implicit computation) from node j.
165 * \param[out] val_Jacobian_ji - Jacobian of the numerical method at node j (implicit computation) from node i.
166 * \param[out] val_Jacobian_jj - Jacobian of the numerical method at node j (implicit computation) from node j.
167 * \param[in] config - Definition of the particular problem.
168 */
169 void ComputeResidual(su2double *val_residual_i, su2double *val_residual_j,
170 su2double **val_Jacobian_ii, su2double **val_Jacobian_ij,
171 su2double **val_Jacobian_ji, su2double **val_Jacobian_jj, CConfig *config) override;
172};
173
174/*!
175 * \class CAvgGradCorrected_AdjTurb
176 * \brief Class for adjoint turbulent using average of gradients with a correction.
177 * \ingroup ViscDiscr
178 * \author A. Bueno.
179 */
181private:
182 su2double **Mean_GradTurbPsi;
183 su2double *Proj_Mean_GradTurbPsi_Kappa, *Proj_Mean_GradTurbPsi_Edge, *Proj_Mean_GradTurbPsi_Corrected;
184 su2double *Edge_Vector;
185
186public:
187
188 /*!
189 * \brief Constructor of the class.
190 * \param[in] val_nDim - Number of dimensions of the problem.
191 * \param[in] val_nVar - Number of variables of the problem.
192 * \param[in] config - Definition of the particular problem.
193 */
194 CAvgGradCorrected_AdjTurb(unsigned short val_nDim, unsigned short val_nVar, CConfig *config);
195
196 /*!
197 * \brief Destructor of the class.
198 */
199 ~CAvgGradCorrected_AdjTurb(void) override;
200
201 /*!
202 * \brief Compute the adjoint turbulent residual using average of gradients and a derivative correction.
203 * \param[out] val_residual - Pointer to the total residual.
204 * \param[out] val_Jacobian_i - Jacobian of the numerical method at node i (implicit computation).
205 * \param[out] val_Jacobian_j - Jacobian of the numerical method at node j (implicit computation).
206 * \param[in] config - Definition of the particular problem.
207 */
208
209 void ComputeResidual(su2double *val_residual, su2double **val_Jacobian_i, su2double **val_Jacobian_j, CConfig *config) override;
210
211 /*!
212 * \overload
213 * \param[out] val_residual_i - Pointer to the total residual at point i.
214 * \param[out] val_residual_j - Pointer to the total viscosity residual at point j.
215 * \param[out] val_Jacobian_ii - Jacobian of the numerical method at node i (implicit computation) from node i.
216 * \param[out] val_Jacobian_ij - Jacobian of the numerical method at node i (implicit computation) from node j.
217 * \param[out] val_Jacobian_ji - Jacobian of the numerical method at node j (implicit computation) from node i.
218 * \param[out] val_Jacobian_jj - Jacobian of the numerical method at node j (implicit computation) from node j.
219 * \param[in] config - Definition of the particular problem.
220 */
221 void ComputeResidual(su2double *val_residual_i, su2double *val_residual_j,
222 su2double **val_Jacobian_ii, su2double **val_Jacobian_ij,
223 su2double **val_Jacobian_ji, su2double **val_Jacobian_jj, CConfig *config) override;
224};
Class for computing the adjoint viscous terms, including correction.
Definition adj_diffusion.hpp:80
~CAvgGradCorrected_AdjFlow(void) override
Destructor of the class.
Definition adj_diffusion.cpp:171
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 flow viscous residual in a non-conservative way using an average of gradients and...
Definition adj_diffusion.cpp:190
Class for adjoint turbulent using average of gradients with a correction.
Definition adj_diffusion.hpp:180
~CAvgGradCorrected_AdjTurb(void) override
Destructor of the class.
Definition adj_diffusion.cpp:429
void ComputeResidual(su2double *val_residual, su2double **val_Jacobian_i, su2double **val_Jacobian_j, CConfig *config) override
Compute the adjoint turbulent residual using average of gradients and a derivative correction.
Definition adj_diffusion.cpp:440
Class for computing the adjoint viscous terms.
Definition adj_diffusion.hpp:39
~CAvgGrad_AdjFlow(void) override
Destructor of the class.
Definition adj_diffusion.cpp:49
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
Residual computation.
Definition adj_diffusion.cpp:60
Class for adjoint turbulent using average of gradients with a correction.
Definition adj_diffusion.hpp:128
~CAvgGrad_AdjTurb(void) override
Destructor of the class.
Definition adj_diffusion.cpp:308
void ComputeResidual(su2double *val_residual, su2double **val_Jacobian_i, su2double **val_Jacobian_j, CConfig *config) override
Compute the adjoint turbulent residual using average of gradients and a derivative correction.
Definition adj_diffusion.cpp:319
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
passivedouble su2double
Definition code_config.hpp:181