Documentation 6b54b78464
Loading...
Searching...
No Matches
CFEABoundVariable.hpp
Go to the documentation of this file.
1/*!
2 * \file CFEABoundVariable.hpp
3 * \brief Class for defining the variables on the FEA boundaries for FSI applications.
4 * \author F. Palacios, T. Economon
5 * \version 8.5.0 "Harrier"
6 *
7 * SU2 Project Website: https://su2code.github.io
8 *
9 * The SU2 Project is maintained by the SU2 Foundation
10 * (http://su2foundation.org)
11 *
12 * Copyright 2012-2026, SU2 Contributors (cf. AUTHORS.md)
13 *
14 * SU2 is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Lesser General Public
16 * License as published by the Free Software Foundation; either
17 * version 2.1 of the License, or (at your option) any later version.
18 *
19 * SU2 is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Lesser General Public License for more details.
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with SU2. If not, see <http://www.gnu.org/licenses/>.
26 */
27
28#pragma once
29
30#include "CFEAVariable.hpp"
31#include "../../../Common/include/containers/CVertexMap.hpp"
32
33/*!
34 * \class CFEABoundVariable
35 * \brief Class that adds storage of boundary variables (tractions) to CFEAVariable.
36 * \note Member variables are allocated only for points marked as "vertex" i.e. on a boundary.
37 * A map is constructed so that variables can be referenced by iPoint instead of iVertex.
38 * \ingroup Structural Finite Element Analysis Variables
39 * \author R. Sanchez.
40 * \version 8.5.0 "Harrier"
41 */
42class CFEABoundVariable final : public CFEAVariable {
43protected:
44
45 MatrixType FlowTraction; /*!< \brief Traction from the fluid field. */
46 MatrixType FlowTraction_n; /*!< \brief Traction from the fluid field at time n. */
47
48 MatrixType Residual_Ext_Surf; /*!< \brief Term of the residual due to external forces. */
49 MatrixType Residual_Ext_Surf_n; /*!< \brief Term of the residual due to external forces at time n. */
50
51 CVertexMap<unsigned> VertexMap; /*!< \brief Object that controls accesses to the variables of this class. */
52
53 bool fsi_analysis = false; /*!< \brief If flow tractions are available. */
54
55public:
56 /*!
57 * \brief Constructor of the class.
58 * \param[in] val_fea - Values of the fea solution (initialization value).
59 * \param[in] npoint - Number of points/nodes/vertices in the domain.
60 * \param[in] ndim - Number of dimensions of the problem.
61 * \param[in] nvar - Number of variables of the problem.
62 * \param[in] config - Definition of the particular problem.
63 */
64 CFEABoundVariable(const su2double *val_fea, unsigned long npoint, unsigned long ndim, unsigned long nvar, CConfig *config);
65
66 /*!
67 * \brief Destructor of the class.
68 */
69 ~CFEABoundVariable() override = default;
70
71 /*!
72 * \brief Allocate member variables for points marked as vertex (via "Set_isVertex").
73 * \param[in] config - Definition of the particular problem.
74 */
76
77 /*!
78 * \brief Add surface load to the residual term
79 */
80 inline void Add_SurfaceLoad_Res(unsigned long iPoint, const su2double *val_surfForce) override {
81 if (!VertexMap.GetVertexIndex(iPoint)) return;
82 for (unsigned long iVar = 0; iVar < nVar; iVar++) Residual_Ext_Surf(iPoint,iVar) += val_surfForce[iVar];
83 }
84
85 /*!
86 * \brief Get the residual term due to surface load
87 */
88 inline su2double Get_SurfaceLoad_Res(unsigned long iPoint, unsigned long iVar) const override {
89 if (!VertexMap.GetVertexIndex(iPoint)) return 0.0;
90 return Residual_Ext_Surf(iPoint,iVar);
91 }
92
93 /*!
94 * \brief Clear the surface load residual
95 */
96 inline void Clear_SurfaceLoad_Res() override;
97
98 /*!
99 * \brief Store the surface load as the load for the previous time step.
100 */
101 void Set_SurfaceLoad_Res_n() override;
102
103 /*!
104 * \brief Get the surface load from the previous time step.
105 */
106 inline su2double Get_SurfaceLoad_Res_n(unsigned long iPoint, unsigned long iVar) const override {
107 if (!VertexMap.GetVertexIndex(iPoint)) return 0.0;
108 return Residual_Ext_Surf_n(iPoint,iVar);
109 }
110
111 /*!
112 * \brief Set the flow traction at a node on the structural side
113 */
114 inline void Set_FlowTraction(unsigned long iPoint, const su2double *val_flowTraction) override {
115 if (!fsi_analysis) return;
116 if (!VertexMap.GetVertexIndex(iPoint)) return;
117 for (unsigned long iVar = 0; iVar < nVar; iVar++) FlowTraction(iPoint,iVar) = val_flowTraction[iVar];
118 }
119
120 /*!
121 * \brief Add a value to the flow traction at a node on the structural side
122 */
123 inline void Add_FlowTraction(unsigned long iPoint, const su2double *val_flowTraction) override {
124 if (!fsi_analysis) return;
125 if (!VertexMap.GetVertexIndex(iPoint)) return;
126 for (unsigned long iVar = 0; iVar < nVar; iVar++) FlowTraction(iPoint,iVar) += val_flowTraction[iVar];
127 }
128
129 /*!
130 * \brief Get the residual term due to the flow traction
131 */
132 inline su2double Get_FlowTraction(unsigned long iPoint, unsigned long iVar) const override {
133 if (!fsi_analysis) return 0.0;
134 if (!VertexMap.GetVertexIndex(iPoint)) return 0.0;
135 return FlowTraction(iPoint,iVar);
136 }
137
138 /*!
139 * \brief Set the value of the flow traction at the previous time step.
140 */
141 void Set_FlowTraction_n() override;
142
143 /*!
144 * \brief Retrieve the value of the flow traction from the previous time step.
145 */
146 inline su2double Get_FlowTraction_n(unsigned long iPoint, unsigned long iVar) const override {
147 if (!fsi_analysis) return 0.0;
148 if (!VertexMap.GetVertexIndex(iPoint)) return 0.0;
149 return FlowTraction_n(iPoint,iVar);
150 }
151
152 /*!
153 * \brief Register the flow tractions as input variable.
154 */
155 void RegisterFlowTraction(bool reset) override;
156
157 /*!
158 * \brief Extract the flow traction derivatives.
159 */
160 inline su2double ExtractFlowTractionSensitivity(unsigned long iPoint, unsigned long iDim) const override {
161 if (!fsi_analysis) return 0.0;
162 if (!VertexMap.GetVertexIndex(iPoint)) return 0.0;
163 return SU2_TYPE::GetDerivative(FlowTraction(iPoint,iDim));
164 }
165
166 /*!
167 * \brief Get whether a node is on the boundary
168 */
169 inline bool Get_isVertex(unsigned long iPoint) const override {
170 return VertexMap.GetIsVertex(iPoint);
171 }
172
173 /*!
174 * \brief Set whether a node is on the boundary
175 */
176 inline void Set_isVertex(unsigned long iPoint, bool isVertex) override {
177 VertexMap.SetIsVertex(iPoint,isVertex);
178 }
179
180};
Class for defining the variables of the FEM structural problem.
Main class for defining the problem; basically this class reads the configuration file,...
Definition CConfig.hpp:64
Class that adds storage of boundary variables (tractions) to CFEAVariable.
Definition CFEABoundVariable.hpp:42
su2double ExtractFlowTractionSensitivity(unsigned long iPoint, unsigned long iDim) const override
Extract the flow traction derivatives.
Definition CFEABoundVariable.hpp:160
void RegisterFlowTraction(bool reset) override
Register the flow tractions as input variable.
Definition CFEABoundVariable.cpp:70
void Set_FlowTraction(unsigned long iPoint, const su2double *val_flowTraction) override
Set the flow traction at a node on the structural side.
Definition CFEABoundVariable.hpp:114
bool fsi_analysis
If flow tractions are available.
Definition CFEABoundVariable.hpp:53
CVertexMap< unsigned > VertexMap
Object that controls accesses to the variables of this class.
Definition CFEABoundVariable.hpp:51
void Set_FlowTraction_n() override
Set the value of the flow traction at the previous time step.
Definition CFEABoundVariable.cpp:64
void Set_isVertex(unsigned long iPoint, bool isVertex) override
Set whether a node is on the boundary.
Definition CFEABoundVariable.hpp:176
void AllocateBoundaryVariables(CConfig *config)
Allocate member variables for points marked as vertex (via "Set_isVertex").
Definition CFEABoundVariable.cpp:38
void Clear_SurfaceLoad_Res() override
Clear the surface load residual.
Definition CFEABoundVariable.cpp:68
su2double Get_FlowTraction_n(unsigned long iPoint, unsigned long iVar) const override
Retrieve the value of the flow traction from the previous time step.
Definition CFEABoundVariable.hpp:146
MatrixType Residual_Ext_Surf_n
Term of the residual due to external forces at time n.
Definition CFEABoundVariable.hpp:49
su2double Get_FlowTraction(unsigned long iPoint, unsigned long iVar) const override
Get the residual term due to the flow traction.
Definition CFEABoundVariable.hpp:132
void Add_SurfaceLoad_Res(unsigned long iPoint, const su2double *val_surfForce) override
Add surface load to the residual term.
Definition CFEABoundVariable.hpp:80
su2double Get_SurfaceLoad_Res(unsigned long iPoint, unsigned long iVar) const override
Get the residual term due to surface load.
Definition CFEABoundVariable.hpp:88
MatrixType FlowTraction
Traction from the fluid field.
Definition CFEABoundVariable.hpp:45
void Set_SurfaceLoad_Res_n() override
Store the surface load as the load for the previous time step.
Definition CFEABoundVariable.cpp:66
MatrixType Residual_Ext_Surf
Term of the residual due to external forces.
Definition CFEABoundVariable.hpp:48
void Add_FlowTraction(unsigned long iPoint, const su2double *val_flowTraction) override
Add a value to the flow traction at a node on the structural side.
Definition CFEABoundVariable.hpp:123
MatrixType FlowTraction_n
Traction from the fluid field at time n.
Definition CFEABoundVariable.hpp:46
bool Get_isVertex(unsigned long iPoint) const override
Get whether a node is on the boundary.
Definition CFEABoundVariable.hpp:169
su2double Get_SurfaceLoad_Res_n(unsigned long iPoint, unsigned long iVar) const override
Get the surface load from the previous time step.
Definition CFEABoundVariable.hpp:106
~CFEABoundVariable() override=default
Destructor of the class.
Class for defining the variables of the FEM structural problem.
Definition CFEAVariable.hpp:39
unsigned long nVar
Number of variables of the problem.
Definition CVariable.hpp:108
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