Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
5af8875
early exit
bigfooted Mar 29, 2026
67348fe
early exit, post-smoothing improvement
bigfooted Mar 29, 2026
8d28037
smooth coeff
bigfooted Mar 29, 2026
7a5c019
add mg_min_meshsize
bigfooted Mar 29, 2026
1bafd7a
precommit
bigfooted Mar 29, 2026
5830da2
small cleanup
bigfooted Mar 29, 2026
7835fa9
Merge branch 'develop' into feature_MG_adapt
bigfooted Mar 30, 2026
45324bc
change constexpr
bigfooted Mar 30, 2026
b6c4a68
Merge branch 'feature_MG_adapt' of https://github.com/su2code/su2 int…
bigfooted Mar 30, 2026
bca1a5b
change all multigrid V-cycle setups
bigfooted Mar 30, 2026
691cd82
precommit
bigfooted Mar 31, 2026
e9b0049
precommit
bigfooted Mar 31, 2026
296f628
regressions
bigfooted Apr 1, 2026
bbbfc04
change config settings for better convergence
bigfooted Apr 1, 2026
41a1623
fix multigrid restart for turbulence
bigfooted Apr 1, 2026
930cf53
OMP for multigrid restart prevents race
bigfooted Apr 1, 2026
d8c95f8
update some regressions
bigfooted Apr 2, 2026
c478aef
update some regressions
bigfooted Apr 2, 2026
e9c968e
update some regressions
bigfooted Apr 2, 2026
c503542
update some regressions, change printed output
bigfooted Apr 3, 2026
7138418
fix typo
bigfooted Apr 3, 2026
6b366ce
fix segfault for periodic with multigrid
bigfooted Apr 3, 2026
cfec822
initial fix for periodic boundaries
bigfooted Apr 3, 2026
62650e5
Potential fix for code scanning alert no. 6209: Syntax error
bigfooted Apr 3, 2026
4a3a37b
Merge branch 'develop' into feature_MG_adapt
bigfooted Apr 3, 2026
450c768
fix additional periodic stuff.
bigfooted Apr 3, 2026
8dff939
turbo + MG testcase
bigfooted Apr 3, 2026
fef7613
Merge branch 'feature_MG_adapt' of https://github.com/su2code/su2 int…
bigfooted Apr 3, 2026
7bde034
cleanup matchperiodic
bigfooted Apr 3, 2026
cda0644
cleanup unneeded nan fixes
bigfooted Apr 3, 2026
db69ad2
clang
bigfooted Apr 3, 2026
c7f5c25
codi
bigfooted Apr 3, 2026
75c337f
Update SU2_CFD/src/integration/CMultiGridIntegration.cpp
bigfooted Apr 4, 2026
24b2c7d
Update SU2_CFD/src/integration/CMultiGridIntegration.cpp
bigfooted Apr 4, 2026
862dac7
implement review suggestions
bigfooted Apr 4, 2026
10d18f0
move and simplify linsysresRMS
bigfooted Apr 4, 2026
dcf34d3
use printing toolbox
bigfooted Apr 4, 2026
bbbbdac
use geometry toolbox
bigfooted Apr 4, 2026
886ddb3
remove allreduce
bigfooted Apr 4, 2026
2fb12a2
fix delete []
bigfooted Apr 4, 2026
57e0091
compact mg option initialization
bigfooted Apr 4, 2026
b22f45b
remove variable
bigfooted Apr 4, 2026
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
84 changes: 68 additions & 16 deletions Common/include/CConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ class CConfig {
string CustomObjFunc; /*!< \brief User-defined objective function. */
string CustomOutputs; /*!< \brief User-defined functions for outputs. */
unsigned short nDV, /*!< \brief Number of design variables. */
nObj, nObjW; /*! \brief Number of objective functions. */
nObj, nObjW; /*!< \brief Number of objective functions. */
unsigned short* nDV_Value; /*!< \brief Number of values for each design variable (might be different than 1 if we allow arbitrary movement). */
unsigned short nFFDBox; /*!< \brief Number of ffd boxes. */
unsigned short nTurboMachineryKind; /*!< \brief Number turbomachinery types specified. */
Expand All @@ -489,20 +489,14 @@ class CConfig {
string *FFDTag; /*!< \brief Parameters of the design variable. */
string *TagFFDBox; /*!< \brief Tag of the FFD box. */
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. */
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. */
su2double *LocationStations; /*!< \brief Airfoil sections in wing slicing subroutine. */

ENUM_MG_CYCLE Kind_MGCycle; /*!< \brief Kind of multigrid cycle. */
ENUM_MULTIZONE Kind_MZSolver; /*!< \brief Kind of multizone solver. */
INC_DENSITYMODEL Kind_DensityModel; /*!< \brief Kind of the density model for incompressible flows. */
CHT_COUPLING Kind_CHT_Coupling; /*!< \brief Kind of coupling method used at CHT interfaces. */
Expand Down Expand Up @@ -1132,6 +1126,20 @@ class CConfig {
unsigned long rampMUSCLCoeff[3]; /*!< \brief ramp MUSCL value coefficients for the COption class. */
} RampMUSCLParam;
su2double rampMUSCLValue; /*!< \brief Current value of the MUSCL ramp */
struct CMGOptions {
su2double MG_Smooth_Res_Threshold; /*!< \brief RMS reduction threshold for MG smoothing early exit. */
su2double MG_Smooth_Coeff; /*!< \brief Jacobi smoother coefficient for coarse-grid correction. */
unsigned long MG_Min_MeshSize; /*!< \brief Minimum CVs on coarsest MG level. */
unsigned short nMG_PreSmooth; /*!< \brief Number of MG pre-smooth values in config file. */
unsigned short nMG_PostSmooth; /*!< \brief Number of MG post-smooth values in config file. */
unsigned short nMG_CorrecSmooth; /*!< \brief Number of MG correct-smooth values in config file. */
unsigned short *MG_PreSmooth; /*!< \brief Multigrid pre-smoothing iterations per level. */
unsigned short *MG_PostSmooth; /*!< \brief Multigrid post-smoothing iterations per level. */
unsigned short *MG_CorrecSmooth; /*!< \brief Multigrid Jacobi correction-smoothing per level. */
bool MG_Smooth_EarlyExit; /*!< \brief Enable early exit for MG smoothing iterations. */
bool MG_Smooth_Output; /*!< \brief Output compact per-cycle smoothing summary. */
bool MG_Implicit_Lines; /*!< \brief Enable implicit-lines agglomeration from walls. */
} MGOptions;

ENUM_STREAMWISE_PERIODIC Kind_Streamwise_Periodic; /*!< \brief Kind of Streamwise periodic flow (pressure drop or massflow) */
bool Streamwise_Periodic_Temperature; /*!< \brief Use real periodicity for Energy equation or otherwise outlet source term. */
Expand Down Expand Up @@ -1297,6 +1305,7 @@ class CConfig {
/*--- Additional flamelet solver options ---*/
FluidFlamelet_ParsedOptions flamelet_ParsedOptions; /*!< \brief Additional flamelet solver options */


/*!
* \brief Set the default values of config options not set in the config file using another config object.
* \param config - Config object to use the default values from.
Expand Down Expand Up @@ -2908,7 +2917,7 @@ class CConfig {
*/
void SetMGLevels(unsigned short val_nMGLevels) {
nMGLevels = val_nMGLevels;
if (MGCycle == FULLMG_CYCLE) {
if (Kind_MGCycle == ENUM_MG_CYCLE::FULLMG_CYCLE) {
SetFinestMesh(val_nMGLevels);
}
}
Expand All @@ -2925,7 +2934,7 @@ class CConfig {
* \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.
*/
unsigned short GetMGCycle(void) const { return MGCycle; }
ENUM_MG_CYCLE GetMGCycle(void) const { return Kind_MGCycle; }

/*!
* \brief Get the king of evaluation in the geometrical module.
Expand Down Expand Up @@ -3852,8 +3861,8 @@ class CConfig {
* \return Number of smoothing iterations.
*/
unsigned short GetMG_PreSmooth(unsigned short val_mesh) const {
if (nMG_PreSmooth == 0) return 1;
return MG_PreSmooth[val_mesh];
if (MGOptions.nMG_PreSmooth == 0) return 1;
return MGOptions.MG_PreSmooth[val_mesh];
}

/*!
Expand All @@ -3862,8 +3871,8 @@ class CConfig {
* \return Number of smoothing iterations.
*/
unsigned short GetMG_PostSmooth(unsigned short val_mesh) const {
if (nMG_PostSmooth == 0) return 0;
return MG_PostSmooth[val_mesh];
if (MGOptions.nMG_PostSmooth == 0) return 0;
return MGOptions.MG_PostSmooth[val_mesh];
}

/*!
Expand All @@ -3872,10 +3881,41 @@ class CConfig {
* \return Number of implicit smoothing iterations.
*/
unsigned short GetMG_CorrecSmooth(unsigned short val_mesh) const {
if (nMG_CorrecSmooth == 0) return 0;
return MG_CorrecSmooth[val_mesh];
if (MGOptions.nMG_CorrecSmooth == 0) return 0;
return MGOptions.MG_CorrecSmooth[val_mesh];
}

/*!
* \brief Whether early exit is enabled for MG smoothing iterations.
*/
bool GetMG_Smooth_EarlyExit() const { return MGOptions.MG_Smooth_EarlyExit; }

/*!
* \brief RMS reduction threshold for MG smoothing early exit.
* Smoothing stops when current_rms < threshold * initial_rms.
*/
su2double GetMG_Smooth_Res_Threshold() const { return MGOptions.MG_Smooth_Res_Threshold; }

/*!
* \brief Whether to print a compact per-cycle smoothing iteration summary.
*/
bool GetMG_Smooth_Output() const { return MGOptions.MG_Smooth_Output; }

/*!
* \brief Smoothing coefficient for the correction prolongation Jacobi smoother.
*/
su2double GetMG_Smooth_Coeff() const { return MGOptions.MG_Smooth_Coeff; }

/*!
* \brief Minimum number of CVs on the coarsest multigrid level.
*/
unsigned long GetMG_Min_MeshSize() const { return MGOptions.MG_Min_MeshSize; }

/*!
* \brief Whether implicit-lines agglomeration from walls is enabled.
*/
bool GetMG_Implicit_Lines() const { return MGOptions.MG_Implicit_Lines; }

/*!
* \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 @@ -6833,12 +6873,24 @@ class CConfig {
*/
su2double GetDamp_Res_Restric(void) const { return Damp_Res_Restric; }

/*!
* \brief Set the damping factor for the residual restriction (used by adaptive MG damping).
* \param[in] val - New damping factor value.
*/
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.
*/
su2double GetDamp_Correc_Prolong(void) const { return Damp_Correc_Prolong; }

/*!
* \brief Set the damping factor for the correction prolongation (used by adaptive MG damping).
* \param[in] val - New damping factor value.
*/
void SetDamp_Correc_Prolong(su2double val) { Damp_Correc_Prolong = val; }

/*!
* \brief Value of the position of the Near Field (y coordinate for 2D, and z coordinate for 3D).
* \return Value of the Near Field position.
Expand Down
7 changes: 5 additions & 2 deletions Common/include/geometry/CGeometry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -811,10 +811,13 @@ class CGeometry {
inline virtual void MatchActuator_Disk(const CConfig* config) {}

/*!
* \brief A virtual member.
* \brief Match periodic boundary points using coordinate-based matching.
* \details Gathers coordinates from all ranks via MPI, applies the rotation/translation
* for the periodic pair, and finds the nearest neighbor. Works on both fine and coarse grids.
* \param[in] config - Definition of the particular problem.
* \param[in] val_periodic - Index of the periodic marker pair.
*/
inline virtual void MatchPeriodic(const CConfig* config, unsigned short val_periodic) {}
virtual void MatchPeriodic(const CConfig* config, unsigned short val_periodic);

/*!
* \brief A virtual member.
Expand Down
19 changes: 12 additions & 7 deletions Common/include/geometry/CMultiGridGeometry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@

#include "CGeometry.hpp"

class CMultiGridQueue;

/*!
* \class CMultiGridGeometry
* \brief Class for defining the multigrid geometry, the main dedicated part is the
Expand Down Expand Up @@ -75,6 +77,16 @@ class CMultiGridGeometry final : public CGeometry {
*/
su2double ComputeLocalCurvature(const CGeometry* fine_grid, unsigned long iPoint, unsigned short iMarker) const;

/*!
* \brief Agglomerate high-aspect-ratio interior cells along implicit lines from wall vertices.
* \param[in,out] Index_CoarseCV - Current coarse CV index, incremented as new coarse CVs are created.
* \param[in] fine_grid - Fine grid geometry.
* \param[in] config - Configuration.
* \param[in,out] MGQueue_InnerCV - Queue for domain agglomeration; processed points are removed.
*/
void AgglomerateImplicitLines(unsigned long& Index_CoarseCV, const CGeometry* fine_grid, const CConfig* config,
CMultiGridQueue& MGQueue_InnerCV);

public:
/*--- This is to suppress Woverloaded-virtual, omitting it has no negative impact. ---*/
using CGeometry::SetBoundControlVolume;
Expand Down Expand Up @@ -143,13 +155,6 @@ class CMultiGridGeometry final : public CGeometry {
*/
void MatchActuator_Disk(const CConfig* config) override;

/*!
* \brief Mach the periodic boundary conditions.
* \param[in] config - Definition of the particular problem.
* \param[in] val_periodic - Index of the first periodic face in a pair.
*/
void MatchPeriodic(const CConfig* config, unsigned short val_periodic) override;

/*!
* \brief Set a representative wall normal heat flux of the agglomerated control volume on a particular boundary
* marker. \param[in] fine_grid - Geometrical definition of the problem. \param[in] val_marker - Index of the boundary
Expand Down
7 changes: 0 additions & 7 deletions Common/include/geometry/CPhysicalGeometry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,13 +438,6 @@ class CPhysicalGeometry final : public CGeometry {
*/
void MatchActuator_Disk(const CConfig* config) override;

/*!
* \brief Mach the periodic boundary conditions.
* \param[in] config - Definition of the particular problem.
* \param[in] val_periodic - Index of the first periodic face in a pair.
*/
void MatchPeriodic(const CConfig* config, unsigned short val_periodic) override;

/*!
* \brief Set boundary vertex structure of the control volume.
* \param[in] config - Definition of the particular problem.
Expand Down
2 changes: 1 addition & 1 deletion Common/include/linear_algebra/CSysSolve.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ class CSysSolve {
* vector is kept in nrm0 and updated after operating with each vector
*
*/
void ModGramSchmidt(bool shared_hsbg, int i, su2matrix<ScalarType>& Hsbg, std::vector<VectorType>& w) const;
bool ModGramSchmidt(bool shared_hsbg, int i, su2matrix<ScalarType>& Hsbg, std::vector<VectorType>& w) const;

/*!
* \brief writes header information for a CSysSolve residual history
Expand Down
18 changes: 9 additions & 9 deletions Common/include/option_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2281,17 +2281,17 @@ static const MapType<std::string, JUMP_DEFINITION> Jump_Map = {
/*!
* \brief Type of multigrid cycle
*/
enum MG_CYCLE {
V_CYCLE = 0, /*!< \brief V cycle. */
W_CYCLE = 1, /*!< \brief W cycle. */
FULLMG_CYCLE = 2 /*!< \brief FullMG cycle. */
};
static const MapType<std::string, MG_CYCLE> MG_Cycle_Map = {
MakePair("V_CYCLE", V_CYCLE)
MakePair("W_CYCLE", W_CYCLE)
MakePair("FULLMG_CYCLE", FULLMG_CYCLE)
enum class ENUM_MG_CYCLE {
V_CYCLE, /*!< \brief V-cycle multigrid solver. */
W_CYCLE, /*!< \brief W-cycle multigrid solver. */
FULLMG_CYCLE, /*!< \brief Full multigrid (FMG) solver. */
};

static const MapType<std::string, ENUM_MG_CYCLE> MG_Cycle_Map = {
MakePair("V_CYCLE", ENUM_MG_CYCLE::V_CYCLE)
MakePair("W_CYCLE", ENUM_MG_CYCLE::W_CYCLE)
MakePair("FULLMG_CYCLE", ENUM_MG_CYCLE::FULLMG_CYCLE)
};
/*!
* \brief Types of design parameterizations
*/
Expand Down
Loading
Loading