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 25 days 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.

iRKLimit = 1;
break;
}
//return nRKStep;

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, simply remove the line containing the commented-out code //return nRKStep; in the GetnRKStep method. No reinstatement is necessary, as returning iRKLimit is the intended behavior according to the surrounding logic and comment documentation. No further changes to code functionality or documentation are needed, as this line does not provide meaningful information in comment form.

Edits are required within Common/include/CConfig.hpp, specifically on line 3061, where the commented-out line should be deleted.


Suggested changeset 1
Common/include/CConfig.hpp

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/include/CConfig.hpp b/Common/include/CConfig.hpp
--- a/Common/include/CConfig.hpp
+++ b/Common/include/CConfig.hpp
@@ -3058,7 +3058,6 @@
         iRKLimit = 1;
         break;
     }
-  //return nRKStep;
   return iRKLimit;
 }
 
EOF
@@ -3058,7 +3058,6 @@
iRKLimit = 1;
break;
}
//return nRKStep;
return iRKLimit;
}

Copilot is powered by AI and may make mistakes. Always verify output.
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 2 days ago

To fix the issue, we should either remove the commented-out code or reinstate it if it's supposed to be active. Given the context (it is a block of commented code with TODO indicating doubt on its necessity, and the main code seems to work without it), the best fix is to remove these commented-out lines, as reinstating could re-enable possibly broken or unnecessary code. This edit should affect only lines 922–939 and 943–945 in Common/src/geometry/CMultiGridGeometry.cpp, which consist of commented-out code relating to "third neighbors". The surrounding headers, comments, and actual code should not be altered. No new imports, definitions, or methods 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
@@ -919,31 +919,12 @@
 
   /// 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]);
EOF
@@ -919,31 +919,12 @@

/// 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]);
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 2 days ago

The best way to fix the problem is to remove the commented-out algorithmic code (lines 922–939) in the file Common/src/geometry/CMultiGridGeometry.cpp. This code is clearly legacy or discarded logic, bracketed with a TODO indicating doubt in its utility. Completely removing this block will improve readability and maintainability, ensuring the only active code is compiled and maintained.

The specific lines to delete are 922–939 (inclusive). There is no need to substitute this with additional documentation or formatting, nor are supporting imports or definitions required for the fix.

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
@@ -919,25 +919,8 @@
 
   /// 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++) {
EOF
@@ -919,25 +919,8 @@

/// 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++) {
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 2 days ago

To resolve the issue, the best approach is to remove the commented-out block of code starting at line 943 and running through line 952 in Common/src/geometry/CMultiGridGeometry.cpp, as well as any related code that is clearly commented out and not serving documentation purposes. If the functionality is still needed, it should be properly reinstated as live code; otherwise, eliminate the dead code to reduce clutter and potential confusion. No changes to functionality will occur if the block stays commented out, so removal is safe unless evidence suggests it should be active.

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
@@ -940,16 +940,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. ---*/
 
EOF
@@ -940,16 +940,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. ---*/

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 2 days ago

To fix the problem, the commented-out code block should be removed, as it is not currently serving any useful purpose (it is not documentation or example code). This means deleting all lines in the contiguous block of commented-out code, specifically lines 928–959, where code is commented out but otherwise matches active code style and structure.

No additional imports, methods, or definitions are necessary; just delete the commented-out code. Be careful not to remove real comments or documentation, but all evidence suggests these lines are disabled code.

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
@@ -925,37 +925,37 @@
   //   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
@@ -925,37 +925,37 @@
// 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 2 days ago

The best way to fix this problem is to remove the commented-out code at lines 956-958, since the deduplication logic is not active and its purpose is unclear. Removing these lines will clean up the surrounding code and avoid distraction/confusion for future maintainers. No other code or functionality should be modified; this fix only involves deleting lines 956-958.

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
@@ -953,9 +953,7 @@
 
   /*--- 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
@@ -953,9 +953,7 @@

/*--- 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 +63 to +64
unsigned short iLimit = config[iZone]->GetnRKStep();

Copy link
Contributor Author

Choose a reason for hiding this comment

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

all that stuff was not used.

Copy link
Contributor

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

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

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

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