Skip to content

Conversation

@bigfooted
Copy link
Contributor

@bigfooted bigfooted commented Nov 8, 2024

Proposed Changes

Implement multigrid agglomeration rules according to Nishikawa et al paper:

https://www.researchgate.net/publication/267557097_Development_and_Application_of_Parallel_Agglomerated_Multigrid_Method_for_Complex_Geometries

These rules were not consistently implemented. Issues:

  1. Ridge -> ridge agglomeration was not possible.
  2. Interior points were allowed to be agglomerated with boundary points.
  3. The symmetry plane / euler wall agglomeration rules are too restrictive.

current features:

  1. restrict MGLEVELS based on grid size (just set MGLEVELS to a high number)
  2. early exit when smoothing converges (just set MG_**SMOOTH numbers to a high value)
  3. MG_SMOOTH_EARLY_EXIT and MG_SMOOTH_RES_THRESHOLD can be set to control this
  4. adaptive damping factor for MG_DAMP_RESTRICTION (MG_DAMP_PROLONGATION can always be at a high value)
  5. agglomerating using method of implicit lines at walls (MG_IMPLICIT_LINES=YES)
  6. ADAPTIVE CFL works on multigrid
  7. Euler walls are agglomerated when the angle between edges alpha < 30 degrees. This keeps features like sharp trailing edges. maybe extend to all walls?

TO DO:

  1. properly agglomerate nodes that are on mpi interfaces (SEND_RECEIVE markers)
  2. inspect if turbulence can be added to multigrid as well.

PR Checklist

Put an X by all that apply. You can fill this out after submitting the PR. If you have any questions, don't hesitate to ask! We want to help. These are a guide for you to know what the reviewers will be looking for in your contribution.

  • 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.

* \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)

case SUB_SOLVER_TYPE::TURB_SST:
genericSolver = CreateTurbSolver(kindTurbModel, solver, geometry, config, iMGLevel, false);
metaData.integrationType = INTEGRATION_TYPE::SINGLEGRID;
//metaData.integrationType = INTEGRATION_TYPE::MULTIGRID;

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.

Copilot Autofix

AI about 1 month ago

The best way to fix this problem is to remove the commented-out code on line 313: //metaData.integrationType = INTEGRATION_TYPE::MULTIGRID;. This line is commented out without justification, and does not serve as documentation or a helpful note. No other changes are required (such as reinstating the code), since there is already a definitive assignment for metaData.integrationType just above this line, and no surrounding commentary suggests ambiguity.

Edit SU2_CFD/src/solvers/CSolverFactory.cpp by deleting line 313 entirely. No import, method, or variable changes are necessary.

Suggested changeset 1
SU2_CFD/src/solvers/CSolverFactory.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/solvers/CSolverFactory.cpp b/SU2_CFD/src/solvers/CSolverFactory.cpp
--- a/SU2_CFD/src/solvers/CSolverFactory.cpp
+++ b/SU2_CFD/src/solvers/CSolverFactory.cpp
@@ -310,7 +310,6 @@
     case SUB_SOLVER_TYPE::TURB_SST:
       genericSolver = CreateTurbSolver(kindTurbModel, solver, geometry, config, iMGLevel, false);
       metaData.integrationType = INTEGRATION_TYPE::SINGLEGRID;
-      //metaData.integrationType = INTEGRATION_TYPE::MULTIGRID;
       break;
     case SUB_SOLVER_TYPE::TEMPLATE:
       genericSolver = new CTemplateSolver(geometry, config);
EOF
@@ -310,7 +310,6 @@
case SUB_SOLVER_TYPE::TURB_SST:
genericSolver = CreateTurbSolver(kindTurbModel, solver, geometry, config, iMGLevel, false);
metaData.integrationType = INTEGRATION_TYPE::SINGLEGRID;
//metaData.integrationType = INTEGRATION_TYPE::MULTIGRID;
break;
case SUB_SOLVER_TYPE::TEMPLATE:
genericSolver = new CTemplateSolver(geometry, config);
Copilot is powered by AI and may make mistakes. Always verify output.
@YairMO
Copy link

YairMO commented Nov 16, 2024

Hi,

It would be great to make the MG work better. I would like to take this opportunity to improve my understanding of the MG inputs in the cfg file. Here is an example of MG input:

MGLEVEL=3
MGCYCLE= V_CYCLE
MG_PRE_SMOOTH= ( 5, 5, 5, 10 )
MG_POST_SMOOTH= ( 5, 5, 5, 5 )
MG_CORRECTION_SMOOTH= ( 25, 20, 15, 10 )

I was expecting to obtain the same report in the SU2 output file. However, there seems to be a gap between the input and the output reports. I attached the corresponding report output (of the above input):
MG-Output

Also, could you tell me how a turbulence model is handled within the MG? Is it projected or solved using the MG method?

Thank you

@bigfooted
Copy link
Contributor Author

In SU2, we overwrite part of the config settings. The nr of pre-smoothing steps for the finest grid is always 1. The nr of post-smoothing steps for the coarsest and finest grid is always 0. I do not know why.
At the moment, we do not use multigrid for additional scalar equations like turbulence and species transport.

@YairMO
Copy link

YairMO commented Nov 18, 2024

Thank you.
I understand why pre- and post-smoothing of the coarsest and finest levels may be indistinguishable. Therefore, I understand why the post-smoothing of these levels is zero, but I expect instead to control the pre-smoothing relaxation of the finest level. Fixing the pre-smoothing of the finest level to 1 relaxation may be insufficient.

We wish to contribute our knowledge about MG for scalar transport equations; if an exciting group is on this topic, we will be happy to collaborate.

@bigfooted
Copy link
Contributor Author

Nice to hear there is a larger interest in getting the multigrid method to a higher level. If you would like to enable multigrid for species transport, the first thing to do is change the integration type from SINGLEGRID to MULTIGRID for CreateSpeciesSolver in CSolverFactory.cpp. Then in CMultigridIntegration.cpp, there might be some solver specific things that need to be added.
Another thing that seems important for viscous applications is to agglomerate along implicit lines normal to viscous walls.

@YairMO
Copy link

YairMO commented Nov 19, 2024

Thank you for pointing this out. Does the current agglomeration (for the mean-flow equations) consider lines normal to the surface? I think that the Hiroaki paper (MG) considred implicit line?

