Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
23ac38b
initial commit
bigfooted Nov 8, 2024
a47c0f4
fix vector
bigfooted Nov 8, 2024
f846cbb
update agglomeration
bigfooted Nov 15, 2024
f2fb97e
Merge branch 'develop' into fix_multigrid_agglomeration
bigfooted Nov 18, 2024
70a0638
Merge branch 'develop' into fix_multigrid_agglomeration
bigfooted Dec 22, 2024
711ba29
Merge branch 'develop' into fix_multigrid_agglomeration
bigfooted Jan 2, 2025
1953dfc
Merge branch 'develop' into fix_multigrid_agglomeration
bigfooted Jan 17, 2025
19f6e79
Merge branch 'develop' into fix_multigrid_agglomeration
bigfooted Jan 23, 2025
6d23aae
Merge branch 'develop' into fix_multigrid_agglomeration
bigfooted Feb 3, 2025
ee86d12
Merge branch 'develop' into fix_multigrid_agglomeration
bigfooted Mar 9, 2025
8e14cf5
Merge branch 'develop' into fix_multigrid_agglomeration
bigfooted Aug 23, 2025
320eb82
Merge branch 'fix_multigrid_agglomeration' of https://github.com/su2c…
bigfooted Oct 11, 2025
ca7edea
Merge branch 'develop' into fix_multigrid_agglomeration
bigfooted Oct 11, 2025
6fbef92
testing agglomeration
bigfooted Oct 30, 2025
d55bd72
update 3D agglomeration
bigfooted Nov 15, 2025
c364dc4
update 3D agglomeration
bigfooted Nov 15, 2025
768aa92
update 3D agglomeration
bigfooted Nov 15, 2025
35dbdae
update opdi
bigfooted Nov 15, 2025
767bd2a
update with commented cout
bigfooted Nov 15, 2025
9e6e791
update agglomeration, aggressive settings
bigfooted Nov 16, 2025
6d42a49
add EULER_WALLS by checking straightness
bigfooted Nov 17, 2025
4495da6
remove some commented cout statements
bigfooted Nov 17, 2025
c38a633
remove some commented cout statements
bigfooted Nov 19, 2025
d355978
add convergence check and early exit for pre,post and correction smoo…
bigfooted Nov 19, 2025
9642b94
implicit lines
bigfooted Nov 23, 2025
cbaa3f7
implicit lines info
bigfooted Nov 24, 2025
3c4f8ab
Merge branch 'develop' into fix_multigrid_agglomeration
bigfooted Nov 24, 2025
d28ce20
adaptive damping factor for pre-smoothing
bigfooted Nov 26, 2025
9f19341
fix cross-lines in implicit line agglomeration
bigfooted Nov 27, 2025
691a73c
Reduce MGLEVELS based on mesh size
bigfooted Nov 27, 2025
85456c8
change default nr of implicit lines
bigfooted Nov 28, 2025
99d6712
adaptive CFL on multigrid
bigfooted Nov 28, 2025
2c40c9c
run precommit
bigfooted Nov 28, 2025
944a2fc
fix gauss elimination NaN
bigfooted Dec 6, 2025
fb8e4ee
fix euler wall agglomeration
bigfooted Dec 6, 2025
b91a992
precommit
bigfooted Dec 6, 2025
6332e28
CFL adapt oscillation detection
bigfooted Dec 7, 2025
7b53432
simpler CFL adapt oscillation detection
bigfooted Dec 7, 2025
2013392
asdd XOR flipflop again
bigfooted Dec 7, 2025
6cfdbf0
modify cfl on coarser meshes
bigfooted Dec 7, 2025
4cd4784
introduce LSQ slope computation
bigfooted Dec 8, 2025
0699ce4
add explanation
bigfooted Dec 8, 2025
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
10 changes: 5 additions & 5 deletions Common/include/geometry/CMultiGridGeometry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,33 +31,33 @@

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

Choose a reason for hiding this comment

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

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

const CConfig* config) const;

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

/*!
* \brief Determine if a CVPoint van be agglomerated, if it have the same marker point as the seed.
* \brief Determine if a CVPoint can be agglomerated, if it has the same marker point as the seed.
* \param[out] Suitable_Indirect_Neighbors - List of Indirect Neighbours that can be agglomerated.
* \param[in] iPoint - Seed point.
* \param[in] Index_CoarseCV - Index of agglomerated point.
Expand Down
2 changes: 1 addition & 1 deletion Common/include/geometry/CMultiGridQueue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class CMultiGridQueue {
void IncrPriorityCV(unsigned long incrPoint);

/*!
* \brief Increase the priority of the CV.
* \brief Reduce the priority of the CV.
* \param[in] redPoint - Index of the control volume.
*/
void RedPriorityCV(unsigned long redPoint);
Expand Down
108 changes: 63 additions & 45 deletions Common/src/geometry/CMultiGridGeometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
/*--- Create a queue system to do the agglomeration
1st) More than two markers ---> Vertices (never agglomerate)
2nd) Two markers ---> Edges (agglomerate if same BC, never agglomerate if different BC)
3rd) One marker ---> Surface (always agglomarate)
4th) No marker ---> Internal Volume (always agglomarate) ---*/
3rd) One marker ---> Surface (always agglomerate)
4th) No marker ---> Internal Volume (always agglomerate) ---*/

