Documentation 6b54b78464
Loading...
Searching...
No Matches
CDiscAdjFEABoundVariable.hpp
Go to the documentation of this file.
1/*!
2 * \file CDiscAdjFEABoundVariable.hpp
3 * \brief Main class for defining the variables of the adjoint FEA solver at the boundary.
4 * \author Ruben Sanchez
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 "CDiscAdjVariable.hpp"
31#include "../../../Common/include/containers/CVertexMap.hpp"
32
33/*!
34 * \class CDiscAdjFEABoundVariable
35 * \ingroup DiscAdj
36 * \brief Main class for defining the variables on the FEA boundaries for adjoint applications.
37 * \author R. Sanchez.
38 * \version 8.5.0 "Harrier"
39 */
41private:
42
43 MatrixType FlowTraction_Sens; /*!< \brief Adjoint of the flow tractions. */
44 MatrixType SourceTerm_DispAdjoint; /*!< \brief Source term applied into the displacement
45 adjoint coming from external solvers. */
46 MatrixType SourceTerm_VelAdjoint;
47
48 CVertexMap<unsigned> VertexMap; /*!< \brief Object that controls accesses to the variables of this class. */
49
50public:
51 /*!
52 * \overload
53 * \param[in] sol - Pointer to the adjoint value (initialization value).
54 * \param[in] npoint - Number of points/nodes/vertices in the domain.
55 * \param[in] ndim - Number of dimensions of the problem.
56 * \param[in] nvar - Number of variables of the problem.
57 * \param[in] config - Definition of the particular problem.
58 */
59 CDiscAdjFEABoundVariable(const su2double *sol, unsigned long npoint, unsigned long ndim,
60 unsigned long nvar, CConfig *config);
61
62 /*!
63 * \brief Destructor of the class.
64 */
65 ~CDiscAdjFEABoundVariable() override = default;
66
67 /*!
68 * \brief Allocate member variables for points marked as vertex (via "Set_isVertex").
69 * \param[in] config - Definition of the particular problem.
70 */
72
73 /*!
74 * \brief Set the FSI force sensitivity at the node
75 * \param[in] iDim - spacial component
76 * \param[in] val - value of the Sensitivity
77 */
78 inline void SetFlowTractionSensitivity(unsigned long iPoint, unsigned long iDim, su2double val) override {
79 if (!VertexMap.GetVertexIndex(iPoint)) return;
80 FlowTraction_Sens(iPoint,iDim) = val;
81 }
82
83 /*!
84 * \brief Get the FSI force sensitivity at the node
85 * \param[in] iDim - spacial component
86 * \return value of the Sensitivity
87 */
88 inline su2double GetFlowTractionSensitivity(unsigned long iPoint, unsigned long iDim) const override {
89 if (!VertexMap.GetVertexIndex(iPoint)) return 0.0;
90 return FlowTraction_Sens(iPoint,iDim);
91 }
92
93 /*!
94 * \brief Set the source term applied into the displacement adjoint coming from external solvers
95 * \param[in] iDim - spacial component
96 * \param[in] val - value of the source term
97 */
98 inline void SetSourceTerm_DispAdjoint(unsigned long iPoint, unsigned long iDim, su2double val) override {
99 if (!VertexMap.GetVertexIndex(iPoint)) return;
100 SourceTerm_DispAdjoint(iPoint,iDim) = val;
101 }
102 inline void SetSourceTerm_VelAdjoint(unsigned long iPoint, unsigned long iDim, su2double val) override {
103 if (!VertexMap.GetVertexIndex(iPoint)) return;
104 SourceTerm_VelAdjoint(iPoint,iDim) = val;
105 }
106
107 /*!
108 * \brief Get the source term applied into the displacement adjoint coming from external solvers
109 * \param[in] iDim - spacial component
110 * \return value of the source term
111 */
112 inline su2double GetSourceTerm_DispAdjoint(unsigned long iPoint, unsigned long iDim) const override {
113 if (!VertexMap.GetVertexIndex(iPoint)) return 0.0;
114 return SourceTerm_DispAdjoint(iPoint,iDim);
115 }
116 inline su2double GetSourceTerm_VelAdjoint(unsigned long iPoint, unsigned long iDim) const override {
117 if (!VertexMap.GetVertexIndex(iPoint)) return 0.0;
118 return SourceTerm_VelAdjoint(iPoint,iDim);
119 }
120
121 /*!
122 * \brief Get whether a node is on the boundary
123 */
124 inline bool Get_isVertex(unsigned long iPoint) const override {
125 return VertexMap.GetIsVertex(iPoint);
126 }
127
128 /*!
129 * \brief Set whether a node is on the boundary
130 */
131 inline void Set_isVertex(unsigned long iPoint, bool isVertex) override {
132 VertexMap.SetIsVertex(iPoint,isVertex);
133 }
134
135};
Main class for defining the variables of the adjoint solver.
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 FEA boundaries for adjoint applications.
Definition CDiscAdjFEABoundVariable.hpp:40
void SetSourceTerm_DispAdjoint(unsigned long iPoint, unsigned long iDim, su2double val) override
Set the source term applied into the displacement adjoint coming from external solvers.
Definition CDiscAdjFEABoundVariable.hpp:98
void Set_isVertex(unsigned long iPoint, bool isVertex) override
Set whether a node is on the boundary.
Definition CDiscAdjFEABoundVariable.hpp:131
su2double GetFlowTractionSensitivity(unsigned long iPoint, unsigned long iDim) const override
Get the FSI force sensitivity at the node.
Definition CDiscAdjFEABoundVariable.hpp:88
su2double GetSourceTerm_VelAdjoint(unsigned long iPoint, unsigned long iDim) const override
Definition CDiscAdjFEABoundVariable.hpp:116
su2double GetSourceTerm_DispAdjoint(unsigned long iPoint, unsigned long iDim) const override
Get the source term applied into the displacement adjoint coming from external solvers.
Definition CDiscAdjFEABoundVariable.hpp:112
void SetSourceTerm_VelAdjoint(unsigned long iPoint, unsigned long iDim, su2double val) override
Definition CDiscAdjFEABoundVariable.hpp:102
~CDiscAdjFEABoundVariable() override=default
Destructor of the class.
void AllocateBoundaryVariables(CConfig *config)
Allocate member variables for points marked as vertex (via "Set_isVertex").
Definition CDiscAdjFEABoundVariable.cpp:37
void SetFlowTractionSensitivity(unsigned long iPoint, unsigned long iDim, su2double val) override
Set the FSI force sensitivity at the node.
Definition CDiscAdjFEABoundVariable.hpp:78
bool Get_isVertex(unsigned long iPoint) const override
Get whether a node is on the boundary.
Definition CDiscAdjFEABoundVariable.hpp:124
Main class for defining the variables of the adjoint solver.
Definition CDiscAdjVariable.hpp:38
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