@bigfooted
Copy link
Contributor Author

Hi, No we currently do not do agglomeration along lines. I suspect this is one reason that we do not have good multigrid performance for a number of viscous testcases. @EvertBunschoten was looking into this as well, but he was not yet able to reproduce the good performance reported by the papers of Diskin, Nishikawa and others.

Comment on lines +828 to +829
// auto end2 = Suitable_Second_Neighbors.end();
// if (find(Suitable_Second_Neighbors.begin(), end2, lPoint) != end2) continue;

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.

Copilot Autofix

AI 9 days ago

The best way to address this issue is to remove the commented-out code block that constitutes code, not documentation, in lines 1151–1168 and the similar block in 1172–1176, while retaining any genuine comments and TODOs. The rationale can be preserved by expanding the existing TODO or explanatory comment, clarifying that the removed block used to attempt further neighbor searches but was deemed redundant, thus future maintainers are pointed towards the issue's context without having to parse dead code. No new imports, methods, or definitions are needed.


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
@@ -1146,33 +1146,33 @@
 
   /*--- Create a list with the third neighbors, without first, second, and seed neighbors. ---*/
 
-  /// TODO: This repeats the process above but I doubt it catches any more points.
+  /// TODO: Previous code tried to find third neighbors by extending the search beyond second neighbors.
+  ///       However, this may not be needed, as it likely does not catch more points.
+  ///       If more sophisticated neighbor discovery is later required, refer to version history.
 
-  // vector<unsigned long> Third_Neighbor_Points, Third_Origin_Points;
 
-  // for (auto kPoint : Suitable_Second_Neighbors) {
-  //   for (auto lPoint : fine_grid->nodes->GetPoints(kPoint)) {
-  //     /*--- Check that the third neighbor does not belong to the first neighbors or the seed ---*/
 
-  //     auto end1 = First_Neighbor_Points.end();
-  //     if (find(First_Neighbor_Points.begin(), end1, lPoint) != end1) continue;
 
-  //     /*--- Check that the third neighbor does not belong to the second neighbors ---*/
 
-  //     auto end2 = Suitable_Second_Neighbors.end();
-  //     if (find(Suitable_Second_Neighbors.begin(), end2, lPoint) != end2) continue;
 
-  //     Third_Neighbor_Points.push_back(lPoint);
-  //     Third_Origin_Points.push_back(kPoint);
-  //   }
-  // }
 
+
+
+
+
+
+
+
+
+
+
+
   /*--- Identify those third neighbors that are repeated (candidate to be added). ---*/
 
-  // for (auto iNeighbor = 0ul; iNeighbor < Third_Neighbor_Points.size(); iNeighbor++) {
-  //   for (auto jNeighbor = iNeighbor + 1; jNeighbor < Third_Neighbor_Points.size(); jNeighbor++) {
-  //     /*--- Repeated third neighbor with different origin ---*/
 
+
+
+
   //     if ((Third_Neighbor_Points[iNeighbor] == Third_Neighbor_Points[jNeighbor]) &&
   //         (Third_Origin_Points[iNeighbor] != Third_Origin_Points[jNeighbor])) {
   //       Suitable_Indirect_Neighbors.push_back(Third_Neighbor_Points[iNeighbor]);
EOF
@@ -1146,33 +1146,33 @@

/*--- Create a list with the third neighbors, without first, second, and seed neighbors. ---*/

/// TODO: This repeats the process above but I doubt it catches any more points.
/// TODO: Previous code tried to find third neighbors by extending the search beyond second neighbors.
/// However, this may not be needed, as it likely does not catch more points.
/// If more sophisticated neighbor discovery is later required, refer to version history.

// vector<unsigned long> Third_Neighbor_Points, Third_Origin_Points;

// for (auto kPoint : Suitable_Second_Neighbors) {
// for (auto lPoint : fine_grid->nodes->GetPoints(kPoint)) {
// /*--- Check that the third neighbor does not belong to the first neighbors or the seed ---*/

// auto end1 = First_Neighbor_Points.end();
// if (find(First_Neighbor_Points.begin(), end1, lPoint) != end1) continue;

// /*--- Check that the third neighbor does not belong to the second neighbors ---*/

// auto end2 = Suitable_Second_Neighbors.end();
// if (find(Suitable_Second_Neighbors.begin(), end2, lPoint) != end2) continue;

// Third_Neighbor_Points.push_back(lPoint);
// Third_Origin_Points.push_back(kPoint);
// }
// }












/*--- Identify those third neighbors that are repeated (candidate to be added). ---*/

// for (auto iNeighbor = 0ul; iNeighbor < Third_Neighbor_Points.size(); iNeighbor++) {
// for (auto jNeighbor = iNeighbor + 1; jNeighbor < Third_Neighbor_Points.size(); jNeighbor++) {
// /*--- Repeated third neighbor with different origin ---*/




// if ((Third_Neighbor_Points[iNeighbor] == Third_Neighbor_Points[jNeighbor]) &&
// (Third_Origin_Points[iNeighbor] != Third_Origin_Points[jNeighbor])) {
// Suitable_Indirect_Neighbors.push_back(Third_Neighbor_Points[iNeighbor]);
Copilot is powered by AI and may make mistakes. Always verify output.
Comment on lines +831 to +834
// Third_Neighbor_Points.push_back(lPoint);
// Third_Origin_Points.push_back(kPoint);
// }
// }

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.

Copilot Autofix

AI 9 days ago

The best and simplest way to address this issue without altering the program's existing behavior is to delete only the commented-out code block that corresponds to the flagged region (lines 1151–1168), as well as any directly connected blocks of commented-out code beneath it (e.g., 1172–1180). All of this is abandoned logic that a reader can recover from version control history if needed. Make sure not to remove regular comments or documentation, just the blocks of commented-out executable code.

No changes to logic, headers, or functionality are necessary—just code removal of the commented-out sections.


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
@@ -1148,36 +1148,11 @@
 
   /// TODO: This repeats the process above but I doubt it catches any more points.
 
-  // vector<unsigned long> Third_Neighbor_Points, Third_Origin_Points;
 
-  // for (auto kPoint : Suitable_Second_Neighbors) {
-  //   for (auto lPoint : fine_grid->nodes->GetPoints(kPoint)) {
-  //     /*--- Check that the third neighbor does not belong to the first neighbors or the seed ---*/
 
