Skip to content

Commit

Permalink
Merge branch 'develop' into issue_2342
Browse files Browse the repository at this point in the history
  • Loading branch information
pcarruscag authored Jan 17, 2025
2 parents c675d73 + 2b6d97a commit 6c23298
Show file tree
Hide file tree
Showing 81 changed files with 1,449 additions and 1,185 deletions.
33 changes: 26 additions & 7 deletions Common/include/CConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,7 @@ class CConfig {
unsigned long StartConv_Iter; /*!< \brief Start convergence criteria at iteration. */
su2double Cauchy_Eps; /*!< \brief Epsilon used for the convergence. */
bool Restart, /*!< \brief Restart solution (for direct, adjoint, and linearized problems).*/
Wrt_Restart_Compact, /*!< \brief Write compact restart files with minimum nr. of variables. */
Read_Binary_Restart, /*!< \brief Read binary SU2 native restart files.*/
Wrt_Restart_Overwrite, /*!< \brief Overwrite restart files or append iteration number.*/
Wrt_Surface_Overwrite, /*!< \brief Overwrite surface output files or append iteration number.*/
Expand Down Expand Up @@ -1004,7 +1005,7 @@ class CConfig {
bool ExtraOutput; /*!< \brief Check if extra output need. */
bool Wall_Functions; /*!< \brief Use wall functions with the turbulence model */
long ExtraHeatOutputZone; /*!< \brief Heat solver zone with extra screen output */
bool DeadLoad; /*!< \brief Application of dead loads to the FE analysis */
bool CentrifugalForce; /*!< \brief Application of centrifugal forces to the FE analysis */
bool PseudoStatic; /*!< \brief Application of dead loads to the FE analysis */
bool SteadyRestart; /*!< \brief Restart from a steady state for FSI problems. */
su2double Newmark_beta, /*!< \brief Parameter alpha for Newmark method. */
Expand All @@ -1013,10 +1014,13 @@ class CConfig {
su2double *Int_Coeffs; /*!< \brief Time integration coefficients for structural method. */
unsigned short nElasticityMod, /*!< \brief Number of different values for the elasticity modulus. */
nPoissonRatio, /*!< \brief Number of different values for the Poisson ratio modulus. */
nMaterialDensity; /*!< \brief Number of different values for the Material density. */
nMaterialDensity, /*!< \brief Number of different values for the Material density. */
nMaterialThermalExpansion; /*!< \brief Number of different values for thermal expansion coefficient. */
su2double *ElasticityMod, /*!< \brief Value of the elasticity moduli. */
*PoissonRatio, /*!< \brief Value of the Poisson ratios. */
*MaterialDensity; /*!< \brief Value of the Material densities. */
*MaterialDensity, /*!< \brief Value of the Material densities. */
*MaterialThermalExpansion, /*!< \brief Value of the thermal expansion coefficients. */
MaterialReferenceTemperature; /*!< \brief Value of the reference temperature for thermal expansion. */
unsigned short nElectric_Field, /*!< \brief Number of different values for the electric field in the membrane. */
nDim_Electric_Field; /*!< \brief Dimensionality of the problem. */
unsigned short nDim_RefNode; /*!< \brief Dimensionality of the vector . */
Expand Down Expand Up @@ -1109,7 +1113,7 @@ class CConfig {
bool Radiation; /*!< \brief Determines if a radiation model is incorporated. */
su2double CFL_Rad; /*!< \brief CFL Number for the radiation solver. */

array<su2double,5> default_cfl_adapt; /*!< \brief Default CFL adapt param array for the COption class. */
array<su2double,6> default_cfl_adapt; /*!< \brief Default CFL adapt param array for the COption class. */
su2double vel_init[3], /*!< \brief initial velocity array for the COption class. */
vel_inf[3], /*!< \brief freestream velocity array for the COption class. */
eng_cyl[7], /*!< \brief engine box array for the COption class. */
Expand Down Expand Up @@ -2389,6 +2393,16 @@ class CConfig {
*/
su2double GetMaterialDensity(unsigned short id_val) const { return MaterialDensity[id_val]; }

/*!
* \brief Get the thermal expansion coefficient.
*/
su2double GetMaterialThermalExpansion(unsigned short id_val) const { return MaterialThermalExpansion[id_val]; }

/*!
* \brief Temperature at which there is no stress from thermal expansion.
*/
su2double GetMaterialReferenceTemperature() const { return MaterialReferenceTemperature; }

/*!
* \brief Compressibility/incompressibility of the solids analysed using the structural solver.
* \return Compressible or incompressible.
Expand Down Expand Up @@ -5490,6 +5504,12 @@ class CConfig {
*/
bool GetRead_Binary_Restart(void) const { return Read_Binary_Restart; }

/*!
* \brief Flag for whether restart files contain only necessary variables.
* \return Flag <code>TRUE</code> then the code will write compact restart files.
*/
bool GetWrt_Restart_Compact(void) const { return Wrt_Restart_Compact; }

/*!
* \brief Flag for whether restart solution files are overwritten.
* \return Flag for overwriting. If Flag=false, iteration nr is appended to filename
Expand Down Expand Up @@ -8929,10 +8949,9 @@ class CConfig {
su2double GetAitkenDynMinInit(void) const { return AitkenDynMinInit; }

/*!
* \brief Decide whether to apply dead loads to the model.
* \return <code>TRUE</code> if the dead loads are to be applied, <code>FALSE</code> otherwise.
* \brief Decide whether to apply centrifugal forces to the model.
*/
bool GetDeadLoad(void) const { return DeadLoad; }
bool GetCentrifugalForce(void) const { return CentrifugalForce; }

/*!
* \brief Identifies if the mesh is matching or not (temporary, while implementing interpolation procedures).
Expand Down
41 changes: 34 additions & 7 deletions Common/include/geometry/elements/CElement.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ class CElement {
su2activematrix NodalExtrap; /*!< \brief Coordinates of the nodal points for Gaussian extrapolation. */
su2activematrix NodalStress; /*!< \brief Stress at the nodes. */

su2activevector NodalTemperature; /*!< \brief Temperature at the nodes. */

/*--- Stiffness and load matrices. ---*/
std::vector<su2activematrix> Kab; /*!< \brief Structure for the constitutive component of the tangent matrix. */
su2activematrix Mab; /*!< \brief Structure for the nodal components of the mass matrix. */
Expand Down Expand Up @@ -151,7 +153,7 @@ class CElement {
* \param[in] iDim - Dimension.
* \param[in] val_CoordRef - Value of the coordinate.
*/
inline void SetRef_Coord(unsigned short iNode, unsigned short iDim, su2double val_CoordRef) {
inline void SetRef_Coord(unsigned short iNode, unsigned short iDim, const su2double& val_CoordRef) {
RefCoord(iNode, iDim) = val_CoordRef;
}

Expand All @@ -161,10 +163,22 @@ class CElement {
* \param[in] iDim - Dimension.
* \param[in] val_CoordRef - Value of the coordinate.
*/
inline void SetCurr_Coord(unsigned short iNode, unsigned short iDim, su2double val_CoordCurr) {
inline void SetCurr_Coord(unsigned short iNode, unsigned short iDim, const su2double& val_CoordCurr) {
CurrentCoord(iNode, iDim) = val_CoordCurr;
}

/*!
* \brief Set the value of the temperature of a node.
*/
inline void SetTemperature(unsigned short iNode, const su2double& val_Temperature) {
NodalTemperature[iNode] = val_Temperature;
}

/*!
* \brief Set the value of the temperature of all nodes.
*/
inline void SetTemperature(const su2double& val_Temperature) { NodalTemperature = val_Temperature; }

/*!
* \brief Get the value of the coordinate of the nodes in the reference configuration.
* \param[in] iNode - Index of node.
Expand All @@ -181,6 +195,17 @@ class CElement {
*/
inline su2double GetCurr_Coord(unsigned short iNode, unsigned short iDim) const { return CurrentCoord(iNode, iDim); }

/*!
* \brief Get the value of the temperature at a Gaussian integration point.
*/
inline su2double GetTemperature(unsigned short iGauss) const {
su2double Temperature = 0;
for (auto iNode = 0u; iNode < nNodes; ++iNode) {
Temperature += GetNi(iNode, iGauss) * NodalTemperature[iNode];
}
return Temperature;
}

/*!
* \brief Get the weight of the corresponding Gaussian Point.
* \param[in] iGauss - index of the Gaussian point.
Expand Down Expand Up @@ -214,7 +239,9 @@ class CElement {
* \param[in] nodeB - index of Node b.
* \param[in] val_Ks_ab - value of the term that will constitute the diagonal of the stress contribution.
*/
inline void Add_Mab(unsigned short nodeA, unsigned short nodeB, su2double val_Mab) { Mab(nodeA, nodeB) += val_Mab; }
inline void Add_Mab(unsigned short nodeA, unsigned short nodeB, const su2double& val_Mab) {
Mab(nodeA, nodeB) += val_Mab;
}

/*!
* \brief Add the value of a submatrix K relating nodes a and b, for the constitutive term.
Expand Down Expand Up @@ -243,7 +270,7 @@ class CElement {
* \param[in] nodeB - index of Node b.
* \param[in] val_Ks_ab - value of the term that will constitute the diagonal of the stress contribution.
*/
inline void Add_Ks_ab(unsigned short nodeA, unsigned short nodeB, su2double val_Ks_ab) {
inline void Add_Ks_ab(unsigned short nodeA, unsigned short nodeB, const su2double& val_Ks_ab) {
Ks_ab(nodeA, nodeB) += val_Ks_ab;
}

Expand Down Expand Up @@ -354,7 +381,7 @@ class CElement {
* \param[in] iVar - Variable index.
* \param[in] val_Stress - Value of the stress added.
*/
inline void Add_NodalStress(unsigned short iNode, unsigned short iVar, su2double val_Stress) {
inline void Add_NodalStress(unsigned short iNode, unsigned short iVar, const su2double& val_Stress) {
NodalStress(iNode, iVar) += val_Stress;
}

Expand Down Expand Up @@ -789,7 +816,7 @@ class CQUAD4 final : public CElementWithKnownSizes<4, 4, 2> {
/*!
* \brief Shape functions (Ni) evaluated at point Xi,Eta.
*/
inline static void ShapeFunctions(su2double Xi, su2double Eta, su2double* Ni) {
inline static void ShapeFunctions(const su2double& Xi, const su2double& Eta, su2double* Ni) {
Ni[0] = 0.25 * (1.0 - Xi) * (1.0 - Eta);
Ni[1] = 0.25 * (1.0 + Xi) * (1.0 - Eta);
Ni[2] = 0.25 * (1.0 + Xi) * (1.0 + Eta);
Expand All @@ -799,7 +826,7 @@ class CQUAD4 final : public CElementWithKnownSizes<4, 4, 2> {
/*!
* \brief Shape function Jacobian (dNi) evaluated at point Xi,Eta.
*/
inline static void ShapeFunctionJacobian(su2double Xi, su2double Eta, su2double dNi[][2]) {
inline static void ShapeFunctionJacobian(const su2double& Xi, const su2double& Eta, su2double dNi[][2]) {
dNi[0][0] = -0.25 * (1.0 - Eta);
dNi[0][1] = -0.25 * (1.0 - Xi);
dNi[1][0] = 0.25 * (1.0 - Eta);
Expand Down
4 changes: 2 additions & 2 deletions Common/include/linear_algebra/CSysMatrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -805,10 +805,10 @@ class CSysMatrix {
void EnforceSolutionAtNode(unsigned long node_i, const OtherType* x_i, CSysVector<OtherType>& b);

/*!
* \brief Version of EnforceSolutionAtNode for a single degree of freedom.
* \brief Similar to EnforceSolutionAtNode, but for 0 projection in a given direction.
*/
template <class OtherType>
void EnforceSolutionAtDOF(unsigned long node_i, unsigned long iVar, OtherType x_i, CSysVector<OtherType>& b);
void EnforceZeroProjection(unsigned long node_i, const OtherType* n, CSysVector<OtherType>& b);

/*!
* \brief Sets the diagonal entries of the matrix as the sum of the blocks in the corresponding column.
Expand Down
8 changes: 8 additions & 0 deletions Common/include/toolboxes/geometry_toolbox.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ inline T Norm(Int nDim, const T* a) {
return sqrt(SquaredNorm(nDim, a));
}

/*! \brief dn = max(abs(n.(a-b)), 0.05 * ||a-b|| */
template <class T, typename Int>
inline T NormalDistance(Int nDim, const T* n, const T* a, const T* b) {
T d[3] = {0};
Distance(nDim, a, b, d);
return fmax(fabs(DotProduct(nDim, n, d)), 0.05 * Norm(nDim, d));
}

/*! \brief c = a x b */
template <class T>
inline void CrossProduct(const T* a, const T* b, T* c) {
Expand Down
Loading

0 comments on commit 6c23298

Please sign in to comment.