Skip to content

Commit ad27b8f

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into fix_objective_funcs
2 parents bcd6b4f + 03f82b3 commit ad27b8f

36 files changed

Lines changed: 2701 additions & 1676 deletions

Common/include/CConfig.hpp

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,14 @@ 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-
su2double Opt_RelaxFactor; /*!< \brief Scale factor for the line search. */
112-
su2double Opt_LineSearch_Bound; /*!< \brief Bounds for the line search. */
111+
bool FFD_IntPrev; /*!< \brief Enables self-intersection prevention procedure within the FFD box. */
112+
unsigned short FFD_IntPrev_MaxIter; /*!< \brief Amount of iterations for FFD box self-intersection prevention procedure. */
113+
unsigned short FFD_IntPrev_MaxDepth; /*!< \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_MaxIter; /*!< \brief Amount of iterations for convexity check in deformations. */
116+
unsigned short ConvexityCheck_MaxDepth; /*!< \brief Maximum recursion depth for convexity check in deformations.*/
117+
su2double Opt_RelaxFactor; /*!< \brief Scale factor for the line search. */
118+
su2double Opt_LineSearch_Bound; /*!< \brief Bounds for the line search. */
113119
su2double StartTime;
114120
bool ContinuousAdjoint, /*!< \brief Flag to know if the code is solving an adjoint problem. */
115121
Viscous, /*!< \brief Flag to know if the code is solving a viscous problem. */
@@ -8086,6 +8092,27 @@ class CConfig {
80868092
*/
80878093
su2double GetFFD_Tol(void) const { return FFD_Tol; }
80888094

8095+
/*!
8096+
* \brief Get information about whether to do a check on self-intersections within
8097+
the FFD box based on value on the Jacobian determinant.
8098+
* \param[out] FFD_IntPrev: <code>TRUE</code> if FFD intersection prevention is active; otherwise <code>FALSE</code>.
8099+
* \param[out] FFD_IntPrev_MaxIter: Maximum number of iterations in the intersection prevention procedure.
8100+
* \param[out] FFD_IntPrev_MaxDepth: Maximum recursion depth in the intersection prevention procedure.
8101+
*/
8102+
tuple<bool, unsigned short, unsigned short> GetFFD_IntPrev(void) const {
8103+
return make_tuple(FFD_IntPrev, FFD_IntPrev_MaxIter, FFD_IntPrev_MaxDepth);
8104+
}
8105+
8106+
/*!
8107+
* \brief Get information about whether to do a check on convexity of the mesh elements.
8108+
* \param[out] ConvexityCheck: <code>TRUE</code> if convexity check is active; otherwise <code>FALSE</code>.
8109+
* \param[out] ConvexityCheck_MaxIter: Maximum number of iterations in the convexity check.
8110+
* \param[out] ConvexityCheck_MaxDepth: Maximum recursion depth in the convexity check.
8111+
*/
8112+
tuple<bool, unsigned short, unsigned short> GetConvexityCheck(void) const {
8113+
return make_tuple(ConvexityCheck, ConvexityCheck_MaxIter, ConvexityCheck_MaxDepth);
8114+
}
8115+
80898116
/*!
80908117
* \brief Get the scale factor for the line search.
80918118
* \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. */
@@ -1699,5 +1700,16 @@ class CGeometry {
16991700
*/
17001701
static void ComputeWallDistance(const CConfig * const *config_container, CGeometry ****geometry_container);
17011702

1703+
/*!
1704+
* \brief Set the amount of nonconvex elements in the mesh.
1705+
* \param[in] nonconvex_elems - amount of nonconvex elements in the mesh
1706+
*/
1707+
void SetnNonconvexElements(unsigned long nonconvex_elems) {nNonconvexElements = nonconvex_elems;}
1708+
1709+
/*!
1710+
* \brief Get the amount of nonconvex elements in the mesh.
1711+
* \param[out] nNonconvexElements- amount of nonconvex elements in the mesh
1712+
*/
1713+
unsigned long GetnNonconvexElements() const {return nNonconvexElements;}
17021714
};
17031715

Common/include/grid_movement/CGridMovement.hpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,12 @@ class CGridMovement {
5555
virtual ~CGridMovement(void);
5656

5757
/*!
58-
* \brief A pure virtual member.
58+
* \brief Set the surface/boundary deformation.
5959
* \param[in] geometry - Geometrical definition of the problem.
6060
* \param[in] config - Definition of the particular problem.
61+
* \return Total deformation applied, which may be less than target if intersection prevention is used.
6162
*/
62-
inline virtual void SetSurface_Deformation(CGeometry *geometry, CConfig *config) { }
63-
63+
inline virtual vector<vector<su2double> > SetSurface_Deformation(CGeometry *geometry, CConfig *config) {
64+
return vector<vector<su2double> >();
65+
}
6466
};

Common/include/grid_movement/CSurfaceMovement.hpp

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,9 @@ class CSurfaceMovement : public CGridMovement {
210210
* \brief Set the surface/boundary deformation.
211211
* \param[in] geometry - Geometrical definition of the problem.
212212
* \param[in] config - Definition of the particular problem.
213+
* \return Total deformation applied, which may be less than target if intersection prevention is used.
213214
*/
214-
void SetSurface_Deformation(CGeometry *geometry, CConfig *config) override;
215+
vector<vector<su2double> > SetSurface_Deformation(CGeometry *geometry, CConfig *config) override;
215216

216217
/*!
217218
* \brief Compute the parametric coordinates of a grid point using a point inversion strategy
@@ -268,6 +269,15 @@ class CSurfaceMovement : public CGridMovement {
268269
*/
269270
void GetCartesianCoordCP(CGeometry *geometry, CConfig *config, CFreeFormDefBox *FFDBoxParent, CFreeFormDefBox *FFDBoxChild);
270271

272+
/*!
273+
* \brief Apply the design variables to the control point position
274+
* \param[in] geometry - Geometrical definition of the problem.
275+
* \param[in] config - Definition of the particular problem.
276+
* \param[in] FFDBox - Array with all the free forms FFDBoxes of the computation.
277+
* \param[in] iFFDBox - Index of FFD box.
278+
*/
279+
void ApplyDesignVariables(CGeometry *geometry, CConfig *config, CFreeFormDefBox **FFDBox, unsigned short iFFDBox);
280+
271281
/*!
272282
* \brief Recompute the cartesian coordinates using the control points position.
273283
* \param[in] geometry - Geometrical definition of the problem.
@@ -484,4 +494,13 @@ class CSurfaceMovement : public CGridMovement {
484494
* \param[in] config - Definition of the particular problem.
485495
*/
486496
void SetSurface_Derivative(CGeometry *geometry, CConfig *config);
497+
498+
/*!
499+
* \brief Calculate the determinant of the Jacobian matrix for the FFD problem.
500+
* \param[in] geometry - Geometrical definition of the problem.
501+
* \param[in] config - Definition of the particular problem.
502+
* \param[in] FFDBox - Free form deformation box.
503+
* \return Number of points with negative Jacobian determinant.
504+
*/
505+
unsigned long calculateJacobianDeterminant(CGeometry *geometry, CConfig *config, CFreeFormDefBox *FFDBox) const;
487506
};

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
@@ -2564,6 +2564,24 @@ void CConfig::SetConfig_Options() {
25642564
/* DESCRIPTION: Free surface damping coefficient */
25652565
addDoubleOption("FFD_TOLERANCE", FFD_Tol, 1E-10);
25662566

2567+
/* DESCRIPTION: Procedure to prevent self-intersections within the FFD box based on Jacobian determinant */
2568+
addBoolOption("FFD_INTPREV", FFD_IntPrev, NO);
2569+
2570+
/* DESCRIPTION: Number of total iterations in the convexity check procedure */
2571+
addUnsignedShortOption("FFD_INTPREV_ITER", FFD_IntPrev_MaxIter, 10);
2572+
2573+
/* DESCRIPTION: Recursion depth in the FFD self-intersection prevention */
2574+
addUnsignedShortOption("FFD_INTPREV_DEPTH", FFD_IntPrev_MaxDepth, 3);
2575+
2576+
/* DESCRIPTION: Convexity check on all mesh elements */
2577+
addBoolOption("CONVEXITY_CHECK", ConvexityCheck, NO);
2578+
2579+
/* DESCRIPTION: Number of total iterations in the convexity check procedure */
2580+
addUnsignedShortOption("CONVEXITY_CHECK_ITER", ConvexityCheck_MaxIter, 10);
2581+
2582+
/* DESCRIPTION: Recursion depth in the FFD self-intersection prevention */
2583+
addUnsignedShortOption("CONVEXITY_CHECK_DEPTH", ConvexityCheck_MaxDepth, 3);
2584+
25672585
/* DESCRIPTION: Definition of the FFD boxes */
25682586
addFFDDefOption("FFD_DEFINITION", nFFDBox, CoordFFDBox, TagFFDBox);
25692587

0 commit comments

Comments
 (0)