-  //     auto end1 = First_Neighbor_Points.end();
-  //     if (find(First_Neighbor_Points.begin(), end1, lPoint) != end1) continue;
-
-  //     /*--- Check that the third neighbor does not belong to the second neighbors ---*/
-
-  //     auto end2 = Suitable_Second_Neighbors.end();
-  //     if (find(Suitable_Second_Neighbors.begin(), end2, lPoint) != end2) continue;
-
-  //     Third_Neighbor_Points.push_back(lPoint);
-  //     Third_Origin_Points.push_back(kPoint);
-  //   }
-  // }
-
   /*--- Identify those third neighbors that are repeated (candidate to be added). ---*/
 
-  // for (auto iNeighbor = 0ul; iNeighbor < Third_Neighbor_Points.size(); iNeighbor++) {
-  //   for (auto jNeighbor = iNeighbor + 1; jNeighbor < Third_Neighbor_Points.size(); jNeighbor++) {
-  //     /*--- Repeated third neighbor with different origin ---*/
 
-  //     if ((Third_Neighbor_Points[iNeighbor] == Third_Neighbor_Points[jNeighbor]) &&
-  //         (Third_Origin_Points[iNeighbor] != Third_Origin_Points[jNeighbor])) {
-  //       Suitable_Indirect_Neighbors.push_back(Third_Neighbor_Points[iNeighbor]);
-  //     }
-  //   }
   // }
 
   /*--- Remove duplicates from the final list of Suitable Indirect Neighbors. ---*/
EOF
@@ -1148,36 +1148,11 @@

/// TODO: This repeats the process above but I doubt it catches any more points.

// vector<unsigned long> Third_Neighbor_Points, Third_Origin_Points;

// for (auto kPoint : Suitable_Second_Neighbors) {
// for (auto lPoint : fine_grid->nodes->GetPoints(kPoint)) {
// /*--- Check that the third neighbor does not belong to the first neighbors or the seed ---*/

// auto end1 = First_Neighbor_Points.end();
// if (find(First_Neighbor_Points.begin(), end1, lPoint) != end1) continue;

// /*--- Check that the third neighbor does not belong to the second neighbors ---*/

// auto end2 = Suitable_Second_Neighbors.end();
// if (find(Suitable_Second_Neighbors.begin(), end2, lPoint) != end2) continue;

// Third_Neighbor_Points.push_back(lPoint);
// Third_Origin_Points.push_back(kPoint);
// }
// }

/*--- Identify those third neighbors that are repeated (candidate to be added). ---*/

// for (auto iNeighbor = 0ul; iNeighbor < Third_Neighbor_Points.size(); iNeighbor++) {
// for (auto jNeighbor = iNeighbor + 1; jNeighbor < Third_Neighbor_Points.size(); jNeighbor++) {
// /*--- Repeated third neighbor with different origin ---*/

// if ((Third_Neighbor_Points[iNeighbor] == Third_Neighbor_Points[jNeighbor]) &&
// (Third_Origin_Points[iNeighbor] != Third_Origin_Points[jNeighbor])) {
// Suitable_Indirect_Neighbors.push_back(Third_Neighbor_Points[iNeighbor]);
// }
// }
// }

/*--- Remove duplicates from the final list of Suitable Indirect Neighbors. ---*/
Copilot is powered by AI and may make mistakes. Always verify output.
Comment on lines +838 to +840
// for (auto iNeighbor = 0ul; iNeighbor < Third_Neighbor_Points.size(); iNeighbor++) {
// for (auto jNeighbor = iNeighbor + 1; jNeighbor < Third_Neighbor_Points.size(); jNeighbor++) {
// /*--- Repeated third neighbor with different origin ---*/

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.

Copilot Autofix

AI 9 days ago

The best way to fix this problem is to remove the block of commented-out code if it is not serving a necessary documentation or illustrative purpose, and is not referenced or required by any surrounding comments. Since the lines in question are straightforward code and not explanatory pseudocode, and the function likely continues appropriately without them, the safe route is to delete the commented-out loop and the associated block. This means lines 1172-1181 (the for-loops for identifying and pushing repeated third neighbors as suitable indirect neighbors) should be cleanly removed.

No additional imports, method definitions, or variable declarations are needed to support this change.

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
@@ -1169,17 +1169,7 @@
 
   /*--- Identify those third neighbors that are repeated (candidate to be added). ---*/
 
-  // for (auto iNeighbor = 0ul; iNeighbor < Third_Neighbor_Points.size(); iNeighbor++) {
-  //   for (auto jNeighbor = iNeighbor + 1; jNeighbor < Third_Neighbor_Points.size(); jNeighbor++) {
-  //     /*--- Repeated third neighbor with different origin ---*/
 
-  //     if ((Third_Neighbor_Points[iNeighbor] == Third_Neighbor_Points[jNeighbor]) &&
-  //         (Third_Origin_Points[iNeighbor] != Third_Origin_Points[jNeighbor])) {
-  //       Suitable_Indirect_Neighbors.push_back(Third_Neighbor_Points[iNeighbor]);
-  //     }
-  //   }
-  // }
-
   /*--- Remove duplicates from the final list of Suitable Indirect Neighbors. ---*/
 
   // sort(Suitable_Indirect_Neighbors.begin(), Suitable_Indirect_Neighbors.end());
EOF
@@ -1169,17 +1169,7 @@

/*--- Identify those third neighbors that are repeated (candidate to be added). ---*/

// for (auto iNeighbor = 0ul; iNeighbor < Third_Neighbor_Points.size(); iNeighbor++) {
// for (auto jNeighbor = iNeighbor + 1; jNeighbor < Third_Neighbor_Points.size(); jNeighbor++) {
// /*--- Repeated third neighbor with different origin ---*/

// if ((Third_Neighbor_Points[iNeighbor] == Third_Neighbor_Points[jNeighbor]) &&
// (Third_Origin_Points[iNeighbor] != Third_Origin_Points[jNeighbor])) {
// Suitable_Indirect_Neighbors.push_back(Third_Neighbor_Points[iNeighbor]);
// }
// }
// }

/*--- Remove duplicates from the final list of Suitable Indirect Neighbors. ---*/

