Skip to content

Commit c419e2a

Browse files
committed
Added routines to prevent intersections in grid elements after free form deformation.
After deformation, the surface points are checked for self-intersection within the FFD box. If that is the case, a recursive procedure is done to prevent those. After grid deformation, all elements are checked on convexity. If there are nonconvex elements, a procedure is started that starts from the undeformed mesh and recursively changes the deformation magnitude until no nonconvex elements are present.
1 parent 3808ca5 commit c419e2a

10 files changed

Lines changed: 641 additions & 2 deletions

File tree

Common/include/CConfig.hpp

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,13 @@ class CConfig {
108108
unsigned short FFD_Blending; /*!< \brief Kind of FFD Blending function. */
109109
su2double* FFD_BSpline_Order; /*!< \brief BSpline order in i,j,k direction. */
110110
su2double FFD_Tol; /*!< \brief Tolerance in the point inversion problem. */
111+
bool FFD_IntPrev; /*!< \brief Enables self-intersection prevention procedure within the FFD box. */
112+
unsigned short FFD_IntPrev_Iter; /*!< \brief Amount of iterations for FFD box self-intersection prevention procedure. */
113+
unsigned short FFD_IntPrev_Depth; /*!< \brief Maximum recursion depth for FFD box self-intersection procedure. */
114+
bool ConvexityCheck; /*!< \brief Enables convexity check on all mesh elements. */
115+
unsigned short ConvexityCheck_Iter; /*!< \brief Amount of iterations for convexity check in deformations. */
116+
unsigned short ConvexityCheck_Depth; /*!< \brief Maximum recursion depth for convexity check in deformations.*/
117+
su2double** TotalDeformation; /*!< \brief Total deformation of the design variables. */
111118
su2double Opt_RelaxFactor; /*!< \brief Scale factor for the line search. */
112119
su2double Opt_LineSearch_Bound; /*!< \brief Bounds for the line search. */
113120
su2double StartTime;
@@ -8171,6 +8178,72 @@ class CConfig {
81718178
*/
81728179
su2double GetFFD_Tol(void) const { return FFD_Tol; }
81738180

8181+
/*!
8182+
* \brief Get information about whether to do a check on self-intersections within the FFD box based on value of the Jacobian determinant.
8183+
* \return <code>TRUE</code> if FFD intersection prevention is active; otherwise <code>FALSE</code>.
8184+
*/
8185+
bool GetFFD_IntPrev(void) const { return FFD_IntPrev; }
8186+
8187+
/*!
8188+
* \brief Get the maximum number of iterations in the recursive convexity check procedure in deformation.
8189+
* \return Maximum number of iterations.
8190+
*/
8191+
unsigned short GetFFD_IntPrev_Iter(void) const { return FFD_IntPrev_Iter; }
8192+
8193+
/*!
8194+
* \brief Get the maximum recursion depth in the recursive convexity check procedure in deformation.
8195+
* \return Maximum recursion depth.
8196+
*/
8197+
unsigned short GetFFD_IntPrev_Depth(void) const { return FFD_IntPrev_Depth; }
8198+
8199+
/*!
8200+
* \brief Get information about whether to do a check on convexity of the mesh elements.
8201+
* \return <code>TRUE</code> if convexity check is active; otherwise <code>FALSE</code>.
8202+
*/
8203+
bool GetConvexity_Check(void) const { return ConvexityCheck; }
8204+
8205+
/*!
8206+
* \brief Get the maximum number of iterations in the recursive convexity check procedure in deformation.
8207+
* \return Maximum number of iterations.
8208+
*/
8209+
unsigned short GetConvexityCheck_Iter(void) const { return ConvexityCheck_Iter; }
8210+
8211+
/*!
8212+
* \brief Get the maximum recursion depth in the recursive convexity check procedure in deformation.
8213+
* \return Maximum recursion depth.
8214+
*/
8215+
unsigned short GetConvexityCheck_Depth(void) const { return ConvexityCheck_Depth; }
8216+
8217+
/*!
8218+
* \brief Set the initial values for the total deformation of the design variables.
8219+
* \param[in] totalDef - total deformation of all design variables
8220+
*/
8221+
void Initialize_TotalDeformation(su2double** totalDef) { TotalDeformation = totalDef; }
8222+
8223+
/*!
8224+
* \brief Set the total deformation value of each design variable.
8225+
* \param[in] val_dv - design variable
8226+
* \param[in] val_ind - index of design variable
8227+
* \param[in] val - value of deformation magnitude
8228+
*/
8229+
void SetTotalDeformation(unsigned short val_dv, unsigned short val_ind, su2double val) {TotalDeformation[val_dv][val_ind] = val; }
8230+
8231+
/*!
8232+
* \brief Add a value to the total deformation value of each design variable.
8233+
* \param[in] val_dv - design variable
8234+
* \param[in] val_ind - index of design variable
8235+
* \param[in] val - value of deformation magnitude that is added
8236+
*/
8237+
void AddTotalDeformation(unsigned short val_dv, unsigned short val_ind, su2double val) {TotalDeformation[val_dv][val_ind] += val; }
8238+
8239+
/*!
8240+
* \brief Get information about the total deformation of the design variables.
8241+
* \param[in] val_dv - design variable number
8242+
* \param[in] val_val - design variable number
8243+
* \return Value of total deformation for one design variable.
8244+
*/
8245+
su2double GetTotalDeformation(unsigned short val_dv, unsigned short val_val = 0) const { return TotalDeformation[val_dv][val_val]; }
8246+
81748247
/*!
81758248
* \brief Get the scale factor for the line search.
81768249
* \return Scale factor for the line search.

Common/include/geometry/CGeometry.hpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ class CGeometry {
109109
nelem_triangle_bound{0}, /*!< \brief Number of triangles on the mesh boundaries. */
110110
Global_nelem_triangle_bound{0}, /*!< \brief Total number of triangles on the mesh boundaries across all processors. */
111111
nelem_quad_bound{0}, /*!< \brief Number of quads on the mesh boundaries. */
112-
Global_nelem_quad_bound{0}; /*!< \brief Total number of quads on the mesh boundaries across all processors. */
112+
Global_nelem_quad_bound{0}, /*!< \brief Total number of quads on the mesh boundaries across all processors. */
113+
nNonconvexElements{0}; /*!< \brief Number of nonconvex elements in the mesh. */
113114

114115
unsigned short nDim{0}; /*!< \brief Number of dimension of the problem. */
115116
unsigned short nZone{0}; /*!< \brief Number of zones in the problem. */
@@ -1713,5 +1714,16 @@ class CGeometry {
17131714
*/
17141715
static void ComputeWallDistance(const CConfig * const *config_container, CGeometry ****geometry_container);
17151716

1717+
/*!
1718+
* \brief Set the amount of nonconvex elements in the mesh.
1719+
* \param[in] nonconvex_elems - amount of nonconvex elements in the mesh
1720+
*/
1721+
void SetnNonconvexElements(unsigned long nonconvex_elems) {nNonconvexElements = nonconvex_elems;}
1722+
1723+
/*!
1724+
* \brief Get the amount of nonconvex elements in the mesh.
1725+
* \param[out] nNonconvexElements- amount of nonconvex elements in the mesh
1726+
*/
1727+
unsigned long GetnNonconvexElements(void) {return nNonconvexElements;}
17161728
};
17171729

Common/include/grid_movement/CSurfaceMovement.hpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,4 +484,22 @@ class CSurfaceMovement : public CGridMovement {
484484
* \param[in] config - Definition of the particular problem.
485485
*/
486486
void SetSurface_Derivative(CGeometry *geometry, CConfig *config);
487+
488+
/*!
489+
* \brief Set magnitude of the deformation of all design variables
490+
* \param[in] geometry - Geometrical definition of the problem.
491+
* \param[in] config - Definition of the particular problem.
492+
* \param[in] deformationFactor - Remaining amount of original deformation (between 0 and 1).
493+
* \param[in] totalDeformation_initial - Initial deformation magnitude of all design variables.
494+
*/
495+
void SetDeformationMagnitude(CGeometry *geometry, CConfig *config, su2double deformationFactor, su2double** totalDeformation_initial);
496+
497+
/*!
498+
* \brief Calculate the determinant of the Jacobian matrix for the FFD problem.
499+
* \param[in] geometry - Geometrical definition of the problem.
500+
* \param[in] config - Definition of the particular problem.
501+
* \param[in] FFDBox - Free form deformation box.
502+
* \return Number of points with negative Jacobian determinant.
503+
*/
504+
unsigned long calculateJacobianDeterminant(CGeometry *geometry, CConfig *config, CFreeFormDefBox *FFDBox);
487505
};

Common/include/grid_movement/CVolumetricMovement.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,14 @@ class CVolumetricMovement : public CGridMovement {
240240
*/
241241
void ComputeDeforming_Element_Volume(CGeometry *geometry, su2double &MinVolume, su2double &MaxVolume, bool Screen_Output);
242242

243+
/*!
244+
* \brief Compute amount of nonconvex elements
245+
* \param[in] geometry - Geometrical definition of the problem.
246+
* \param[in] Screen_Output - determines if text is written to screen
247+
*/
248+
void ComputenNonconvexElements(CGeometry *geometry, bool Screen_Output);
249+
250+
243251
/*!
244252
* \brief Compute the minimum distance to the nearest solid surface.
245253
* \param[in] geometry - Geometrical definition of the problem.

Common/src/CConfig.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2603,6 +2603,24 @@ void CConfig::SetConfig_Options() {
26032603
/* DESCRIPTION: Free surface damping coefficient */
26042604
addDoubleOption("FFD_TOLERANCE", FFD_Tol, 1E-10);
26052605

2606+
/* DESCRIPTION: Procedure to prevent self-intersections within the FFD box based on Jacobian determinant */
2607+
addBoolOption("FFD_INTPREV", FFD_IntPrev, NO);
2608+
2609+
/* DESCRIPTION: Number of total iterations in the convexity check procedure */
2610+
addUnsignedShortOption("FFD_INTPREV_ITER", FFD_IntPrev_Iter, 10);
2611+
2612+
/* DESCRIPTION: Recursion depth in the FFD self-intersection prevention */
2613+
addUnsignedShortOption("FFD_INTPREV_DEPTH", FFD_IntPrev_Depth, 3);
2614+
2615+
/* DESCRIPTION: Convexity check on all mesh elements */
2616+
addBoolOption("CONVEXITY_CHECK", ConvexityCheck, NO);
2617+
2618+
/* DESCRIPTION: Number of total iterations in the convexity check procedure */
2619+
addUnsignedShortOption("CONVEXITY_CHECK_ITER", ConvexityCheck_Iter, 10);
2620+
2621+
/* DESCRIPTION: Recursion depth in the FFD self-intersection prevention */
2622+
addUnsignedShortOption("CONVEXITY_CHECK_DEPTH", ConvexityCheck_Depth, 3);
2623+
26062624
/* DESCRIPTION: Definition of the FFD boxes */
26072625
addFFDDefOption("FFD_DEFINITION", nFFDBox, CoordFFDBox, TagFFDBox);
26082626

0 commit comments

Comments
 (0)