Documentation 6b54b78464
Loading...
Searching...
No Matches
CMeshBoundVariable.hpp
Go to the documentation of this file.
1/*!
2 * \file CMeshBoundVariable.hpp
3 * \brief Declaration and inlines of the class
4 * to define the variables of the mesh movement at the moving boundaries.
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 "CMeshVariable.hpp"
32#include "../../../Common/include/containers/CVertexMap.hpp"
33
34class CMeshBoundVariable final : public CMeshVariable {
35private:
36
37 MatrixType Boundary_Displacement; /*!< \brief Store the reference coordinates of the mesh. */
38 MatrixType Boundary_Velocity; /*!< \brief Store the boundary velocities of the mesh. */
39 CVertexMap<unsigned> VertexMap; /*!< \brief Object that controls accesses to the variables of this class. */
40
41public:
42
43 /*!
44 * \brief Constructor of the class.
45 * \param[in] val_coor - Values of the coordinates (initialization value).
46 * \param[in] ndim - Number of dimensions of the problem.
47 * \param[in] config - Definition of the particular problem.
48 */
49 CMeshBoundVariable(unsigned long npoint, unsigned long ndim, CConfig *config);
50
51 /*!
52 * \brief Destructor of the class.
53 */
54 ~CMeshBoundVariable() override = default;
55
56 /*!
57 * \brief Allocate member variables for points marked as vertex (via "Set_isVertex").
58 * \param[in] config - Definition of the particular problem.
59 */
61
62 /*!
63 * \brief Get the value of the displacement imposed at the boundary.
64 * \return Value of the boundary displacement.
65 */
66 inline su2double GetBound_Disp(unsigned long iPoint, unsigned long iDim) const override {
67 if (!VertexMap.GetVertexIndex(iPoint)) return 0.0;
68 return Boundary_Displacement(iPoint,iDim);
69 }
70
71 /*!
72 * \brief Set the boundary displacements.
73 * \param[in] val_BoundDisp - Pointer to the boundary displacements.
74 */
75 inline void SetBound_Disp(unsigned long iPoint, const su2double *val_BoundDisp) override {
76 if (!VertexMap.GetVertexIndex(iPoint)) return;
77 for (unsigned long iDim = 0; iDim < nDim; iDim++) Boundary_Displacement(iPoint,iDim) = val_BoundDisp[iDim];
78 }
79
80 /*!
81 * \brief Set the boundary displacement.
82 * \param[in] iDim - Index of the dimension of interest.
83 * \param[in] val_BoundDisp - Value of the boundary displacements.
84 */
85 inline void SetBound_Disp(unsigned long iPoint, unsigned long iDim, su2double val_BoundDisp) override {
86 if (!VertexMap.GetVertexIndex(iPoint)) return;
87 Boundary_Displacement(iPoint,iDim) = val_BoundDisp;
88 }
89
90 /*!
91 * \brief Get the value of the displacement imposed at the boundary.
92 * \return Value of the boundary velocity.
93 */
94 inline su2double GetBound_Vel(unsigned long iPoint, unsigned long iDim) const override {
95 if (!VertexMap.GetVertexIndex(iPoint)) return 0.0;
96 return Boundary_Velocity(iPoint,iDim);
97 }
98
99 /*!
100 * \brief Set the boundary displacements.
101 * \param[in] val_BoundVel - Pointer to the boundary velocities.
102 */
103 inline void SetBound_Vel(unsigned long iPoint, const su2double *val_BoundVel) override {
104 if (!VertexMap.GetVertexIndex(iPoint)) return;
105 for (unsigned long iDim = 0; iDim < nDim; iDim++) Boundary_Velocity(iPoint,iDim) = val_BoundVel[iDim];
106 }
107
108 /*!
109 * \brief Set the boundary velocity.
110 * \param[in] iDim - Index of the dimension of interest.
111 * \param[in] val_BoundVel - Value of the boundary velocities.
112 */
113 inline void SetBound_Vel(unsigned long iPoint, unsigned long iDim, su2double val_BoundVel) override {
114 if (!VertexMap.GetVertexIndex(iPoint)) return;
115 Boundary_Velocity(iPoint,iDim) = val_BoundVel;
116 }
117
118 /*!
119 * \brief Register the boundary displacements of the mesh.
120 */
121 void Register_BoundDisp() override;
122
123 /*!
124 * \brief Recover the value of the adjoint of the boundary displacements.
125 */
126 inline void GetAdjoint_BoundDisp(unsigned long iPoint, su2double *adj_disp) const override {
127 if (!VertexMap.GetVertexIndex(iPoint)) return;
128 for (unsigned long iVar = 0; iVar < nVar; iVar++) {
129 adj_disp[iVar] = SU2_TYPE::GetDerivative(Boundary_Displacement(iPoint,iVar));
130 }
131 }
132
133 /*!
134 * \brief Get whether a node is on the boundary.
135 */
136 inline bool Get_isVertex(unsigned long iPoint) const override {
137 return VertexMap.GetIsVertex(iPoint);
138 }
139
140 /*!
141 * \brief Set whether a node is on the boundary.
142 */
143 inline void Set_isVertex(unsigned long iPoint, bool isVertex) override {
144 VertexMap.SetIsVertex(iPoint,isVertex);
145 }
146
147 /*!
148 * \brief Get the vertex map used by this class.
149 */
150 inline const CVertexMap<unsigned>& GetVertexMap() const { return VertexMap; }
151
152};
Declaration and inlines of the class to define the variables of the mesh movement.
Main class for defining the problem; basically this class reads the configuration file,...
Definition CConfig.hpp:64
Definition CMeshBoundVariable.hpp:34
void AllocateBoundaryVariables(CConfig *config)
Allocate member variables for points marked as vertex (via "Set_isVertex").
Definition CMeshBoundVariable.cpp:36
void SetBound_Disp(unsigned long iPoint, const su2double *val_BoundDisp) override
Set the boundary displacements.
Definition CMeshBoundVariable.hpp:75
su2double GetBound_Vel(unsigned long iPoint, unsigned long iDim) const override
Get the value of the displacement imposed at the boundary.
Definition CMeshBoundVariable.hpp:94
void SetBound_Vel(unsigned long iPoint, unsigned long iDim, su2double val_BoundVel) override
Set the boundary velocity.
Definition CMeshBoundVariable.hpp:113
~CMeshBoundVariable() override=default
Destructor of the class.
void SetBound_Disp(unsigned long iPoint, unsigned long iDim, su2double val_BoundDisp) override
Set the boundary displacement.
Definition CMeshBoundVariable.hpp:85
void SetBound_Vel(unsigned long iPoint, const su2double *val_BoundVel) override
Set the boundary displacements.
Definition CMeshBoundVariable.hpp:103
const CVertexMap< unsigned > & GetVertexMap() const
Get the vertex map used by this class.
Definition CMeshBoundVariable.hpp:150
void Set_isVertex(unsigned long iPoint, bool isVertex) override
Set whether a node is on the boundary.
Definition CMeshBoundVariable.hpp:143
su2double GetBound_Disp(unsigned long iPoint, unsigned long iDim) const override
Get the value of the displacement imposed at the boundary.
Definition CMeshBoundVariable.hpp:66
bool Get_isVertex(unsigned long iPoint) const override
Get whether a node is on the boundary.
Definition CMeshBoundVariable.hpp:136
void Register_BoundDisp() override
Register the boundary displacements of the mesh.
Definition CMeshBoundVariable.cpp:50
void GetAdjoint_BoundDisp(unsigned long iPoint, su2double *adj_disp) const override
Recover the value of the adjoint of the boundary displacements.
Definition CMeshBoundVariable.hpp:126
Definition CMeshVariable.hpp:33
unsigned long nVar
Number of variables of the problem.
Definition CVariable.hpp:108
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
passivedouble GetDerivative(const su2double &data)
Get the derivative value of the datatype (needs to be implemented for each new type).
Definition datatype_structure.hpp:117