Documentation 6b54b78464
Loading...
Searching...
No Matches
CDiscAdjSinglezoneDriver.hpp
Go to the documentation of this file.
1/*!
2 * \file CDiscAdjSinglezoneDriver.hpp
3 * \brief Headers of the main subroutines for driving single or multi-zone problems.
4 * The subroutines and functions are in the <i>driver_structure.cpp</i> file.
5 * \author T. Economon, H. Kline, R. Sanchez
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#include "CSinglezoneDriver.hpp"
31
32/*!
33 * \class CDiscAdjSinglezoneDriver
34 * \ingroup DiscAdj
35 * \brief Class for driving single-zone adjoint solvers.
36 * \author R. Sanchez
37 * \version 8.5.0 "Harrier"
38 */
40protected:
41
42 unsigned long nAdjoint_Iter; /*!< \brief The number of adjoint iterations that are run on the fixed-point solver.*/
43 RECORDING RecordingState; /*!< \brief The kind of recording the tape currently holds.*/
44 RECORDING MainVariables; /*!< \brief The kind of recording linked to the main variables of the problem.*/
45 RECORDING SecondaryVariables; /*!< \brief The kind of recording linked to the secondary variables of the problem.*/
46 int MainSolver; /*!< \brief Index of the main adjoint solver. */
47 su2double ObjFunc; /*!< \brief The value of the objective function.*/
48 CIteration* direct_iteration; /*!< \brief A pointer to the direct iteration.*/
49
50 CConfig *config; /*!< \brief Definition of the particular problem. */
51 CIteration *iteration; /*!< \brief Container vector with all the iteration methods. */
52 CIntegration **integration; /*!< \brief Container vector with all the integration methods. */
53 CGeometry *geometry; /*!< \brief Geometrical definition of the problem. */
54 CSolver **solver; /*!< \brief Container vector with all the solutions. */
56 CNumerics ***numerics; /*!< \brief Container vector with all the numerics. */
57
58 /*!
59 * \brief Returns true if the objective function does not depend on the main variables. In which case,
60 * the adjoint variables are 0 and the sensitivities can be computed just with the secondary recording.
61 */
65
66 /*!
67 * \brief Record one iteration of a flow iteration in within multiple zones.
68 * \param[in] kind_recording - Type of recording (full list in ENUM_RECORDING, option_structure.hpp)
69 */
70 void SetRecording(RECORDING kind_recording);
71
72 /*!
73 * \brief Run one iteration of the solver.
74 * \param[in] kind_recording - Type of recording (full list in ENUM_RECORDING, option_structure.hpp)
75 */
76 void DirectRun(RECORDING kind_recording);
77
78 /*!
79 * \brief Set the objective function.
80 */
81 void SetObjFunction(void);
82
83 /*!
84 * \brief Initialize the adjoint value of the objective function.
85 */
86 void SetAdjObjFunction(void);
87
88 /*!
89 * \brief Record the main computational path.
90 */
91 void MainRecording(void);
92
93 /*!
94 * \brief Record the secondary computational path.
95 */
96 void SecondaryRecording(void);
97
98 /*!
99 * \brief gets Convergence on physical time scale, (deactivated in adjoint case)
100 * \return false
101 */
102 inline bool GetTimeConvergence() const override { return false; }
103
104public:
105
106 /*!
107 * \brief Constructor of the class.
108 * \param[in] confFile - Configuration file name.
109 * \param[in] val_nZone - Total number of zones.
110 * \param[in] val_nDim - Total number of dimensions.
111 * \param[in] MPICommunicator - MPI communicator for SU2.
112 */
113 CDiscAdjSinglezoneDriver(char* confFile,
114 unsigned short val_nZone,
115 SU2_Comm MPICommunicator);
116
117 /*!
118 * \brief Destructor of the class.
119 */
120 ~CDiscAdjSinglezoneDriver(void) override;
121
122 /*!
123 * \brief Preprocess the single-zone iteration
124 * \param[in] TimeIter - index of the current time-step.
125 */
126 void Preprocess(unsigned long TimeIter) override;
127
128 /*!
129 * \brief Run a single iteration of the discrete adjoint solver with a single zone.
130 */
131 void Run(void) override;
132
133 /*!
134 * \brief Postprocess the adjoint iteration for ZONE_0.
135 */
136 void Postprocess(void) override;
137};
Headers of the main subroutines for driving single or multi-zone problems. The subroutines and functi...
Main class for defining the problem; basically this class reads the configuration file,...
Definition CConfig.hpp:64
unsigned short GetKind_ObjFunc(unsigned short val_obj=0) const
Get the kind of objective function. There are several options: Drag coefficient, Lift coefficient,...
Definition CConfig.hpp:5606
unsigned short GetnObj(void) const
Get the total number of objectives in kind_objective list.
Definition CConfig.hpp:3327
Class for driving single-zone adjoint solvers.
Definition CDiscAdjSinglezoneDriver.hpp:39
RECORDING RecordingState
The kind of recording the tape currently holds.
Definition CDiscAdjSinglezoneDriver.hpp:43
CConfig * config
Definition of the particular problem.
Definition CDiscAdjSinglezoneDriver.hpp:50
unsigned long nAdjoint_Iter
The number of adjoint iterations that are run on the fixed-point solver.
Definition CDiscAdjSinglezoneDriver.hpp:42
CIteration * direct_iteration
A pointer to the direct iteration.
Definition CDiscAdjSinglezoneDriver.hpp:48
void Preprocess(unsigned long TimeIter) override
Preprocess the single-zone iteration.
Definition CDiscAdjSinglezoneDriver.cpp:132
CNumerics *** numerics
Container vector with all the numerics.
Definition CDiscAdjSinglezoneDriver.hpp:56
CSolver ** solver
Container vector with all the solutions.
Definition CDiscAdjSinglezoneDriver.hpp:54
bool GetTimeConvergence() const override
gets Convergence on physical time scale, (deactivated in adjoint case)
Definition CDiscAdjSinglezoneDriver.hpp:102
~CDiscAdjSinglezoneDriver(void) override
Destructor of the class.
Definition CDiscAdjSinglezoneDriver.cpp:124
CIteration * iteration
Container vector with all the iteration methods.
Definition CDiscAdjSinglezoneDriver.hpp:51
int MainSolver
Index of the main adjoint solver.
Definition CDiscAdjSinglezoneDriver.hpp:46
CIntegration ** integration
Container vector with all the integration methods.
Definition CDiscAdjSinglezoneDriver.hpp:52
void Postprocess(void) override
Postprocess the adjoint iteration for ZONE_0.
Definition CDiscAdjSinglezoneDriver.cpp:229
su2double ObjFunc
The value of the objective function.
Definition CDiscAdjSinglezoneDriver.hpp:47
void SetAdjObjFunction(void)
Initialize the adjoint value of the objective function.
Definition CDiscAdjSinglezoneDriver.cpp:333
void Run(void) override
Run a single iteration of the discrete adjoint solver with a single zone.
Definition CDiscAdjSinglezoneDriver.cpp:157
bool TrivialFunction() const
Returns true if the objective function does not depend on the main variables. In which case,...
Definition CDiscAdjSinglezoneDriver.hpp:62
RECORDING SecondaryVariables
The kind of recording linked to the secondary variables of the problem.
Definition CDiscAdjSinglezoneDriver.hpp:45
RECORDING MainVariables
The kind of recording linked to the main variables of the problem.
Definition CDiscAdjSinglezoneDriver.hpp:44
void DirectRun(RECORDING kind_recording)
Run one iteration of the solver.
Definition CDiscAdjSinglezoneDriver.cpp:399
void SetRecording(RECORDING kind_recording)
Record one iteration of a flow iteration in within multiple zones.
Definition CDiscAdjSinglezoneDriver.cpp:259
CGeometry * geometry
Geometrical definition of the problem.
Definition CDiscAdjSinglezoneDriver.hpp:53
void SecondaryRecording(void)
Record the secondary computational path.
Definition CDiscAdjSinglezoneDriver.cpp:447
COutput * direct_output
Definition CDiscAdjSinglezoneDriver.hpp:55
void SetObjFunction(void)
Set the objective function.
Definition CDiscAdjSinglezoneDriver.cpp:356
void MainRecording(void)
Record the main computational path.
Definition CDiscAdjSinglezoneDriver.cpp:424
CConfig ** config_container
Definition of the particular problem.
Definition CDriverBase.hpp:68
Parent class for defining the geometry of the problem (complete geometry, multigrid agglomerated geom...
Definition CGeometry.hpp:75
Main class for doing the space integration, time integration, and monitoring of a system of Partial D...
Definition CIntegration.hpp:47
Parent class for defining a single iteration of a physics problem.
Definition CIteration.hpp:50
Class for defining the numerical methods.
Definition CNumerics.hpp:48
Class for writing the convergence history and to write solution data to file.
Definition COutput.hpp:68
Class for driving single-zone solvers.
Definition CSinglezoneDriver.hpp:39
unsigned long TimeIter
Definition CSinglezoneDriver.hpp:42
Definition CSolver.hpp:71
passivedouble su2double
Definition code_config.hpp:181
int SU2_Comm
Definition mpi_structure.hpp:619
@ VOLUME_FRACTION
Volume average physical density, for material-based topology optimization applications.
Definition option_structure.hpp:2261
const unsigned int ZONE_0
Definition of the first grid domain.
Definition option_structure.hpp:90
RECORDING
Definition option_structure.hpp:2820