Documentation 6b54b78464
Loading...
Searching...
No Matches
CDiscAdjMeshBoundVariable.hpp
Go to the documentation of this file.
1/*!
2 * \file CDiscAdjMeshVariable.hpp
3 * \brief Declaration and inlines of the class
4 * to define the adjoint variables of the mesh movement.
5 * \author Ruben 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
31#include "CVariable.hpp"
32#include "../../../Common/include/containers/CVertexMap.hpp"
33
34/*!
35 * \ingroup DiscAdj
36 * \brief Main class for defining the variables on the mesh deformation boundaries for adjoint applications.
37 */
39private:
40
41 MatrixType Bound_Disp_Sens; /*!< \brief Store the reference coordinates of the mesh. */
42 MatrixType Bound_Disp_Direct; /*!< \brief Store the reference boundary displacements of the mesh. */
43
44 CVertexMap<unsigned> VertexMap; /*!< \brief Object that controls accesses to the variables of this class. */
45
46public:
47
48 /*!
49 * \brief Constructor of the class.
50 * \param[in] npoint - Values of the coordinates (initialization value).
51 * \param[in] ndim - Number of dimensions of the problem.
52 * \param[in] config - Definition of the particular problem.
53 */
54 CDiscAdjMeshBoundVariable(unsigned long npoint, unsigned long ndim, CConfig *config);
55
56 /*!
57 * \brief Destructor of the class.
58 */
59 ~CDiscAdjMeshBoundVariable() override = default;
60
61 /*!
62 * \brief Allocate member variables for points marked as vertex (via "Set_isVertex").
63 * \param[in] config - Definition of the particular problem.
64 */
66
67 /*!
68 * \brief Get the value of the displacement imposed at the boundary.
69 * \return Value of the boundary displacement.
70 */
71 inline const su2double* GetBoundDisp_Direct(unsigned long iPoint) const override {
72 if (!VertexMap.GetVertexIndex(iPoint)) return nullptr;
73 return Bound_Disp_Direct[iPoint];
74 }
75
76 /*!
77 * \brief Set the solution for the boundary displacements.
78 * \param[in] val_BoundDisp - Pointer to the boundary displacements.
79 */
80 inline void SetBoundDisp_Direct(unsigned long iPoint, const su2double *val_BoundDisp) override {
81 if (!VertexMap.GetVertexIndex(iPoint)) return;
82 for (unsigned long iDim = 0; iDim < nDim; iDim++)
83 Bound_Disp_Direct(iPoint,iDim) = val_BoundDisp[iDim];
84 }
85
86 /*!
87 * \brief Set the value of the sensitivity with respect to the undeformed coordinates.
88 * \param[in] val_sens - Pointer to the sensitivities of the boundary displacements.
89 */
90 inline void SetBoundDisp_Sens(unsigned long iPoint, const su2double *val_sens) override {
91 if (!VertexMap.GetVertexIndex(iPoint)) return;
92 for (unsigned long iDim = 0; iDim < nDim; iDim++)
93 Bound_Disp_Sens(iPoint,iDim) = val_sens[iDim];
94 }
95
96 /*!
97 * \brief Get the value of the sensitivity with respect to the undeformed coordinates.
98 * \param[in] iDim - Index of Mesh_Coord_Sens[nDim]
99 * \return Value of the original Mesh_Coord_Sens iDim.
100 */
101 inline su2double GetBoundDisp_Sens(unsigned long iPoint, unsigned long iDim) const override {
102 if (!VertexMap.GetVertexIndex(iPoint)) return 0.0;
103 return Bound_Disp_Sens(iPoint,iDim);
104 }
105
106 /*!
107 * \brief Get whether a node is on the boundary
108 */
109 inline bool Get_isVertex(unsigned long iPoint) const override {
110 return VertexMap.GetIsVertex(iPoint);
111 }
112
113 /*!
114 * \brief Set whether a node is on the boundary
115 */
116 inline void Set_isVertex(unsigned long iPoint, bool isVertex) override {
117 VertexMap.SetIsVertex(iPoint,isVertex);
118 }
119
120 /*!
121 * \brief Get the value of the BGS solution.
122 */
123 inline su2double Get_BGSSolution(unsigned long iPoint, unsigned long iDim) const override {
124 if (!VertexMap.GetVertexIndex(iPoint)) return 0.0;
125 return Bound_Disp_Sens(iPoint,iDim);
126 }
127
128 /*!
129 * \brief Set the value of the solution in the previous BGS subiteration.
130 */
131 void Set_BGSSolution_k() override;
132
133 /*!
134 * \brief Restore the previous BGS subiteration to solution.
135 */
136 void Restore_BGSSolution_k() override;
137
138 /*!
139 * \brief Get the value of the solution in the previous BGS subiteration.
140 * \param[out] val_solution - solution in the previous BGS subiteration.
141 */
142 inline su2double Get_BGSSolution_k(unsigned long iPoint, unsigned long iDim) const override {
143 if (!VertexMap.GetVertexIndex(iPoint)) return 0.0;
144 return Solution_BGS_k(iPoint,iDim);
145 }
146
147 /*!
148 * \brief Get the value of the solution in the previous BGS subiteration.
149 * \param[out] val_solution - solution in the previous BGS subiteration.
150 */
151 inline void Set_BGSSolution_k(unsigned long iPoint, unsigned long iDim, su2double val) override {
152 if (!VertexMap.GetVertexIndex(iPoint)) return;
153 Solution_BGS_k(iPoint,iDim) = val;
154 }
155
156};
Declaration and inlines of the parent class for defining problem variables, function definitions in f...
Main class for defining the problem; basically this class reads the configuration file,...
Definition CConfig.hpp:64
Main class for defining the variables on the mesh deformation boundaries for adjoint applications.
Definition CDiscAdjMeshBoundVariable.hpp:38
su2double Get_BGSSolution(unsigned long iPoint, unsigned long iDim) const override
Get the value of the BGS solution.
Definition CDiscAdjMeshBoundVariable.hpp:123
void SetBoundDisp_Direct(unsigned long iPoint, const su2double *val_BoundDisp) override
Set the solution for the boundary displacements.
Definition CDiscAdjMeshBoundVariable.hpp:80
void Set_BGSSolution_k() override
Set the value of the solution in the previous BGS subiteration.
Definition CDiscAdjMeshBoundVariable.cpp:67
su2double GetBoundDisp_Sens(unsigned long iPoint, unsigned long iDim) const override
Get the value of the sensitivity with respect to the undeformed coordinates.
Definition CDiscAdjMeshBoundVariable.hpp:101
~CDiscAdjMeshBoundVariable() override=default
Destructor of the class.
void Set_BGSSolution_k(unsigned long iPoint, unsigned long iDim, su2double val) override
Get the value of the solution in the previous BGS subiteration.
Definition CDiscAdjMeshBoundVariable.hpp:151
void SetBoundDisp_Sens(unsigned long iPoint, const su2double *val_sens) override
Set the value of the sensitivity with respect to the undeformed coordinates.
Definition CDiscAdjMeshBoundVariable.hpp:90
void AllocateBoundaryVariables(CConfig *config)
Allocate member variables for points marked as vertex (via "Set_isVertex").
Definition CDiscAdjMeshBoundVariable.cpp:44
void Restore_BGSSolution_k() override
Restore the previous BGS subiteration to solution.
Definition CDiscAdjMeshBoundVariable.cpp:71
su2double Get_BGSSolution_k(unsigned long iPoint, unsigned long iDim) const override
Get the value of the solution in the previous BGS subiteration.
Definition CDiscAdjMeshBoundVariable.hpp:142
void Set_isVertex(unsigned long iPoint, bool isVertex) override
Set whether a node is on the boundary.
Definition CDiscAdjMeshBoundVariable.hpp:116
const su2double * GetBoundDisp_Direct(unsigned long iPoint) const override
Get the value of the displacement imposed at the boundary.
Definition CDiscAdjMeshBoundVariable.hpp:71
bool Get_isVertex(unsigned long iPoint) const override
Get whether a node is on the boundary.
Definition CDiscAdjMeshBoundVariable.hpp:109
Main class for defining the variables.
Definition CVariable.hpp:50
MatrixType Solution_BGS_k
Old solution container for BGS iterations.
Definition CVariable.hpp:95
unsigned long nDim
Number of dimension of the problem.
Definition CVariable.hpp:107
A lookup type map, maps indices in a large range to indices in a smaller one.
Definition CVertexMap.hpp:53
bool GetIsVertex(unsigned long iPoint) const
Get wheter a point is marked as vertex.
Definition CVertexMap.hpp:97
bool SetIsVertex(unsigned long iPoint, bool isVertex)
Set the vertex status of a point.
Definition CVertexMap.hpp:85
bool GetVertexIndex(unsigned long &iVertex) const
Convert a point index to vertex index.
Definition CVertexMap.hpp:121
passivedouble su2double
Definition code_config.hpp:181