Documentation a537f1bdf2
Loading...
Searching...
No Matches
CMeshVariable.hpp
Go to the documentation of this file.
1/*!
2 * \file CMeshVariable.hpp
3 * \brief Declaration and inlines of the class
4 * to define the 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
33class CMeshVariable : public CVariable {
34protected:
35
36 VectorType WallDistance; /*!< \brief Store the wall distance in reference coordinates. */
37 MatrixType Mesh_Coord; /*!< \brief Store the reference coordinates of the mesh. */
38
39 /*!
40 * \brief Constructor of the class.
41 * \param[in] npoint - Number of points/nodes/vertices in the domain.
42 * \param[in] ndim - Number of dimensions of the problem.
43 * \param[in] config - Definition of the particular problem.
44 */
45 CMeshVariable(unsigned long npoint, unsigned long ndim, CConfig *config);
46
47public:
48 /*!
49 * \brief Destructor of the class.
50 */
51 ~CMeshVariable() override = default;
52
53 /*!
54 * \brief Get the value of the undeformed coordinates.
55 * \param[in] iDim - Index of Mesh_Coord[nDim]
56 * \return Value of the original coordinate iDim.
57 */
58 inline su2double GetMesh_Coord(unsigned long iPoint, unsigned long iDim) const final { return Mesh_Coord(iPoint,iDim); }
59
60 /*!
61 * \brief Get the undeformed coordinates.
62 * \return Pointer to the reference coordinates.
63 */
64 inline const su2double *GetMesh_Coord(unsigned long iPoint) const final { return Mesh_Coord[iPoint]; }
65
66 /*!
67 * \brief Get the undeformed coordinates for the entire domain.
68 */
69 inline const MatrixType* GetMesh_Coord() const final { return &Mesh_Coord; }
70
71 /*!
72 * \brief Set the value of the undeformed coordinates.
73 * \param[in] iDim - Index of Mesh_Coord[nDim]
74 * \param[in] val_coord - Value of Mesh_Coord[nDim]
75 */
76 inline void SetMesh_Coord(unsigned long iPoint, unsigned long iDim, su2double val_coord) final {
77 Mesh_Coord(iPoint,iDim) = val_coord;
78 }
79
80 /*!
81 * \brief Get the value of the wall distance in reference coordinates.
82 * \param[in] iDim - Index of Mesh_Coord[nDim]
83 * \return Value of the wall distance in reference coordinates.
84 */
85 inline su2double GetWallDistance(unsigned long iPoint) const final { return WallDistance(iPoint); }
86
87 /*!
88 * \brief Set the value of the wall distance in reference coordinates.
89 * \param[in] val_dist - Value of wall distance.
90 */
91 inline void SetWallDistance(unsigned long iPoint, su2double val_dist) final { WallDistance(iPoint) = val_dist; }
92
93 /*!
94 * \brief Register the reference coordinates of the mesh.
95 */
96 void Register_MeshCoord() final;
97
98 /*!
99 * \brief Recover the value of the adjoint of the mesh coordinates.
100 */
101 inline void GetAdjoint_MeshCoord(unsigned long iPoint, su2double *adj_mesh) final {
102 for (unsigned long iDim = 0; iDim < nDim; iDim++) {
103 adj_mesh[iDim] = SU2_TYPE::GetDerivative(Mesh_Coord(iPoint,iDim));
104 AD::ResetInput(Mesh_Coord(iPoint,iDim));
105 }
106 }
107
108};
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
Definition CMeshVariable.hpp:33
~CMeshVariable() override=default
Destructor of the class.
const su2double * GetMesh_Coord(unsigned long iPoint) const final
Get the undeformed coordinates.
Definition CMeshVariable.hpp:64
void Register_MeshCoord() final
Register the reference coordinates of the mesh.
Definition CMeshVariable.cpp:48
su2double GetMesh_Coord(unsigned long iPoint, unsigned long iDim) const final
Get the value of the undeformed coordinates.
Definition CMeshVariable.hpp:58
void SetMesh_Coord(unsigned long iPoint, unsigned long iDim, su2double val_coord) final
Set the value of the undeformed coordinates.
Definition CMeshVariable.hpp:76
su2double GetWallDistance(unsigned long iPoint) const final
Get the value of the wall distance in reference coordinates.
Definition CMeshVariable.hpp:85
void SetWallDistance(unsigned long iPoint, su2double val_dist) final
Set the value of the wall distance in reference coordinates.
Definition CMeshVariable.hpp:91
const MatrixType * GetMesh_Coord() const final
Get the undeformed coordinates for the entire domain.
Definition CMeshVariable.hpp:69
void GetAdjoint_MeshCoord(unsigned long iPoint, su2double *adj_mesh) final
Recover the value of the adjoint of the mesh coordinates.
Definition CMeshVariable.hpp:101
MatrixType Mesh_Coord
Store the reference coordinates of the mesh.
Definition CMeshVariable.hpp:37
VectorType WallDistance
Store the wall distance in reference coordinates.
Definition CMeshVariable.hpp:36
Main class for defining the variables.
Definition CVariable.hpp:50
unsigned long nDim
Number of dimension of the problem.
Definition CVariable.hpp:107
passivedouble su2double
Definition code_config.hpp:181
void ResetInput(su2double &data)
Reset the variable (set index to zero).
Definition ad_structure.hpp:179
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