/*--- Set a marker to indicate indirect agglomeration, for quads and hexs,
i.e. consider up to neighbors of neighbors of neighbors.
Expand Down Expand Up @@ -76,6 +76,7 @@
/*--- If the element has not been previously agglomerated and it
belongs to this physical domain, and it meets the geometrical
criteria, the agglomeration is studied. ---*/
vector<short> marker_seed;

if ((!fine_grid->nodes->GetAgglomerate(iPoint)) && (fine_grid->nodes->GetDomain(iPoint)) &&
(GeometricalCheck(iPoint, fine_grid, config))) {
Expand All @@ -92,7 +93,7 @@
bool agglomerate_seed = true;
auto counter = 0;
unsigned short copy_marker[3] = {};
const auto marker_seed = iMarker;
marker_seed.push_back(iMarker);

/*--- For a particular point in the fine grid we save all the markers
that are in that point ---*/
Expand All @@ -101,34 +102,42 @@
if (fine_grid->nodes->GetVertex(iPoint, jMarker) != -1) {
copy_marker[counter] = jMarker;
counter++;

if (jMarker != iMarker) {
marker_seed.push_back(jMarker);
}
}
}

/*--- To aglomerate a vertex it must have only one physical bc!!
/*--- To agglomerate a vertex it must have only one physical bc!!
This can be improved. If there is only a marker, it is a good
candidate for agglomeration ---*/

/*--- Valley -> Valley : conditionally allowed when both points are on the same marker. ---*/
/*--- ! Note that in the case of MPI SEND_RECEIVE markers, we might need other conditions ---*/
if (counter == 1) {
agglomerate_seed = true;

/*--- Euler walls can be curved and agglomerating them leads to difficulties ---*/
if (config->GetMarker_All_KindBC(marker_seed) == EULER_WALL) agglomerate_seed = false;
//if (config->GetMarker_All_KindBC(marker_seed[0]) == EULER_WALL)
// agglomerate_seed = false;
}

/*--- If there are two markers, we will agglomerate if any of the
markers is SEND_RECEIVE ---*/

if (counter == 2) {
agglomerate_seed = (config->GetMarker_All_KindBC(copy_marker[0]) == SEND_RECEIVE) ||
(config->GetMarker_All_KindBC(copy_marker[1]) == SEND_RECEIVE);
//agglomerate_seed = (config->GetMarker_All_KindBC(copy_marker[0]) == SEND_RECEIVE) ||
// (config->GetMarker_All_KindBC(copy_marker[1]) == SEND_RECEIVE);

/* --- Euler walls can also not be agglomerated when the point has 2 markers ---*/
if ((config->GetMarker_All_KindBC(copy_marker[0]) == EULER_WALL) ||
(config->GetMarker_All_KindBC(copy_marker[1]) == EULER_WALL)) {
agglomerate_seed = false;
}
//if ((config->GetMarker_All_KindBC(copy_marker[0]) == EULER_WALL) ||
// (config->GetMarker_All_KindBC(copy_marker[1]) == EULER_WALL)) {
agglomerate_seed = true;
//}
}

/*--- If there are more than 2 markers, the aglomeration will be discarded ---*/
/*--- If there are more than 2 markers, the agglomeration will be discarded ---*/

if (counter > 2) agglomerate_seed = false;

Expand Down Expand Up @@ -473,15 +482,18 @@
SetGlobal_nPointDomain(Global_nPointCoarse);

if (iMesh != MESH_0) {
const su2double factor = 1.5;
//const su2double factor = 1.5; //nijso: too high
const su2double factor = 1.0;
const su2double Coeff = pow(su2double(Global_nPointFine) / Global_nPointCoarse, 1.0 / nDim);
const su2double CFL = factor * config->GetCFL(iMesh - 1) / Coeff;
config->SetCFL(iMesh, CFL);
}

const su2double ratio = su2double(Global_nPointFine) / su2double(Global_nPointCoarse);

