Skip to content

Conversation

@bigfooted
Copy link
Contributor

@bigfooted bigfooted commented Jan 18, 2026

Proposed Changes

Give a brief overview of your contribution here in a few sentences.

Implement multigrid agglomeration according to Nishikawa and Diskin.

  • euler walls are working correctly.

  • mpi still needs to be checked.

  • I am submitting my contribution to the develop branch.

  • My contribution generates no new compiler warnings (try with --warnlevel=3 when using meson).

  • My contribution is commented and consistent with SU2 style (https://su2code.github.io/docs_v7/Style-Guide/).

  • I used the pre-commit hook to prevent dirty commits and used pre-commit run --all to format old commits.

  • I have added a test case that demonstrates my contribution, if necessary.

  • I have updated appropriate documentation (Tutorials, Docs Page, config_template.cpp), if necessary.


const unsigned short nVar = sol_fine->GetnVar();
const su2double factor = config->GetDamp_Correc_Prolong();
//const su2double factor = config->GetDamp_Correc_Prolong();

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.

Copilot Autofix

AI about 21 hours ago

In general, to fix commented‑out code, either remove it entirely or reinstate it as active code, and rely on version control history if you ever need to recover old implementations. If the intent is to document behavior, rewrite it as an explanatory comment rather than a compilable snippet.

For this case, the best fix without changing existing functionality is to delete the commented‑out declaration of factor on line 649. The active implementation already sets factor via base_damp, so removing the old, commented line will not alter behavior. No new methods, imports, or definitions are required; only the single line within CMultiGridIntegration::SetProlongated_Correction in SU2_CFD/src/integration/CMultiGridIntegration.cpp needs to be removed.

Suggested changeset 1
SU2_CFD/src/integration/CMultiGridIntegration.cpp

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/SU2_CFD/src/integration/CMultiGridIntegration.cpp b/SU2_CFD/src/integration/CMultiGridIntegration.cpp
--- a/SU2_CFD/src/integration/CMultiGridIntegration.cpp
+++ b/SU2_CFD/src/integration/CMultiGridIntegration.cpp
@@ -646,7 +646,6 @@
   su2double *Solution_Fine, *Residual_Fine;
 
   const unsigned short nVar = sol_fine->GetnVar();
-  //const su2double factor = config->GetDamp_Correc_Prolong();
 
   /*--- Apply level-dependent damping: more aggressive damping on deeper coarse levels ---*/
   const su2double base_damp = config->GetDamp_Correc_Prolong();
EOF
@@ -646,7 +646,6 @@
su2double *Solution_Fine, *Residual_Fine;

const unsigned short nVar = sol_fine->GetnVar();
//const su2double factor = config->GetDamp_Correc_Prolong();

/*--- Apply level-dependent damping: more aggressive damping on deeper coarse levels ---*/
const su2double base_damp = config->GetDamp_Correc_Prolong();
Copilot is powered by AI and may make mistakes. Always verify output.
Comment on lines +60 to +64
MG_PRE_SMOOTH= ( 4, 4, 4, 4 )
MG_POST_SMOOTH= ( 4, 4, 4, 4 )
MG_CORRECTION_SMOOTH= ( 4, 4, 4, 4 )
MG_DAMP_RESTRICTION= 0.5
MG_DAMP_PROLONGATION= 0.5
Copy link
Contributor Author

Choose a reason for hiding this comment

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

When MG is finalized, these will be initial values and will be adaptively changed.

/*--- Note: CFL at the coarse levels have a large impact on convergence,
this should be rewritten to use adaptive CFL. ---*/
const su2double factor = 1.0;
const su2double Coeff = 1.1; // pow(su2double(Global_nPointFine) / Global_nPointCoarse, 1.0 / nDim);

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.

Copilot Autofix

AI about 8 hours ago

In general, to fix commented‑out code you either (1) delete it outright if it is no longer needed, or (2) convert it into a clearly non-code comment (e.g., “Alternative formula: ...”) so that it is obviously documentation, not dormant logic. You avoid re-enabling it unless you are sure that behavior is desired and still correct.

For this specific case, the best low‑risk fix without changing existing functionality is to keep Coeff equal to 1.1 as it is now, and rewrite the commented pow(...) expression into a descriptive comment. That removes the appearance of commented‑out code while retaining the information about the alternative formula. Concretely, in Common/src/geometry/CMultiGridGeometry.cpp around line 722, replace the current line with a normal comment that explains that 1.1 is a fixed approximation and that the commented expression is the original adaptive formula. No imports or additional definitions are required.

Suggested changeset 1
Common/src/geometry/CMultiGridGeometry.cpp

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/Common/src/geometry/CMultiGridGeometry.cpp b/Common/src/geometry/CMultiGridGeometry.cpp
--- a/Common/src/geometry/CMultiGridGeometry.cpp
+++ b/Common/src/geometry/CMultiGridGeometry.cpp
@@ -717,9 +717,10 @@
 
   if (iMesh != MESH_0) {
     /*--- Note: CFL at the coarse levels have a large impact on convergence,
-          this should be rewritten to use adaptive CFL. ---*/
+          this should be rewritten to use adaptive CFL.
+          Original idea: Coeff = pow(su2double(Global_nPointFine) / Global_nPointCoarse, 1.0 / nDim); ---*/
     const su2double factor = 1.0;
-    const su2double Coeff = 1.1;  // pow(su2double(Global_nPointFine) / Global_nPointCoarse, 1.0 / nDim);
+    const su2double Coeff = 1.1;
     const su2double CFL = factor * config->GetCFL(iMesh - 1) / Coeff;
     config->SetCFL(iMesh, CFL);
   }
EOF
@@ -717,9 +717,10 @@

if (iMesh != MESH_0) {
/*--- Note: CFL at the coarse levels have a large impact on convergence,
this should be rewritten to use adaptive CFL. ---*/
this should be rewritten to use adaptive CFL.
Original idea: Coeff = pow(su2double(Global_nPointFine) / Global_nPointCoarse, 1.0 / nDim); ---*/
const su2double factor = 1.0;
const su2double Coeff = 1.1; // pow(su2double(Global_nPointFine) / Global_nPointCoarse, 1.0 / nDim);
const su2double Coeff = 1.1;
const su2double CFL = factor * config->GetCFL(iMesh - 1) / Coeff;
config->SetCFL(iMesh, CFL);
}
Copilot is powered by AI and may make mistakes. Always verify output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants