Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
23ac38b
initial commit
bigfooted Nov 8, 2024
a47c0f4
fix vector
bigfooted Nov 8, 2024
f846cbb
update agglomeration
bigfooted Nov 15, 2024
f2fb97e
Merge branch 'develop' into fix_multigrid_agglomeration
bigfooted Nov 18, 2024
70a0638
Merge branch 'develop' into fix_multigrid_agglomeration
bigfooted Dec 22, 2024
711ba29
Merge branch 'develop' into fix_multigrid_agglomeration
bigfooted Jan 2, 2025
1953dfc
Merge branch 'develop' into fix_multigrid_agglomeration
bigfooted Jan 17, 2025
19f6e79
Merge branch 'develop' into fix_multigrid_agglomeration
bigfooted Jan 23, 2025
6d23aae
Merge branch 'develop' into fix_multigrid_agglomeration
bigfooted Feb 3, 2025
ee86d12
Merge branch 'develop' into fix_multigrid_agglomeration
bigfooted Mar 9, 2025
8e14cf5
Merge branch 'develop' into fix_multigrid_agglomeration
bigfooted Aug 23, 2025
320eb82
Merge branch 'fix_multigrid_agglomeration' of https://github.com/su2c…
bigfooted Oct 11, 2025
ca7edea
Merge branch 'develop' into fix_multigrid_agglomeration
bigfooted Oct 11, 2025
6fbef92
testing agglomeration
bigfooted Oct 30, 2025
d55bd72
update 3D agglomeration
bigfooted Nov 15, 2025
c364dc4
update 3D agglomeration
bigfooted Nov 15, 2025
768aa92
update 3D agglomeration
bigfooted Nov 15, 2025
35dbdae
update opdi
bigfooted Nov 15, 2025
767bd2a
update with commented cout
bigfooted Nov 15, 2025
9e6e791
update agglomeration, aggressive settings
bigfooted Nov 16, 2025
6d42a49
add EULER_WALLS by checking straightness
bigfooted Nov 17, 2025
4495da6
remove some commented cout statements
bigfooted Nov 17, 2025
c38a633
remove some commented cout statements
bigfooted Nov 19, 2025
d355978
add convergence check and early exit for pre,post and correction smoo…
bigfooted Nov 19, 2025
9642b94
implicit lines
bigfooted Nov 23, 2025
cbaa3f7
implicit lines info
bigfooted Nov 24, 2025
3c4f8ab
Merge branch 'develop' into fix_multigrid_agglomeration
bigfooted Nov 24, 2025
d28ce20
adaptive damping factor for pre-smoothing
bigfooted Nov 26, 2025
9f19341
fix cross-lines in implicit line agglomeration
bigfooted Nov 27, 2025
691a73c
Reduce MGLEVELS based on mesh size
bigfooted Nov 27, 2025
85456c8
change default nr of implicit lines
bigfooted Nov 28, 2025
99d6712
adaptive CFL on multigrid
bigfooted Nov 28, 2025
2c40c9c
run precommit
bigfooted Nov 28, 2025
944a2fc
fix gauss elimination NaN
bigfooted Dec 6, 2025
fb8e4ee
fix euler wall agglomeration
bigfooted Dec 6, 2025
b91a992
precommit
bigfooted Dec 6, 2025
6332e28
CFL adapt oscillation detection
bigfooted Dec 7, 2025
7b53432
simpler CFL adapt oscillation detection
bigfooted Dec 7, 2025
2013392
asdd XOR flipflop again
bigfooted Dec 7, 2025
6cfdbf0
modify cfl on coarser meshes
bigfooted Dec 7, 2025
4cd4784
introduce LSQ slope computation
bigfooted Dec 8, 2025
0699ce4
add explanation
bigfooted Dec 8, 2025
0657fe2
fix CFL min value
bigfooted Dec 13, 2025
2b2996a
make adaptcfl more modular
bigfooted Dec 14, 2025
15ed48d
make adaptcfl more modular 2
bigfooted Dec 14, 2025
0d89d93
make adaptcfl more modular 3
bigfooted Dec 14, 2025
d2df3c7
make adaptcfl more modular 4
bigfooted Dec 14, 2025
94b48fc
make adaptcfl more modular 5
bigfooted Dec 14, 2025
fd7a201
make adaptcfl more modular 6
bigfooted Dec 14, 2025
29eecfc
some MG MPI changes
bigfooted Dec 14, 2025
1945bdd
Merge branch 'fix_multigrid_agglomeration' of https://github.com/su2c…
bigfooted Dec 14, 2025
2468017
some more MG MPI fixes
bigfooted Dec 15, 2025
e3beb48
mpi global cfl
bigfooted Dec 15, 2025
5328e9c
some mpi mg cleanup - this also has no agglomeration on the rank inte…
bigfooted Dec 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 85 additions & 3 deletions Common/include/CConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,19 +483,28 @@ class CConfig {
unsigned short **DegreeFFDBox; /*!< \brief Degree of the FFD boxes. */
string *FFDTag; /*!< \brief Parameters of the design variable. */
string *TagFFDBox; /*!< \brief Tag of the FFD box. */
unsigned short GeometryMode; /*!< \brief Gemoetry mode (analysis or gradient computation). */
unsigned short GeometryMode; /*!< \brief Geometry mode (analysis or gradient computation). */
unsigned short MGCycle; /*!< \brief Kind of multigrid cycle. */
unsigned short FinestMesh; /*!< \brief Finest mesh for the full multigrid approach. */
unsigned short nFFD_Fix_IDir,
nFFD_Fix_JDir, nFFD_Fix_KDir; /*!< \brief Number of planes fixed in the FFD. */
unsigned short nMG_PreSmooth, /*!< \brief Number of MG pre-smooth parameters found in config file. */
nMG_PostSmooth, /*!< \brief Number of MG post-smooth parameters found in config file. */
nMG_CorrecSmooth; /*!< \brief Number of MG correct-smooth parameters found in config file. */
unsigned long MG_Min_MeshSize; /*!< \brief Minimum mesh size per coarsest level to allow another MG level. */

short *FFD_Fix_IDir,
*FFD_Fix_JDir, *FFD_Fix_KDir; /*!< \brief Exact sections. */
unsigned short *MG_PreSmooth, /*!< \brief Multigrid Pre smoothing. */
*MG_PostSmooth, /*!< \brief Multigrid Post smoothing. */
*MG_CorrecSmooth; /*!< \brief Multigrid Jacobi implicit smoothing of the correction. */
bool MG_Smooth_EarlyExit; /*!< \brief Enable early exit for MG smoothing. */
su2double MG_Smooth_Res_Threshold; /*!< \brief Residual reduction threshold for early exit. */
bool MG_Smooth_Output; /*!< \brief Output per-iteration multigrid smoothing info. */
bool MG_Implicit_Lines; /*!< \\brief Enable implicit-lines agglomeration from walls. */
bool MG_Implicit_Debug; /*!< \brief Enable debug output for implicit-lines agglomeration. */
bool MG_DebugHaloCoordinates; /*!< \brief Enable halo CV coordinate validation for multigrid. */
su2double MG_Smooth_Coeff; /*!< \brief Smoothing coefficient for multigrid correction smoothing. */
su2double *LocationStations; /*!< \brief Airfoil sections in wing slicing subroutine. */

ENUM_MULTIZONE Kind_MZSolver; /*!< \brief Kind of multizone solver. */
Expand Down Expand Up @@ -2888,7 +2897,7 @@ class CConfig {
unsigned short GetFinestMesh(void) const { return FinestMesh; }

/*!
* \brief Get the kind of multigrid (V or W).
* \brief Get the kind of multigrid (V, W or FULLMG).
* \note This variable is used in a recursive way to perform the different kind of cycles
* \return 0 or 1 depending of we are dealing with a V or W cycle.
*/
Expand Down Expand Up @@ -3031,7 +3040,28 @@ class CConfig {
* \brief Get the number of Runge-Kutta steps.
* \return Number of Runge-Kutta steps.
*/
unsigned short GetnRKStep(void) const { return nRKStep; }
unsigned short GetnRKStep(void) const {

unsigned short iRKLimit = 1;

switch (GetKind_TimeIntScheme()) {
case RUNGE_KUTTA_EXPLICIT:
iRKLimit = GetnRKStep();
break;
case CLASSICAL_RK4_EXPLICIT:
iRKLimit = 4;
break;
case EULER_EXPLICIT:
case EULER_IMPLICIT:
iRKLimit = 1;
break;
default:
iRKLimit = 1;
break;
}
//return nRKStep;
return iRKLimit;
}

/*!
* \brief Get the number of time levels for time accurate local time stepping.
Expand Down Expand Up @@ -3816,6 +3846,55 @@ class CConfig {
return MG_CorrecSmooth[val_mesh];
}

/*!
* \brief Get whether early exit is enabled for MG smoothing.
* \return True if early exit is enabled.
*/
bool GetMG_Smooth_EarlyExit() const { return MG_Smooth_EarlyExit; }

/*!
* \brief Get the residual threshold for early exit in MG smoothing.
* \return Residual threshold.
*/
su2double GetMG_Smooth_Res_Threshold() const { return MG_Smooth_Res_Threshold; }

/*!
* \brief Get whether per-iteration output is enabled for MG smoothing.
* \return True if output is enabled.
*/
bool GetMG_Smooth_Output() const { return MG_Smooth_Output; }

/*!\
* \brief Get whether implicit-lines agglomeration is enabled.
* \return True if implicit-lines agglomeration is enabled.
*/
bool GetMG_Implicit_Lines() const { return MG_Implicit_Lines; }

/*!\
* \brief Get whether implicit-lines debug output is enabled.
* \return True if implicit-lines debug output is enabled.
*/
bool GetMG_Implicit_Debug() const { return MG_Implicit_Debug; }

/*!\
* \brief Get whether halo CV coordinate validation is enabled for multigrid.
* \return True if halo coordinate validation is enabled.
*/
bool GetMG_DebugHaloCoordinates() const { return MG_DebugHaloCoordinates; }

/*!\
* \brief Get the minimum mesh size threshold used to compute effective MG levels.
* \return Minimum mesh size per coarsest level.
*/
unsigned long GetMG_Min_MeshSize() const { return MG_Min_MeshSize; }


/*!
* \brief Get the smoothing coefficient for MG correction smoothing.
* \return Smoothing coefficient.
*/
su2double GetMG_Smooth_Coeff() const { return MG_Smooth_Coeff; }

/*!
* \brief plane of the FFD (I axis) that should be fixed.
* \param[in] val_index - Index of the arrray with all the planes in the I direction that should be fixed.
Expand Down Expand Up @@ -6736,6 +6815,9 @@ class CConfig {
*/
su2double GetDamp_Res_Restric(void) const { return Damp_Res_Restric; }

/*!\n+ * \brief Set the damping factor for the residual restriction.\n+ * \param[in] val New value for the damping factor.\n+ */
void SetDamp_Res_Restric(su2double val) { Damp_Res_Restric = val; }

/*!
* \brief Value of the damping factor for the correction prolongation.
* \return Value of the damping factor.
Expand Down
1 change: 1 addition & 0 deletions Common/include/geometry/CGeometry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ class CGeometry {

/*!< \brief Bool if boundary-marker is straight(2D)/plane(3D) for each local marker. */
vector<bool> boundIsStraight;

vector<su2double> SurfaceAreaCfgFile; /*!< \brief Total Surface area for all markers. */

/*--- Partitioning-specific variables ---*/
Expand Down
44 changes: 39 additions & 5 deletions Common/include/geometry/CMultiGridGeometry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,36 +28,37 @@
#pragma once

#include "CGeometry.hpp"
class CMultiGridQueue;

/*!
* \class CMultiGridGeometry
* \brief Class for defining the multigrid geometry, the main delicated part is the
* \brief Class for defining the multigrid geometry, the main delegated part is the
* agglomeration stage, which is done in the declaration.
* \author F. Palacios
*/
class CMultiGridGeometry final : public CGeometry {
private:
/*!
* \brief Determine if a CVPoint van be agglomerated, if it have the same marker point as the seed.
* \brief Determine if a CVPoint can be agglomerated, if it has the same marker point as the seed.
* \param[in] CVPoint - Control volume to be agglomerated.
* \param[in] marker_seed - Marker of the seed.
* \param[in] fine_grid - Geometrical definition of the problem.
* \param[in] config - Definition of the particular problem.
* \return <code>TRUE</code> or <code>FALSE</code> depending if the control volume can be agglomerated.
*/
bool SetBoundAgglomeration(unsigned long CVPoint, short marker_seed, const CGeometry* fine_grid,
bool SetBoundAgglomeration(unsigned long CVPoint, vector<short> marker_seed, const CGeometry* fine_grid,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to pass information about all markers on the seed node (number of markers and index of marker)

const CConfig* config) const;

/*!
* \brief Determine if a can be agglomerated using geometrical criteria.
* \brief Determine if a Point can be agglomerated using geometrical criteria.
* \param[in] iPoint - Seed point.
* \param[in] fine_grid - Geometrical definition of the problem.
* \param[in] config - Definition of the particular problem.
*/
bool GeometricalCheck(unsigned long iPoint, const CGeometry* fine_grid, const CConfig* config) const;

/*!
* \brief Determine if a CVPoint van be agglomerated, if it have the same marker point as the seed.
* \brief Determine if a CVPoint can be agglomerated, if it has the same marker point as the seed.
* \param[out] Suitable_Indirect_Neighbors - List of Indirect Neighbours that can be agglomerated.
* \param[in] iPoint - Seed point.
* \param[in] Index_CoarseCV - Index of agglomerated point.
Expand All @@ -66,6 +67,32 @@ class CMultiGridGeometry final : public CGeometry {
void SetSuitableNeighbors(vector<unsigned long>& Suitable_Indirect_Neighbors, unsigned long iPoint,
unsigned long Index_CoarseCV, const CGeometry* fine_grid) const;

/*!
* \brief Agglomerate high-aspect ratio interior cells along implicit lines starting from wall vertices.
* \param[in,out] Index_CoarseCV - Reference to the current coarse control volume index that will be
* incremented as new coarse CVs are created.
* \param[in] fine_grid - Geometrical definition of the problem (fine grid).
* \param[in] config - Definition of the particular problem.
* \param[in,out] MGQueue_InnerCV - Queue used for STEP 2; agglomerated points will be removed from it.
*/
void AgglomerateImplicitLines(unsigned long& Index_CoarseCV, const CGeometry* fine_grid, const CConfig* config,
CMultiGridQueue& MGQueue_InnerCV);

/*!
* \brief Compute surface straightness for multigrid geometry.
* \param[in] config - Definition of the particular problem.
*/
void ComputeSurfStraightness(CConfig* config);

/*!
* \brief Compute local curvature at a boundary vertex on Euler wall.
* \param[in] fine_grid - Fine grid geometry.
* \param[in] iPoint - Point index.
* \param[in] iMarker - Marker index.
* \return Maximum angle (in degrees) between this vertex normal and adjacent vertex normals.
*/
su2double ComputeLocalCurvature(const CGeometry* fine_grid, unsigned long iPoint, unsigned short iMarker) const;

public:
/*--- This is to suppress Woverloaded-virtual, omitting it has no negative impact. ---*/
using CGeometry::SetBoundControlVolume;
Expand Down Expand Up @@ -154,4 +181,11 @@ class CMultiGridGeometry final : public CGeometry {
* \param[in] val_marker - Index of the boundary marker.
*/
void SetMultiGridWallTemperature(const CGeometry* fine_grid, unsigned short val_marker) override;

/*!
* \brief Validate that halo CV coordinates match corresponding domain CVs on remote ranks (debug feature).
* \param[in] config - Definition of the particular problem.
* \param[in] iMesh - Multigrid level for reporting.
*/
void ValidateHaloCoordinates(const CConfig* config, unsigned short iMesh) const;
};
2 changes: 1 addition & 1 deletion Common/include/geometry/CMultiGridQueue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class CMultiGridQueue {
void IncrPriorityCV(unsigned long incrPoint);

/*!
* \brief Increase the priority of the CV.
* \brief Reduce the priority of the CV.
* \param[in] redPoint - Index of the control volume.
*/
void RedPriorityCV(unsigned long redPoint);
Expand Down
27 changes: 26 additions & 1 deletion Common/src/CConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1955,6 +1955,31 @@ void CConfig::SetConfig_Options() {
/*!\brief MG_DAMP_PROLONGATION\n DESCRIPTION: Damping factor for the correction prolongation. DEFAULT 0.75 \ingroup Config*/
addDoubleOption("MG_DAMP_PROLONGATION", Damp_Correc_Prolong, 0.75);

/*!\brief MG_SMOOTH_EARLY_EXIT\n DESCRIPTION: Enable early exit for MG smoothing iterations based on RMS residual. DEFAULT: NO \ingroup Config*/
addBoolOption("MG_SMOOTH_EARLY_EXIT", MG_Smooth_EarlyExit, false);
/*!\brief MG_SMOOTH_RES_THRESHOLD\n DESCRIPTION: RMS residual threshold for early exit in MG smoothing. DEFAULT: 1e-2 \ingroup Config*/
addDoubleOption("MG_SMOOTH_RES_THRESHOLD", MG_Smooth_Res_Threshold, 1e-2);

/*!\brief MG_SMOOTH_OUTPUT\n DESCRIPTION: Output per-iteration RMS for MG smoothing. DEFAULT: NO \ingroup Config*/
addBoolOption("MG_SMOOTH_OUTPUT", MG_Smooth_Output, false);

/*!\brief MG_IMPLICIT_LINES\n DESCRIPTION: Enable agglomeration along implicit lines from wall seeds. DEFAULT: NO \ingroup Config*/
addBoolOption("MG_IMPLICIT_LINES", MG_Implicit_Lines, false);

/*!\brief MG_IMPLICIT_DEBUG\n DESCRIPTION: Enable debug output for implicit-lines agglomeration. DEFAULT: NO \ingroup Config*/
addBoolOption("MG_IMPLICIT_DEBUG", MG_Implicit_Debug, false);

/*!\brief MG_DEBUG_HALO_COORDINATES\n DESCRIPTION: Enable halo CV coordinate validation for multigrid (expensive MPI check). DEFAULT: NO \ingroup Config*/
addBoolOption("MG_DEBUG_HALO_COORDINATES", MG_DebugHaloCoordinates, false);

/*!\brief MG_MIN_MESHSIZE
\ DESCRIPTION: Minimum global mesh size (points) to allow another multigrid level. DEFAULT: 1000 \ingroup Config*/
addUnsignedLongOption("MG_MIN_MESHSIZE", MG_Min_MeshSize, 1000);


/*!\brief MG_SMOOTH_COEFF\n DESCRIPTION: Smoothing coefficient for MG correction smoothing. DEFAULT: 1.25 \ingroup Config*/
addDoubleOption("MG_SMOOTH_COEFF", MG_Smooth_Coeff, 1.25);

/*!\par CONFIG_CATEGORY: Spatial Discretization \ingroup Config*/
/*--- Options related to the spatial discretization ---*/

Expand Down Expand Up @@ -3538,7 +3563,7 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
}

/*--- Check if MULTIGRID is requested in VOLUME_OUTPUT and set the config boolean accordingly. ---*/
Wrt_MultiGrid = false;
Wrt_MultiGrid = true;
for (unsigned short iField = 0; iField < nVolumeOutput; iField++) {
if(VolumeOutput[iField].find("MULTIGRID") != string::npos) {
Wrt_MultiGrid = true;
Expand Down
34 changes: 17 additions & 17 deletions Common/src/geometry/CGeometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2472,8 +2472,7 @@ void CGeometry::ComputeModifiedSymmetryNormals(const CConfig* config) {
* All nodes that are shared by multiple symmetries have to get a corrected normal. */

/*--- Compute if markers are straight lines or planes. ---*/
ComputeSurfStraightness(config, false);

ComputeSurfStraightness(config, true);
symmetryNormals.clear();
symmetryNormals.resize(nMarker);
std::vector<unsigned short> symMarkers, curvedSymMarkers;
Expand Down Expand Up @@ -2589,19 +2588,18 @@ void CGeometry::ComputeSurfStraightness(const CConfig* config, bool print_on_scr
constexpr passivedouble epsilon = 1.0e-6;
su2double Area;
string Local_TagBound, Global_TagBound;

vector<su2double> Normal(nDim), UnitNormal(nDim), RefUnitNormal(nDim);

/*--- Assume now that this boundary marker is straight. As soon as one
AreaElement is found that is not aligend with a Reference then it is
certain that the boundary marker is not straight and one can stop
searching. Another possibility is that this process doesn't own
any nodes of that boundary, in that case we also have to assume the
boundary is straight.
Any boundary type other than SYMMETRY_PLANE or EULER_WALL gets
the value false (or see cases specified in the conditional below)
which could be wrong. ---*/
cout << "Computing surface straightness for symmetry and Euler wall boundary markers..." << endl;

vector<su2double> Normal(nDim), UnitNormal(nDim), RefUnitNormal(nDim); /*--- Assume now that this boundary marker is
straight. As soon as one AreaElement is found that is not aligned with a Reference then it is certain that the
boundary marker is not straight and one can stop searching. Another possibility is that this process doesn't own
any nodes of that boundary, in that case we also have to assume the
boundary is straight.
Any boundary type other than SYMMETRY_PLANE or EULER_WALL gets
the value false (or see cases specified in the conditional below)
which could be wrong. ---*/
boundIsStraight.resize(nMarker);
cout << "boundisstraight size = " << boundIsStraight.size() << endl;
fill(boundIsStraight.begin(), boundIsStraight.end(), true);

/*--- Loop over all local markers ---*/
Expand Down Expand Up @@ -2685,7 +2683,7 @@ void CGeometry::ComputeSurfStraightness(const CConfig* config, bool print_on_scr
/*--- Product of type <int>(bool) is equivalnt to a 'logical and' ---*/
SU2_MPI::Allreduce(Buff_Send_isStraight.data(), Buff_Recv_isStraight.data(), nMarker_Global, MPI_INT, MPI_PROD,
SU2_MPI::GetComm());

cout << "global markers = " << nMarker_Global << endl;
/*--- Print results on screen. ---*/
if (rank == MASTER_NODE) {
for (iMarker_Global = 0; iMarker_Global < nMarker_Global; iMarker_Global++) {
Expand Down Expand Up @@ -3902,11 +3900,13 @@ void CGeometry::ColorMGLevels(unsigned short nMGLevels, const CGeometry* const*
for (auto step = 0u; step < iMesh; ++step) {
auto coarseMesh = geometry[iMesh - 1 - step];
if (step)
for (auto iPoint = 0ul; iPoint < coarseMesh->GetnPoint(); ++iPoint)
for (auto iPoint = 0ul; iPoint < coarseMesh->GetnPoint(); ++iPoint) {
CoarseGridColor_(iPoint, step) = CoarseGridColor_(coarseMesh->nodes->GetParent_CV(iPoint), step - 1);
}
else
for (auto iPoint = 0ul; iPoint < coarseMesh->GetnPoint(); ++iPoint)
for (auto iPoint = 0ul; iPoint < coarseMesh->GetnPoint(); ++iPoint) {
CoarseGridColor_(iPoint, step) = color[coarseMesh->nodes->GetParent_CV(iPoint)];
}
}
}
}
Expand Down
Loading
Loading