// sort(Suitable_Indirect_Neighbors.begin(), Suitable_Indirect_Neighbors.end());
Copilot is powered by AI and may make mistakes. Always verify output.
Comment on lines +842 to +847
// if ((Third_Neighbor_Points[iNeighbor] == Third_Neighbor_Points[jNeighbor]) &&
// (Third_Origin_Points[iNeighbor] != Third_Origin_Points[jNeighbor])) {
// Suitable_Indirect_Neighbors.push_back(Third_Neighbor_Points[iNeighbor]);
// }
// }
// }

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.

Copilot Autofix

AI 9 days ago

To address the problem, we should remove all blocks of commented-out code, specifically lines 1157 through 1187 (all indented and commented lines) that constitute actual code instead of documentation or meaningful comments. The structural and explanatory comments around the blocks (such as "Identify those third neighbors…", "Remove duplicates…") should be preserved for clarity unless they have become detached from all context, in which case they can also be removed. This edit maintains the clarity of the function while eliminating the confusion and maintenance issues from commented-out code fragments.

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
@@ -1154,37 +1154,10 @@
   //   for (auto lPoint : fine_grid->nodes->GetPoints(kPoint)) {
   //     /*--- Check that the third neighbor does not belong to the first neighbors or the seed ---*/
 
-  //     auto end1 = First_Neighbor_Points.end();
-  //     if (find(First_Neighbor_Points.begin(), end1, lPoint) != end1) continue;
-
-  //     /*--- Check that the third neighbor does not belong to the second neighbors ---*/
-
-  //     auto end2 = Suitable_Second_Neighbors.end();
-  //     if (find(Suitable_Second_Neighbors.begin(), end2, lPoint) != end2) continue;
-
-  //     Third_Neighbor_Points.push_back(lPoint);
-  //     Third_Origin_Points.push_back(kPoint);
-  //   }
-  // }
-
   /*--- Identify those third neighbors that are repeated (candidate to be added). ---*/
 
-  // for (auto iNeighbor = 0ul; iNeighbor < Third_Neighbor_Points.size(); iNeighbor++) {
-  //   for (auto jNeighbor = iNeighbor + 1; jNeighbor < Third_Neighbor_Points.size(); jNeighbor++) {
-  //     /*--- Repeated third neighbor with different origin ---*/
-
-  //     if ((Third_Neighbor_Points[iNeighbor] == Third_Neighbor_Points[jNeighbor]) &&
-  //         (Third_Origin_Points[iNeighbor] != Third_Origin_Points[jNeighbor])) {
-  //       Suitable_Indirect_Neighbors.push_back(Third_Neighbor_Points[iNeighbor]);
-  //     }
-  //   }
-  // }
-
   /*--- Remove duplicates from the final list of Suitable Indirect Neighbors. ---*/
 
-  // sort(Suitable_Indirect_Neighbors.begin(), Suitable_Indirect_Neighbors.end());
-  // auto it2 = unique(Suitable_Indirect_Neighbors.begin(), Suitable_Indirect_Neighbors.end());
-  // Suitable_Indirect_Neighbors.resize(it2 - Suitable_Indirect_Neighbors.begin());
 }
 
 void CMultiGridGeometry::AgglomerateImplicitLines(unsigned long& Index_CoarseCV, const CGeometry* fine_grid,
EOF
@@ -1154,37 +1154,10 @@
// for (auto lPoint : fine_grid->nodes->GetPoints(kPoint)) {
// /*--- Check that the third neighbor does not belong to the first neighbors or the seed ---*/

// auto end1 = First_Neighbor_Points.end();
// if (find(First_Neighbor_Points.begin(), end1, lPoint) != end1) continue;

// /*--- Check that the third neighbor does not belong to the second neighbors ---*/

// auto end2 = Suitable_Second_Neighbors.end();
// if (find(Suitable_Second_Neighbors.begin(), end2, lPoint) != end2) continue;

// Third_Neighbor_Points.push_back(lPoint);
// Third_Origin_Points.push_back(kPoint);
// }
// }

/*--- Identify those third neighbors that are repeated (candidate to be added). ---*/

// for (auto iNeighbor = 0ul; iNeighbor < Third_Neighbor_Points.size(); iNeighbor++) {
// for (auto jNeighbor = iNeighbor + 1; jNeighbor < Third_Neighbor_Points.size(); jNeighbor++) {
// /*--- Repeated third neighbor with different origin ---*/

// if ((Third_Neighbor_Points[iNeighbor] == Third_Neighbor_Points[jNeighbor]) &&
// (Third_Origin_Points[iNeighbor] != Third_Origin_Points[jNeighbor])) {
// Suitable_Indirect_Neighbors.push_back(Third_Neighbor_Points[iNeighbor]);
// }
// }
// }

/*--- Remove duplicates from the final list of Suitable Indirect Neighbors. ---*/

// sort(Suitable_Indirect_Neighbors.begin(), Suitable_Indirect_Neighbors.end());
// auto it2 = unique(Suitable_Indirect_Neighbors.begin(), Suitable_Indirect_Neighbors.end());
// Suitable_Indirect_Neighbors.resize(it2 - Suitable_Indirect_Neighbors.begin());
}

void CMultiGridGeometry::AgglomerateImplicitLines(unsigned long& Index_CoarseCV, const CGeometry* fine_grid,
Copilot is powered by AI and may make mistakes. Always verify output.
Comment on lines +851 to +853
// sort(Suitable_Indirect_Neighbors.begin(), Suitable_Indirect_Neighbors.end());
// auto it2 = unique(Suitable_Indirect_Neighbors.begin(), Suitable_Indirect_Neighbors.end());
// Suitable_Indirect_Neighbors.resize(it2 - Suitable_Indirect_Neighbors.begin());

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.

Copilot Autofix

AI 9 days ago

The appropriate fix is to remove the commented-out code lines (1185–1187) entirely. This eliminates clutter and reduces confusion for future readers or maintainers. No code functionality is altered, as the code is currently disabled. The region to edit is as follows:

  • File: Common/src/geometry/CMultiGridGeometry.cpp
  • Lines: 1185, 1186, 1187 (the three commented-out lines)
  • Action: Delete these lines.
    No imports, definitions, or other code edits aside from removing these lines are necessary.
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
@@ -1182,9 +1182,6 @@
 
   /*--- Remove duplicates from the final list of Suitable Indirect Neighbors. ---*/
 
-  // sort(Suitable_Indirect_Neighbors.begin(), Suitable_Indirect_Neighbors.end());
-  // auto it2 = unique(Suitable_Indirect_Neighbors.begin(), Suitable_Indirect_Neighbors.end());
-  // Suitable_Indirect_Neighbors.resize(it2 - Suitable_Indirect_Neighbors.begin());
 }
 
 void CMultiGridGeometry::AgglomerateImplicitLines(unsigned long& Index_CoarseCV, const CGeometry* fine_grid,
EOF
@@ -1182,9 +1182,6 @@

/*--- Remove duplicates from the final list of Suitable Indirect Neighbors. ---*/

// sort(Suitable_Indirect_Neighbors.begin(), Suitable_Indirect_Neighbors.end());
// auto it2 = unique(Suitable_Indirect_Neighbors.begin(), Suitable_Indirect_Neighbors.end());
// Suitable_Indirect_Neighbors.resize(it2 - Suitable_Indirect_Neighbors.begin());
}