if (((nDim == 2) && (ratio < 2.5)) || ((nDim == 3) && (ratio < 2.5))) {
//if (((nDim == 2) && (ratio < 2.5)) || ((nDim == 3) && (ratio < 2.5))) {
// nijso: too high for very small test meshes.
if (((nDim == 2) && (ratio < 2.0)) || ((nDim == 3) && (ratio < 2.0))) {
config->SetMGLevels(iMesh - 1);
} else if (rank == MASTER_NODE) {
PrintingToolbox::CTablePrinter MGTable(&std::cout);
Expand All @@ -506,7 +518,7 @@
edgeColorGroupSize = config->GetEdgeColoringGroupSize();
}

bool CMultiGridGeometry::SetBoundAgglomeration(unsigned long CVPoint, short marker_seed, const CGeometry* fine_grid,
bool CMultiGridGeometry::SetBoundAgglomeration(unsigned long CVPoint, vector<short> marker_seed, const CGeometry* fine_grid,
const CConfig* config) const {
bool agglomerate_CV = false;

Expand All @@ -530,55 +542,61 @@
}
}

/*--- The basic condition is that the aglomerated vertex must have the same physical marker,
/*--- The basic condition is that the agglomerated vertex must have the same physical marker,
but eventually a send-receive condition ---*/

/*--- Only one marker in the vertex that is going to be aglomerated ---*/
/*--- Only one marker in the vertex that is going to be agglomerated ---*/

/*--- Valley -> Valley: only if of the same type---*/
if (counter == 1) {
/*--- We agglomerate if there is only one marker and it is the same marker as the seed marker ---*/
// note that this should be the same marker id, not just the same marker type
if (copy_marker[0] == marker_seed) agglomerate_CV = true;
if ((marker_seed.size()==1) && (copy_marker[0] == marker_seed[0])) agglomerate_CV = true;

/*--- If there is only one marker, but the marker is the SEND_RECEIVE ---*/

if (config->GetMarker_All_KindBC(copy_marker[0]) == SEND_RECEIVE) {
agglomerate_CV = true;
}
//if (config->GetMarker_All_KindBC(copy_marker[0]) == SEND_RECEIVE) {
// agglomerate_CV = true;
//}

if ((config->GetMarker_All_KindBC(marker_seed) == SYMMETRY_PLANE) ||
(config->GetMarker_All_KindBC(marker_seed) == EULER_WALL)) {
if (config->GetMarker_All_KindBC(copy_marker[0]) == SEND_RECEIVE) {
agglomerate_CV = false;
}
}
//if ((config->GetMarker_All_KindBC(marker_seed[0]) == SYMMETRY_PLANE) ||
// (config->GetMarker_All_KindBC(marker_seed[0]) == EULER_WALL)) {
// if (config->GetMarker_All_KindBC(copy_marker[0]) == SEND_RECEIVE) {
// agglomerate_CV = false;
// }
//}
}

/*--- If there are two markers in the vertex that is going to be aglomerated ---*/

/*--- If there are two markers in the vertex that is going to be agglomerated ---*/
/*--- Ridge -> Ridge: only if of the same type (same marker ID) ---*/
if (counter == 2) {

// check if the seed also has 2 markers
if (marker_seed.size() == 2) {
// now check if the seed is on the same 2 marker ID's (note that if we allow that they are of the same
// marker type, we need to check that the alignement of the markers is correct as well. better not go there.)
if ( ((marker_seed[0] = copy_marker[0]) && (marker_seed[1] = copy_marker[1])) ||
((marker_seed[0] = copy_marker[1]) && (marker_seed[1] = copy_marker[0])) ) {
agglomerate_CV = true;
}
}
/*--- First we verify that the seed is a physical boundary ---*/

if (config->GetMarker_All_KindBC(marker_seed) != SEND_RECEIVE) {
/*--- Then we check that one of the markers is equal to the seed marker, and the other is send/receive ---*/
// if (config->GetMarker_All_KindBC(marker_seed[0]) != SEND_RECEIVE) {
// /*--- Then we check that one of the markers is equal to the seed marker, and the other is send/receive ---*/

if (((copy_marker[0] == marker_seed) && (config->GetMarker_All_KindBC(copy_marker[1]) == SEND_RECEIVE)) ||
((config->GetMarker_All_KindBC(copy_marker[0]) == SEND_RECEIVE) && (copy_marker[1] == marker_seed))) {
agglomerate_CV = true;
}
}
// if (((copy_marker[0] == marker_seed[0]) && (config->GetMarker_All_KindBC(copy_marker[1]) == SEND_RECEIVE)) ||
// ((config->GetMarker_All_KindBC(copy_marker[0]) == SEND_RECEIVE) && (copy_marker[1] == marker_seed[0]))) {
agglomerate_CV = false;
// agglomerate_CV = true;
// }
// }
}
}
/*--- If the element belongs to the domain, it is always agglomerated. ---*/
/*--- If the element belongs to the domain, it is never agglomerated. ---*/
/*--- Any -> Interior : disallowed ---*/
else {
agglomerate_CV = true;

// actually, for symmetry (and possibly other cells) we only agglomerate cells that are on the marker
// at this point, the seed was on the boundary and the CV was not. so we check if the seed is a symmetry
if ((config->GetMarker_All_KindBC(marker_seed) == SYMMETRY_PLANE) ||
(config->GetMarker_All_KindBC(marker_seed) == EULER_WALL)) {
agglomerate_CV = false;
}
agglomerate_CV = false;
}
}

Expand Down
1 change: 1 addition & 0 deletions SU2_CFD/src/solvers/CSolverFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@
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.
break;
case SUB_SOLVER_TYPE::TEMPLATE:
genericSolver = new CTemplateSolver(geometry, config);
Expand Down
Loading