|
| 1 | +/*! |
| 2 | + * \file CLinearElasticity.hpp |
| 3 | + * \brief Headers of the CLinearElasticity class. |
| 4 | + * \author F. Palacios, A. Bueno, T. Economon, S. Padron. |
| 5 | + * \version 8.2.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-2025, 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 | +#include "CVolumetricMovement.hpp" |
| 30 | +#include "../linear_algebra/CSysMatrix.hpp" |
| 31 | +#include "../linear_algebra/CSysVector.hpp" |
| 32 | +#include "../linear_algebra/CSysSolve.hpp" |
| 33 | + |
| 34 | +/*! |
| 35 | + * \class CLinearElasticity |
| 36 | + * \brief Class for moving the volumetric numerical grid using the linear elasticity analogy. |
| 37 | + * \author F. Palacios, A. Bueno, T. Economon, S. Padron. |
| 38 | + */ |
| 39 | +class CLinearElasticity final : public CVolumetricMovement { |
| 40 | + protected: |
| 41 | + unsigned short nVar; /*!< \brief Number of variables. */ |
| 42 | + |
| 43 | + unsigned long nPoint; /*!< \brief Number of points. */ |
| 44 | + unsigned long nPointDomain; /*!< \brief Number of points in the domain. */ |
| 45 | + |
| 46 | + unsigned long nIterMesh; /*!< \brief Number of iterations in the mesh update. +*/ |
| 47 | + |
| 48 | +#ifndef CODI_FORWARD_TYPE |
| 49 | + CSysMatrix<su2mixedfloat> StiffMatrix; /*!< \brief Stiffness matrix of the elasticity problem. */ |
| 50 | + CSysSolve<su2mixedfloat> System; /*!< \brief Linear solver/smoother. */ |
| 51 | +#else |
| 52 | + CSysMatrix<su2double> StiffMatrix; |
| 53 | + CSysSolve<su2double> System; |
| 54 | +#endif |
| 55 | + CSysVector<su2double> LinSysSol; |
| 56 | + CSysVector<su2double> LinSysRes; |
| 57 | + |
| 58 | + public: |
| 59 | + /*! |
| 60 | + * \brief Constructor of the class. |
| 61 | + */ |
| 62 | + CLinearElasticity(CGeometry* geometry, CConfig* config); |
| 63 | + |
| 64 | + /*! |
| 65 | + * \brief Destructor of the class. |
| 66 | + */ |
| 67 | + ~CLinearElasticity() override; |
| 68 | + |
| 69 | + /*! |
| 70 | + * \brief Grid deformation using the spring analogy method. |
| 71 | + * \param[in] geometry - Geometrical definition of the problem. |
| 72 | + * \param[in] config - Definition of the particular problem. |
| 73 | + * \param[in] UpdateGeo - Update geometry. |
| 74 | + * \param[in] Derivative - Compute the derivative (disabled by default). Does not actually deform the grid if enabled. |
| 75 | + */ |
| 76 | + void SetVolume_Deformation(CGeometry* geometry, CConfig* config, bool UpdateGeo, bool Derivative, |
| 77 | + bool ForwardProjectionDerivative) override; |
| 78 | + |
| 79 | + private: |
| 80 | + /*! |
| 81 | + * \brief Update the value of the coordinates after the grid movement. |
| 82 | + * \param[in] geometry - Geometrical definition of the problem. |
| 83 | + * \param[in] config - Definition of the particular problem. |
| 84 | + */ |
| 85 | + void UpdateGridCoord(CGeometry* geometry, CConfig* config); |
| 86 | + |
| 87 | + /*! |
| 88 | + * \brief Update the derivatives of the coordinates after the grid movement. |
| 89 | + * \param[in] geometry - Geometrical definition of the problem. |
| 90 | + * \param[in] config - Definition of the particular problem. |
| 91 | + */ |
| 92 | + void UpdateGridCoord_Derivatives(CGeometry* geometry, CConfig* config, bool ForwardProjectionDerivative); |
| 93 | + |
| 94 | + /*! |
| 95 | + * \brief Compute the minimum distance to the nearest solid surface. |
| 96 | + * \param[in] geometry - Geometrical definition of the problem. |
| 97 | + * \param[in] config - Definition of the particular problem. |
| 98 | + */ |
| 99 | + void ComputeSolid_Wall_Distance(CGeometry* geometry, CConfig* config, su2double& MinDistance, |
| 100 | + su2double& MaxDistance) const; |
| 101 | + |
| 102 | + /*! |
| 103 | + * \brief Compute the stiffness matrix for grid deformation using spring analogy. |
| 104 | + * \param[in] geometry - Geometrical definition of the problem. |
| 105 | + * \param[in] config - Definition of the particular problem. |
| 106 | + * \return Value of the length of the smallest edge of the grid. |
| 107 | + */ |
| 108 | + su2double SetFEAMethodContributions_Elem(CGeometry* geometry, CConfig* config); |
| 109 | + |
| 110 | + /*! |
| 111 | + * \brief Build the stiffness matrix for a 3-D hexahedron element. The result will be placed in StiffMatrix_Elem. |
| 112 | + * \param[in] geometry - Geometrical definition of the problem. |
| 113 | + * \param[in] config - Definition of the particular problem. |
| 114 | + * \param[in] StiffMatrix_Elem - Element stiffness matrix to be filled. |
| 115 | + * \param[in] CoordCorners - Index value for Node 1 of the current hexahedron. |
| 116 | + * \param[in] PointCorners - Index values for element corners |
| 117 | + * \param[in] nNodes - Number of nodes defining the element. |
| 118 | + * \param[in] scale |
| 119 | + */ |
| 120 | + void SetFEA_StiffMatrix2D(CGeometry* geometry, CConfig* config, su2double** StiffMatrix_Elem, |
| 121 | + unsigned long PointCorners[8], su2double CoordCorners[8][3], unsigned short nNodes, |
| 122 | + su2double ElemVolume, su2double ElemDistance); |
| 123 | + |
| 124 | + /*! |
| 125 | + * \brief Build the stiffness matrix for a 3-D hexahedron element. The result will be placed in StiffMatrix_Elem. |
| 126 | + * \param[in] geometry - Geometrical definition of the problem. |
| 127 | + * \param[in] config - Definition of the particular problem. |
| 128 | + * \param[in] StiffMatrix_Elem - Element stiffness matrix to be filled. |
| 129 | + * \param[in] CoordCorners - Index value for Node 1 of the current hexahedron. |
| 130 | + * \param[in] PointCorners - Index values for element corners |
| 131 | + * \param[in] nNodes - Number of nodes defining the element. |
| 132 | + * \param[in] scale |
| 133 | + */ |
| 134 | + void SetFEA_StiffMatrix3D(CGeometry* geometry, CConfig* config, su2double** StiffMatrix_Elem, |
| 135 | + unsigned long PointCorners[8], su2double CoordCorners[8][3], unsigned short nNodes, |
| 136 | + su2double ElemVolume, su2double ElemDistance); |
| 137 | + |
| 138 | + /*! |
| 139 | + * \brief Add the stiffness matrix for a 2-D triangular element to the global stiffness matrix for the entire mesh |
| 140 | + * (node-based). \param[in] geometry - Geometrical definition of the problem. \param[in] StiffMatrix_Elem - Element |
| 141 | + * stiffness matrix to be filled. \param[in] PointCorners - Index values for element corners \param[in] nNodes - |
| 142 | + * Number of nodes defining the element. |
| 143 | + */ |
| 144 | + void AddFEA_StiffMatrix(CGeometry* geometry, su2double** StiffMatrix_Elem, unsigned long PointCorners[8], |
| 145 | + unsigned short nNodes); |
| 146 | + |
| 147 | + /*! |
| 148 | + * \brief Shape functions and derivative of the shape functions |
| 149 | + * \param[in] Xi - Local coordinates. |
| 150 | + * \param[in] Eta - Local coordinates. |
| 151 | + * \param[in] Zeta - Local coordinates. |
| 152 | + * \param[in] CoordCorners - Coordiantes of the corners. |
| 153 | + * \param[in] DShapeFunction - Shape function information |
| 154 | + */ |
| 155 | + su2double ShapeFunc_Hexa(su2double Xi, su2double Eta, su2double Zeta, su2double CoordCorners[8][3], |
| 156 | + su2double DShapeFunction[8][4]); |
| 157 | + |
| 158 | + /*! |
| 159 | + * \brief Shape functions and derivative of the shape functions |
| 160 | + * \param[in] Xi - Local coordinates. |
| 161 | + * \param[in] Eta - Local coordinates. |
| 162 | + * \param[in] Zeta - Local coordinates. |
| 163 | + * \param[in] CoordCorners - Coordiantes of the corners. |
| 164 | + * \param[in] DShapeFunction - Shape function information |
| 165 | + */ |
| 166 | + su2double ShapeFunc_Tetra(su2double Xi, su2double Eta, su2double Zeta, su2double CoordCorners[8][3], |
| 167 | + su2double DShapeFunction[8][4]); |
| 168 | + |
| 169 | + /*! |
| 170 | + * \brief Shape functions and derivative of the shape functions |
| 171 | + * \param[in] Xi - Local coordinates. |
| 172 | + * \param[in] Eta - Local coordinates. |
| 173 | + * \param[in] Zeta - Local coordinates. |
| 174 | + * \param[in] CoordCorners - Coordiantes of the corners. |
| 175 | + * \param[in] DShapeFunction - Shape function information |
| 176 | + */ |
| 177 | + su2double ShapeFunc_Pyram(su2double Xi, su2double Eta, su2double Zeta, su2double CoordCorners[8][3], |
| 178 | + su2double DShapeFunction[8][4]); |
| 179 | + |
| 180 | + /*! |
| 181 | + * \brief Shape functions and derivative of the shape functions |
| 182 | + * \param[in] Xi - Local coordinates. |
| 183 | + * \param[in] Eta - Local coordinates. |
| 184 | + * \param[in] Zeta - Local coordinates. |
| 185 | + * \param[in] CoordCorners - Coordiantes of the corners. |
| 186 | + * \param[in] DShapeFunction - Shape function information |
| 187 | + */ |
| 188 | + su2double ShapeFunc_Prism(su2double Xi, su2double Eta, su2double Zeta, su2double CoordCorners[8][3], |
| 189 | + su2double DShapeFunction[8][4]); |
| 190 | + |
| 191 | + /*! |
| 192 | + * \brief Shape functions and derivative of the shape functions |
| 193 | + * \param[in] Xi - Local coordinates. |
| 194 | + * \param[in] Eta - Local coordinates. |
| 195 | + * \param[in] CoordCorners - Coordiantes of the corners. |
| 196 | + * \param[in] DShapeFunction - Shape function information |
| 197 | + */ |
| 198 | + su2double ShapeFunc_Triangle(su2double Xi, su2double Eta, su2double CoordCorners[8][3], |
| 199 | + su2double DShapeFunction[8][4]); |
| 200 | + |
| 201 | + /*! |
| 202 | + * \brief Shape functions and derivative of the shape functions |
| 203 | + * \param[in] Xi - Local coordinates. |
| 204 | + * \param[in] Eta - Local coordinates. |
| 205 | + * \param[in] CoordCorners - Coordiantes of the corners. |
| 206 | + * \param[in] DShapeFunction - Shape function information |
| 207 | + */ |
| 208 | + su2double ShapeFunc_Quadrilateral(su2double Xi, su2double Eta, su2double CoordCorners[8][3], |
| 209 | + su2double DShapeFunction[8][4]); |
| 210 | + |
| 211 | + /*! |
| 212 | + * \brief Check the domain points vertex that are going to be moved. |
| 213 | + * \param[in] geometry - Geometrical definition of the problem. |
| 214 | + * \param[in] config - Definition of the particular problem. |
| 215 | + */ |
| 216 | + void SetDomainDisplacements(CGeometry* geometry, CConfig* config); |
| 217 | + |
| 218 | + /*! |
| 219 | + * \brief Check the boundary vertex that are going to be moved. |
| 220 | + * \param[in] geometry - Geometrical definition of the problem. |
| 221 | + * \param[in] config - Definition of the particular problem. |
| 222 | + */ |
| 223 | + void SetBoundaryDisplacements(CGeometry* geometry, CConfig* config); |
| 224 | + |
| 225 | + /*! |
| 226 | + * \brief Set the derivatives of the boundary nodes. |
| 227 | + * \param[in] geometry - Geometrical definition of the problem. |
| 228 | + * \param[in] config - Definition of the particular problem. |
| 229 | + */ |
| 230 | + void SetBoundaryDerivatives(CGeometry* geometry, CConfig* config, bool ForwardProjectionDerivative); |
| 231 | +}; |
0 commit comments