void CMultiGridGeometry::AgglomerateImplicitLines(unsigned long& Index_CoarseCV, const CGeometry* fine_grid,
Copilot is powered by AI and may make mistakes. Always verify output.

for (auto jMarker = 0u; jMarker < fine_grid->GetnMarker() && counter < 3; jMarker++) {
for (auto jMarker = 0u; jMarker < fine_grid->GetnMarker(); jMarker++) {
const string Marker_Tag = config->GetMarker_All_TagBound(iMarker); // fine_grid->GetMarker_Tag(jMarker);

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.

Copilot Autofix

AI 9 days ago

The best way to address this is to remove the commented-out code line // fine_grid->GetMarker_Tag(jMarker);. This clears up the ambiguity for future readers, removes clutter, and doesn't affect the program’s operation, as this code is already not being executed. No additional imports, definitions, or replacements are needed elsewhere, and no code needs to be reinstated.

Change needed:

  • File: Common/src/geometry/CMultiGridGeometry.cpp
  • Region: Remove line 128, leaving the surrounding comment and functionality unchanged.
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
@@ -125,7 +125,7 @@
          that are in that point ---*/
 
         for (auto jMarker = 0u; jMarker < fine_grid->GetnMarker(); jMarker++) {
-          const string Marker_Tag = config->GetMarker_All_TagBound(iMarker);  // fine_grid->GetMarker_Tag(jMarker);
+          const string Marker_Tag = config->GetMarker_All_TagBound(iMarker);
           if (fine_grid->nodes->GetVertex(iPoint, jMarker) != -1) {
             copy_marker[counter] = jMarker;
             counter++;
EOF
@@ -125,7 +125,7 @@
that are in that point ---*/

for (auto jMarker = 0u; jMarker < fine_grid->GetnMarker(); jMarker++) {
const string Marker_Tag = config->GetMarker_All_TagBound(iMarker); // fine_grid->GetMarker_Tag(jMarker);
const string Marker_Tag = config->GetMarker_All_TagBound(iMarker);
if (fine_grid->nodes->GetVertex(iPoint, jMarker) != -1) {
copy_marker[counter] = jMarker;
counter++;
Copilot is powered by AI and may make mistakes. Always verify output.

/*--- In 2D, corners are not agglomerated, but in 3D counter=2 means we are on the
edge of a 2D face. In that case, agglomerate if both nodes are the same. ---*/
// if (nDim == 2) agglomerate_seed = false;

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.

Copilot Autofix

AI 9 days ago

To fix the issue, the best approach is to simply remove the line // if (nDim == 2) agglomerate_seed = false; altogether. This is because retaining commented-out code only serves to clutter the source and reduce maintainability. Removing the line will not affect the behavior of the code, and no other modifications are necessary. This change involves deleting this single commented line from Common/src/geometry/CMultiGridGeometry.cpp at or near line 217, leaving surrounding comments and logic untouched. No imports, method definitions, or variable adjustments 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
@@ -214,7 +214,6 @@
 
           /*--- In 2D, corners are not agglomerated, but in 3D counter=2 means we are on the
                 edge of a 2D face. In that case, agglomerate if both nodes are the same. ---*/
-          // if (nDim == 2) agglomerate_seed = false;
         }
 
         /*--- If there are more than 2 markers, the aglomeration will be discarded ---*/
EOF
@@ -214,7 +214,6 @@

/*--- In 2D, corners are not agglomerated, but in 3D counter=2 means we are on the
edge of a 2D face. In that case, agglomerate if both nodes are the same. ---*/
// if (nDim == 2) agglomerate_seed = false;
}

/*--- If there are more than 2 markers, the aglomeration will be discarded ---*/
Copilot is powered by AI and may make mistakes. Always verify output.
/*--- If the seed (parent) can be agglomerated, we try to agglomerate connected childs to the parent ---*/
/*--- Note that in 2D we allow a maximum of 4 nodes to be agglomerated ---*/
if (agglomerate_seed) {
// cout << " seed can be agglomerated to more points." << endl;

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.

Copilot Autofix

AI 9 days ago

The best way to fix this problem is to remove the line of commented-out code entirely. This will declutter the codebase and prevent confusion. Since this code is commented and is non-functional, deleting it does not alter the program's behavior.

Specifically, in Common/src/geometry/CMultiGridGeometry.cpp, locate and delete the line:

// cout << "    seed can be agglomerated to more points." << endl;

No further changes or imports are necessary. No functional changes are introduced, and no other code comments or lines are affected.


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
@@ -226,7 +226,6 @@
         /*--- If the seed (parent) can be agglomerated, we try to agglomerate connected childs to the parent ---*/
         /*--- Note that in 2D we allow a maximum of 4 nodes to be agglomerated ---*/
         if (agglomerate_seed) {
-          // cout << "    seed can be agglomerated to more points." << endl;
           /*--- Now we do a sweep over all the nodes that surround the seed point ---*/
 
           for (auto CVPoint : fine_grid->nodes->GetPoints(iPoint)) {
EOF
@@ -226,7 +226,6 @@
/*--- If the seed (parent) can be agglomerated, we try to agglomerate connected childs to the parent ---*/
/*--- Note that in 2D we allow a maximum of 4 nodes to be agglomerated ---*/
if (agglomerate_seed) {
// cout << " seed can be agglomerated to more points." << endl;
/*--- Now we do a sweep over all the nodes that surround the seed point ---*/

for (auto CVPoint : fine_grid->nodes->GetPoints(iPoint)) {
Copilot is powered by AI and may make mistakes. Always verify output.

/*--- The new point can be agglomerated ---*/
if (SetBoundAgglomeration(CVPoint, marker_seed, fine_grid, config)) {
// cout << " agglomerate " << CVPoint << " with seed point "<< iPoint << endl;

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.

Copilot Autofix

AI 9 days ago

The best way to fix the problem is to remove the commented-out code entirely, as it is unnecessary and can clutter the codebase. In the provided snippet (Common/src/geometry/CMultiGridGeometry.cpp), the flagged line (243) is a commented-out debug print statement. There are other commented-out debug or print statements in this same function, such as those on lines 229, 233-239, 270-275, and 278. For completeness and clarity, all these commented-out lines should be removed, since they neither document the code nor serve a functional purpose.

The required change is a deletion of those lines. No additional imports, function definitions, or code modifications are needed.

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
@@ -226,21 +226,15 @@
         /*--- If the seed (parent) can be agglomerated, we try to agglomerate connected childs to the parent ---*/
         /*--- Note that in 2D we allow a maximum of 4 nodes to be agglomerated ---*/
         if (agglomerate_seed) {
-          // cout << "    seed can be agglomerated to more points." << endl;
+
           /*--- Now we do a sweep over all the nodes that surround the seed point ---*/
 
           for (auto CVPoint : fine_grid->nodes->GetPoints(iPoint)) {
-            // cout << "    checking child CVPoint = "
-            //      << CVPoint
-            //      << ", coord = "
-            //      << fine_grid->nodes->GetCoord(CVPoint, 0)
-            //      << " "
-            //      << fine_grid->nodes->GetCoord(CVPoint, 1)
-            //      << endl;
 
+
             /*--- The new point can be agglomerated ---*/
             if (SetBoundAgglomeration(CVPoint, marker_seed, fine_grid, config)) {
-              // cout << "    agglomerate " << CVPoint << " with seed point "<< iPoint << endl;
+
               /*--- We set the value of the parent ---*/
 
               fine_grid->nodes->SetParent_CV(CVPoint, Index_CoarseCV);
@@ -267,15 +255,10 @@
 
             /*--- Now we do a sweep over all the indirect nodes that can be added ---*/
             for (auto CVPoint : Suitable_Indirect_Neighbors) {
-              // cout << "         Boundary: checking indirect neighbors " << CVPoint
-              // << ", coord = "
-              //     << fine_grid->nodes->GetCoord(CVPoint, 0)
-              //     << " "
-              //     << fine_grid->nodes->GetCoord(CVPoint, 1)
-              // << endl;
+
               /*--- The new point can be agglomerated ---*/
               if (SetBoundAgglomeration(CVPoint, marker_seed, fine_grid, config)) {
-                // cout << "         Boundary: indirect neighbor " << CVPoint << " can be agglomerated." << endl;
+
                 /*--- We set the value of the parent ---*/
                 fine_grid->nodes->SetParent_CV(CVPoint, Index_CoarseCV);
 
EOF
@@ -226,21 +226,15 @@
/*--- If the seed (parent) can be agglomerated, we try to agglomerate connected childs to the parent ---*/
/*--- Note that in 2D we allow a maximum of 4 nodes to be agglomerated ---*/
if (agglomerate_seed) {
// cout << " seed can be agglomerated to more points." << endl;

/*--- Now we do a sweep over all the nodes that surround the seed point ---*/

for (auto CVPoint : fine_grid->nodes->GetPoints(iPoint)) {
// cout << " checking child CVPoint = "
// << CVPoint
// << ", coord = "
// << fine_grid->nodes->GetCoord(CVPoint, 0)
// << " "
// << fine_grid->nodes->GetCoord(CVPoint, 1)
// << endl;


/*--- The new point can be agglomerated ---*/
if (SetBoundAgglomeration(CVPoint, marker_seed, fine_grid, config)) {
// cout << " agglomerate " << CVPoint << " with seed point "<< iPoint << endl;

/*--- We set the value of the parent ---*/

fine_grid->nodes->SetParent_CV(CVPoint, Index_CoarseCV);
@@ -267,15 +255,10 @@

/*--- Now we do a sweep over all the indirect nodes that can be added ---*/
for (auto CVPoint : Suitable_Indirect_Neighbors) {
// cout << " Boundary: checking indirect neighbors " << CVPoint
// << ", coord = "
// << fine_grid->nodes->GetCoord(CVPoint, 0)
// << " "
// << fine_grid->nodes->GetCoord(CVPoint, 1)
// << endl;

/*--- The new point can be agglomerated ---*/
if (SetBoundAgglomeration(CVPoint, marker_seed, fine_grid, config)) {
// cout << " Boundary: indirect neighbor " << CVPoint << " can be agglomerated." << endl;

/*--- We set the value of the parent ---*/
fine_grid->nodes->SetParent_CV(CVPoint, Index_CoarseCV);

Copilot is powered by AI and may make mistakes. Always verify output.
// << endl;
/*--- The new point can be agglomerated ---*/
if (SetBoundAgglomeration(CVPoint, marker_seed, fine_grid, config)) {
// cout << " Boundary: indirect neighbor " << CVPoint << " can be agglomerated." << endl;

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.

Copilot Autofix

AI 9 days ago

The optimal fix is to remove the commented-out cout line entirely, as it's neither documentation nor active code and is not needed for functionality. Keeping such commented-out debugging code only clutters the source file. If debug output is still occasionally required, a proper debug/logging macro should be used which can be enabled or disabled at compile time, not with block comments. Edit the region in file Common/src/geometry/CMultiGridGeometry.cpp to simply remove line 278, leaving the rest of the code unchanged.


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
@@ -275,7 +275,7 @@
               // << endl;
               /*--- The new point can be agglomerated ---*/
               if (SetBoundAgglomeration(CVPoint, marker_seed, fine_grid, config)) {
-                // cout << "         Boundary: indirect neighbor " << CVPoint << " can be agglomerated." << endl;
+
                 /*--- We set the value of the parent ---*/
                 fine_grid->nodes->SetParent_CV(CVPoint, Index_CoarseCV);
 
EOF
@@ -275,7 +275,7 @@
// << endl;
/*--- The new point can be agglomerated ---*/
if (SetBoundAgglomeration(CVPoint, marker_seed, fine_grid, config)) {
// cout << " Boundary: indirect neighbor " << CVPoint << " can be agglomerated." << endl;

/*--- We set the value of the parent ---*/
fine_grid->nodes->SetParent_CV(CVPoint, Index_CoarseCV);

Copilot is powered by AI and may make mistakes. Always verify output.
/*--- Compute Forcing Term $P_(k+1) = I^(k+1)_k(P_k+F_k(u_k))-F_(k+1)(I^(k+1)_k u_k)$ and update solution for multigrid ---*/

if ( iMesh < config->GetnMGLevels() ) {
//cout << "imesh =" << iMesh << " " << config->GetnMGLevels() << endl;

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.

Copilot Autofix

AI 12 days ago

The best way to fix the problem is to remove the line containing the commented-out code entirely. Specifically, line 182 in SU2_CFD/src/integration/CMultiGridIntegration.cpp, which reads:

//cout << "imesh =" << iMesh << " " << config->GetnMGLevels() << endl;

should be deleted. This will remove the distraction and potential confusion caused by inactive code left in comments, without affecting any functionality of the actual code.

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
@@ -179,7 +179,6 @@
   /*--- Compute Forcing Term $P_(k+1) = I^(k+1)_k(P_k+F_k(u_k))-F_(k+1)(I^(k+1)_k u_k)$ and update solution for multigrid ---*/
 
   if ( iMesh < config->GetnMGLevels() ) {
-    //cout << "imesh =" << iMesh << " " << config->GetnMGLevels() << endl;
 
     /*--- Shorter names to refer to coarse grid entities. ---*/
 
EOF
@@ -179,7 +179,6 @@
/*--- Compute Forcing Term $P_(k+1) = I^(k+1)_k(P_k+F_k(u_k))-F_(k+1)(I^(k+1)_k u_k)$ and update solution for multigrid ---*/

if ( iMesh < config->GetnMGLevels() ) {
//cout << "imesh =" << iMesh << " " << config->GetnMGLevels() << endl;

/*--- Shorter names to refer to coarse grid entities. ---*/

Copilot is powered by AI and may make mistakes. Always verify output.
static su2double Damp_Restric_Adapt(const unsigned short *lastPreSmoothIters,
unsigned short lastPreSmoothCount,
CConfig *config) {
//cout << "starting Damp_Restric_Adapt" << endl;

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.

Copilot Autofix

AI 12 days ago

To fix the problem, the line containing the commented-out cout statement should be removed entirely. This involves deleting line 694 (//cout << "starting Damp_Restric_Adapt" << endl;). This is the only required change; no additional code, imports, or functionality needs to be added or modified, as the removal will not affect the logic or function of the surrounding code.

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
@@ -691,7 +691,6 @@
 static su2double Damp_Restric_Adapt(const unsigned short *lastPreSmoothIters,
                                    unsigned short lastPreSmoothCount,
                                    CConfig *config) {
-  //cout << "starting Damp_Restric_Adapt" << endl;
   if (config == nullptr) return 0.0;
 
   const unsigned short nMGLevels = config->GetnMGLevels();
EOF
@@ -691,7 +691,6 @@
static su2double Damp_Restric_Adapt(const unsigned short *lastPreSmoothIters,
unsigned short lastPreSmoothCount,
CConfig *config) {
//cout << "starting Damp_Restric_Adapt" << endl;
if (config == nullptr) return 0.0;

const unsigned short nMGLevels = config->GetnMGLevels();
Copilot is powered by AI and may make mistakes. Always verify output.


const su2double current = config->GetDamp_Res_Restric();
//cout << "Current Damp_Res_Restric: " << current << endl;

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.

Copilot Autofix

AI 12 days ago

To fix this problem, simply remove the line //cout << "Current Damp_Res_Restric: " << current << endl; entirely from the file SU2_CFD/src/integration/CMultiGridIntegration.cpp. Do not replace it with anything else unless a meaningful comment is truly needed (which is not the case here). This will clean the code and eliminate unnecessary clutter without affecting any existing functionality, as the line is currently commented-out and has no effect at runtime.

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
@@ -745,7 +745,6 @@
 
 
   const su2double current = config->GetDamp_Res_Restric();
-  //cout << "Current Damp_Res_Restric: " << current << endl;
   su2double new_factor = current;
 
   const su2double scale_down = 0.99;
EOF
@@ -745,7 +745,6 @@


const su2double current = config->GetDamp_Res_Restric();
//cout << "Current Damp_Res_Restric: " << current << endl;
su2double new_factor = current;

const su2double scale_down = 0.99;
Copilot is powered by AI and may make mistakes. Always verify output.
// already made through global MPI reductions, so calling the setter on all
// ranks yields the same value everywhere.
config->SetDamp_Res_Restric(new_factor);
//cout << "ending Damp_Restric_Adapt, damping = " <<config->GetDamp_Res_Restric() << endl;

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.

Copilot Autofix

AI 12 days ago

To fix the problem, we should simply remove the line of commented-out code. This will clean up the code without impacting any functionality, as the code in question is not executed and is redundant due to the presence of proper logging in the preceding code block. Only the single line on or near line 778 (//cout << "ending Damp_Restric_Adapt, damping = " <<config->GetDamp_Res_Restric() << endl;) should be removed, leaving the rest of the code unchanged.


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
@@ -775,7 +775,6 @@
   // already made through global MPI reductions, so calling the setter on all
   // ranks yields the same value everywhere.
   config->SetDamp_Res_Restric(new_factor);
-  //cout << "ending Damp_Restric_Adapt, damping = " <<config->GetDamp_Res_Restric()  << endl;
   return new_factor;
 }
 
EOF
@@ -775,7 +775,6 @@
// already made through global MPI reductions, so calling the setter on all
// ranks yields the same value everywhere.
config->SetDamp_Res_Restric(new_factor);
//cout << "ending Damp_Restric_Adapt, damping = " <<config->GetDamp_Res_Restric() << endl;
return new_factor;
}

Copilot is powered by AI and may make mistakes. Always verify output.
Comment on lines 608 to 617
/*--- First pass: Determine which parents will actually be used (have non-skipped children).
This prevents creating orphaned halo CVs that have coordinates (0,0,0). ---*/
vector<bool> parent_used(Aux_Parent.size(), false);
vector<unsigned long> parent_local_index(Aux_Parent.size(), ULONG_MAX);

for (auto iVertex = 0ul; iVertex < nVertexR; iVertex++) {
/*--- We use the same sorting as in the donor domain, i.e. the local parents
are numbered according to their order in the remote rank. ---*/
const auto iPoint_Fine = fine_grid->vertex[MarkerR][iVertex]->GetNode();
auto existing_parent = fine_grid->nodes->GetParent_CV(iPoint_Fine);

/*--- Skip if already agglomerated (first-wins policy) ---*/
if (existing_parent != ULONG_MAX) continue;

/*--- Find which parent this vertex maps to ---*/
for (auto jVertex = 0ul; jVertex < Aux_Parent.size(); jVertex++) {
if (Parent_Remote[iVertex] == Aux_Parent[jVertex]) {

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.

Copilot Autofix

AI 9 days ago

To fix the problem, the commented-out block of code from line 976 to 990 should be completely removed. This deletion will not affect the current functionality since the code is not compiled or executed (it's within a comment block), and the only effect will be to reduce clutter and potential confusion for future maintainers. No further code, imports, or definitions are necessary elsewhere, and no changes to functionality will occur by removing this block.

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
@@ -973,22 +973,8 @@
 
   bool Stretching = true;
 
-  /* unsigned short iNode, iDim;
-   unsigned long jPoint;
-   su2double *Coord_i = fine_grid->nodes->GetCoord(iPoint);
-   su2double max_dist = 0.0 ; su2double min_dist = 1E20;
-   for (iNode = 0; iNode < fine_grid->nodes->GetnPoint(iPoint); iNode ++) {
-   jPoint = fine_grid->nodes->GetPoint(iPoint, iNode);
-   su2double *Coord_j = fine_grid->nodes->GetCoord(jPoint);
-   su2double distance = 0.0;
-   for (iDim = 0; iDim < nDim; iDim++)
-   distance += (Coord_j[iDim]-Coord_i[iDim])*(Coord_j[iDim]-Coord_i[iDim]);
-   distance = sqrt(distance);
-   max_dist = max(distance, max_dist);
-   min_dist = min(distance, min_dist);
-   }
-   if ( max_dist/min_dist > 100.0 ) Stretching = false;*/
 
+
   return (Stretching && Volume);
 }
 
EOF
@@ -973,22 +973,8 @@

bool Stretching = true;

/* unsigned short iNode, iDim;
unsigned long jPoint;
su2double *Coord_i = fine_grid->nodes->GetCoord(iPoint);
su2double max_dist = 0.0 ; su2double min_dist = 1E20;
for (iNode = 0; iNode < fine_grid->nodes->GetnPoint(iPoint); iNode ++) {
jPoint = fine_grid->nodes->GetPoint(iPoint, iNode);
su2double *Coord_j = fine_grid->nodes->GetCoord(jPoint);
su2double distance = 0.0;
for (iDim = 0; iDim < nDim; iDim++)
distance += (Coord_j[iDim]-Coord_i[iDim])*(Coord_j[iDim]-Coord_i[iDim]);
distance = sqrt(distance);
max_dist = max(distance, max_dist);
min_dist = min(distance, min_dist);
}
if ( max_dist/min_dist > 100.0 ) Stretching = false;*/


return (Stretching && Volume);
}

Copilot is powered by AI and may make mistakes. Always verify output.
/*--- Only increment by the number of parents that will actually be used ---*/
Index_CoarseCV += nUsedParents;

vector<unsigned short> nChildren_MPI(Index_CoarseCV, 0);

Check notice

Code scanning / CodeQL

Unused local variable Note

Variable Index_CoarseCV_Before is not used.

Copilot Autofix

AI 9 days ago

To fix this unused variable, simply remove the declaration and initialization of Index_CoarseCV_Before on line 668 from the file Common/src/geometry/CMultiGridGeometry.cpp. No other code depends on this variable, and its removal does not affect any program logic or debugging behavior. No changes to methods, other imports, or additional code are needed.

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
@@ -665,7 +665,6 @@
       }
 
       /*--- Debug: Track state before updating Index_CoarseCV ---*/
-      auto Index_CoarseCV_Before = Index_CoarseCV;
 
       /*--- Only increment by the number of parents that will actually be used ---*/
       Index_CoarseCV += nUsedParents;
EOF
@@ -665,7 +665,6 @@
}

/*--- Debug: Track state before updating Index_CoarseCV ---*/
auto Index_CoarseCV_Before = Index_CoarseCV;

/*--- Only increment by the number of parents that will actually be used ---*/
Index_CoarseCV += nUsedParents;
Copilot is powered by AI and may make mistakes. Always verify output.
exponential progression with under-relaxation approach. */

const CFLAdaptParams params = InitializeCFLAdaptParams(config);
//const bool fullComms = (config->GetComm_Level() == COMM_FULL);

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.

Copilot Autofix

AI 9 days ago

The best way to fix this issue is to either remove the commented-out code or to reinstate it if it's still required. Since there is no additional context indicating that this variable is still necessary and its removal does not change existing functionality (as it is inactive), the simplest and recommended action is to delete this line entirely from SU2_CFD/src/solvers/CSolver.cpp, line 2478. No changes to logic or dependencies are needed.


Suggested changeset 1
SU2_CFD/src/solvers/CSolver.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/solvers/CSolver.cpp b/SU2_CFD/src/solvers/CSolver.cpp
--- a/SU2_CFD/src/solvers/CSolver.cpp
+++ b/SU2_CFD/src/solvers/CSolver.cpp
@@ -2475,7 +2475,6 @@
    exponential progression with under-relaxation approach. */
 
   const CFLAdaptParams params = InitializeCFLAdaptParams(config);
-  //const bool fullComms = (config->GetComm_Level() == COMM_FULL);
 
   bool reduceCFL = false;
   bool resetCFL = false;
EOF
@@ -2475,7 +2475,6 @@
exponential progression with under-relaxation approach. */

const CFLAdaptParams params = InitializeCFLAdaptParams(config);
//const bool fullComms = (config->GetComm_Level() == COMM_FULL);

bool reduceCFL = false;
bool resetCFL = false;
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.

3 participants