From 23ac38b3e3ab20a46cbf0a771bd77f3d9ce7c40a Mon Sep 17 00:00:00 2001 From: bigfooted Date: Fri, 8 Nov 2024 10:28:40 +0100 Subject: [PATCH 1/3] initial commit --- .../include/geometry/CMultiGridGeometry.hpp | 2 +- Common/src/geometry/CMultiGridGeometry.cpp | 132 ++++++++++++------ 2 files changed, 94 insertions(+), 40 deletions(-) diff --git a/Common/include/geometry/CMultiGridGeometry.hpp b/Common/include/geometry/CMultiGridGeometry.hpp index c3e897f7f31..7a2d65bb362 100644 --- a/Common/include/geometry/CMultiGridGeometry.hpp +++ b/Common/include/geometry/CMultiGridGeometry.hpp @@ -45,7 +45,7 @@ class CMultiGridGeometry final : public CGeometry { * \param[in] config - Definition of the particular problem. * \return TRUE or FALSE 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 marker_seed, const CGeometry* fine_grid, const CConfig* config) const; /*! diff --git a/Common/src/geometry/CMultiGridGeometry.cpp b/Common/src/geometry/CMultiGridGeometry.cpp index 8c5bfddf39e..4182d7ea62c 100644 --- a/Common/src/geometry/CMultiGridGeometry.cpp +++ b/Common/src/geometry/CMultiGridGeometry.cpp @@ -31,6 +31,10 @@ #include "../../../Common/include/toolboxes/geometry_toolbox.hpp" CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, unsigned short iMesh) : CGeometry() { + + vector marker_seed; + + nDim = fine_grid->GetnDim(); // Write the number of dimensions of the coarse grid. /*--- Create a queue system to do the agglomeration @@ -92,43 +96,58 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un 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 ---*/ - + //short counter2 = 1; for (auto jMarker = 0u; jMarker < fine_grid->GetnMarker() && counter < 3; jMarker++) { if (fine_grid->nodes->GetVertex(iPoint, jMarker) != -1) { copy_marker[counter] = jMarker; counter++; + + if (jMarker != iMarker) { + marker_seed.push_back(jMarker); + //counter2++; + } + } } - /*--- 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 -> Interior : never + * Valley -> Valley : conditional + * Valley -> Ridge : never ---*/ 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 ---*/ - + /*--- Ridge -> Interior : never + * Ridge -> Valley : never + * Ridge -> Ridge : conditional. Conditional means should be on the same marker. ---*/ 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) + || + (config->GetMarker_All_KindBC(copy_marker[0]) == + config->GetMarker_All_KindBC(copy_marker[1])) ); /* --- 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 = false; + //} } - /*--- If there are more than 2 markers, the aglomeration will be discarded ---*/ + /*--- Corner -> Any: never agglomerate ---*/ + /*--- If there are more than 2 markers, the agglomeration will be discarded ---*/ if (counter > 2) agglomerate_seed = false; @@ -138,6 +157,7 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un /*--- Now we do a sweep over all the nodes that surround the seed point ---*/ for (auto CVPoint : fine_grid->nodes->GetPoints(iPoint)) { + /*--- The new point can be agglomerated ---*/ if (SetBoundAgglomeration(CVPoint, marker_seed, fine_grid, config)) { @@ -506,7 +526,7 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un edgeColorGroupSize = config->GetEdgeColoringGroupSize(); } -bool CMultiGridGeometry::SetBoundAgglomeration(unsigned long CVPoint, short marker_seed, const CGeometry* fine_grid, +bool CMultiGridGeometry::SetBoundAgglomeration(unsigned long CVPoint, vector marker_seed, const CGeometry* fine_grid, const CConfig* config) const { bool agglomerate_CV = false; @@ -515,9 +535,11 @@ bool CMultiGridGeometry::SetBoundAgglomeration(unsigned long CVPoint, short mark if ((!fine_grid->nodes->GetAgglomerate(CVPoint)) && (fine_grid->nodes->GetDomain(CVPoint)) && (GeometricalCheck(CVPoint, fine_grid, config))) { + /*--- If the point belongs to a boundary, its type must be compatible with the seed marker. ---*/ if (fine_grid->nodes->GetBoundary(CVPoint)) { + /*--- Identify the markers of the vertex that we want to agglomerate ---*/ // count number of markers on the agglomeration candidate @@ -530,55 +552,87 @@ bool CMultiGridGeometry::SetBoundAgglomeration(unsigned long CVPoint, short mark } } - /*--- The basic condition is that the aglomerated vertex must have the same physical marker, - but eventually a send-receive condition ---*/ + //count again the markers on the seed + // for (auto jMarker = 0u; jMarker < fine_grid->GetnMarker() && counter < 3; jMarker++) { + // if (fine_grid->nodes->GetVertex(iPoint, jMarker) != -1) { + // copy_marker[counter] = jMarker; + // counter++; + // } + // } - /*--- Only one marker in the vertex that is going to be aglomerated ---*/ + /*--- The basic condition is that the agglomerated vertex must have the same physical marker, + but eventually a send-receive condition ---*/ - if (counter == 1) { + /*--- Only one marker in the vertex that is going to be agglomerated ---*/ + /*--- Ridge(2) -> Valley(1) : never + * Valley -> Valley(1) : conditional (should be same marker) ---*/ + if ((counter == 1) && (marker_seed.size() == 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; + // !!!! note that when the seed has 2 markers, we have a problem. + if (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 there is only one marker, but the marker is the SEND_RECEIVE ---*/ + // Nijso: that means the child is an mpi interface in the interior -> do NOT agglomerate unless the + // marker of the seed is also SEND_RECEIVE + else if (config->GetMarker_All_KindBC(copy_marker[0]) == SEND_RECEIVE) { + //agglomerate_CV = true; + agglomerate_CV = false; } - 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 (counter == 2) { + /*--- If there are two markers in the vertex that is going to be agglomerated ---*/ + /*--- ridge(2) -> ridge(2): conditionally allow (same marker) + * ridge -> valley : never (seed has 1 marker) + * ridge -> corner : never (seed has >2 marker ) + *---*/ + if ((counter == 2) && (marker_seed.size() == 2)) { /*--- First we verify that the seed is a physical boundary ---*/ - if (config->GetMarker_All_KindBC(marker_seed) != 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))) { + 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 = true; + } + else + /*--- check that ridges are equal on seed and on child ---*/ + if ((config->GetMarker_All_KindBC(copy_marker[0]) == config->GetMarker_All_KindBC(copy_marker[1])) + && + (config->GetMarker_All_KindBC(marker_seed[0]) == config->GetMarker_All_KindBC(marker_seed[1])) + ) { + cout << "ridges can be agglomerated" << endl; agglomerate_CV = true; } } } } /*--- If the element belongs to the domain, it is always agglomerated. ---*/ + /*--- any marker -> interior : never agglomerate ---*/ else { - agglomerate_CV = true; + + // only agglomerate internal nodes with mpi nodes + //if (config->GetMarker_All_KindBC(marker_seed[0]) == SEND_RECEIVE) + // agglomerate_CV = true; + //else + agglomerate_CV = false; // 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; - } + //if ((config->GetMarker_All_KindBC(marker_seed[0]) == SYMMETRY_PLANE) || + // (config->GetMarker_All_KindBC(marker_seed[0]) == EULER_WALL)) { + // agglomerate_CV = false; + //} } } From a47c0f4dbc00b791ecea3c3b7d7f9982a5425253 Mon Sep 17 00:00:00 2001 From: bigfooted Date: Fri, 8 Nov 2024 14:02:20 +0100 Subject: [PATCH 2/3] fix vector --- Common/include/geometry/CMultiGridGeometry.hpp | 2 +- Common/src/geometry/CMultiGridGeometry.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Common/include/geometry/CMultiGridGeometry.hpp b/Common/include/geometry/CMultiGridGeometry.hpp index 7a2d65bb362..4e98c3a938c 100644 --- a/Common/include/geometry/CMultiGridGeometry.hpp +++ b/Common/include/geometry/CMultiGridGeometry.hpp @@ -57,7 +57,7 @@ class CMultiGridGeometry final : public CGeometry { 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. diff --git a/Common/src/geometry/CMultiGridGeometry.cpp b/Common/src/geometry/CMultiGridGeometry.cpp index 4182d7ea62c..e1ded738c7d 100644 --- a/Common/src/geometry/CMultiGridGeometry.cpp +++ b/Common/src/geometry/CMultiGridGeometry.cpp @@ -32,7 +32,6 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, unsigned short iMesh) : CGeometry() { - vector marker_seed; nDim = fine_grid->GetnDim(); // Write the number of dimensions of the coarse grid. @@ -80,6 +79,7 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un /*--- 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 marker_seed; if ((!fine_grid->nodes->GetAgglomerate(iPoint)) && (fine_grid->nodes->GetDomain(iPoint)) && (GeometricalCheck(iPoint, fine_grid, config))) { From f846cbbc5fac657631d85d704ceacfc8929e54fb Mon Sep 17 00:00:00 2001 From: bigfooted Date: Fri, 15 Nov 2024 15:06:22 +0100 Subject: [PATCH 3/3] update agglomeration --- .../include/geometry/CMultiGridGeometry.hpp | 6 +- Common/include/geometry/CMultiGridQueue.hpp | 2 +- Common/src/geometry/CMultiGridGeometry.cpp | 136 +++++++----------- SU2_CFD/src/solvers/CSolverFactory.cpp | 1 + 4 files changed, 55 insertions(+), 90 deletions(-) diff --git a/Common/include/geometry/CMultiGridGeometry.hpp b/Common/include/geometry/CMultiGridGeometry.hpp index 4e98c3a938c..c0421ea23bd 100644 --- a/Common/include/geometry/CMultiGridGeometry.hpp +++ b/Common/include/geometry/CMultiGridGeometry.hpp @@ -31,14 +31,14 @@ /*! * \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. @@ -49,7 +49,7 @@ class CMultiGridGeometry final : public CGeometry { 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. diff --git a/Common/include/geometry/CMultiGridQueue.hpp b/Common/include/geometry/CMultiGridQueue.hpp index 0e48f938517..3ac15acdaf0 100644 --- a/Common/include/geometry/CMultiGridQueue.hpp +++ b/Common/include/geometry/CMultiGridQueue.hpp @@ -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); diff --git a/Common/src/geometry/CMultiGridGeometry.cpp b/Common/src/geometry/CMultiGridGeometry.cpp index e1ded738c7d..e020c4481d8 100644 --- a/Common/src/geometry/CMultiGridGeometry.cpp +++ b/Common/src/geometry/CMultiGridGeometry.cpp @@ -31,16 +31,13 @@ #include "../../../Common/include/toolboxes/geometry_toolbox.hpp" CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, unsigned short iMesh) : CGeometry() { - - - nDim = fine_grid->GetnDim(); // Write the number of dimensions of the coarse grid. /*--- 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. @@ -100,7 +97,7 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un /*--- For a particular point in the fine grid we save all the markers that are in that point ---*/ - //short counter2 = 1; + for (auto jMarker = 0u; jMarker < fine_grid->GetnMarker() && counter < 3; jMarker++) { if (fine_grid->nodes->GetVertex(iPoint, jMarker) != -1) { copy_marker[counter] = jMarker; @@ -108,45 +105,38 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un if (jMarker != iMarker) { marker_seed.push_back(jMarker); - //counter2++; } - } } /*--- 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 -> Interior : never - * Valley -> Valley : conditional - * Valley -> Ridge : never ---*/ + + /*--- 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[0]) == 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 ---*/ - /*--- Ridge -> Interior : never - * Ridge -> Valley : never - * Ridge -> Ridge : conditional. Conditional means should be on the same marker. ---*/ + if (counter == 2) { - agglomerate_seed = ((config->GetMarker_All_KindBC(copy_marker[0]) == SEND_RECEIVE) || - (config->GetMarker_All_KindBC(copy_marker[1]) == SEND_RECEIVE) - || - (config->GetMarker_All_KindBC(copy_marker[0]) == - config->GetMarker_All_KindBC(copy_marker[1])) ); + //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; + agglomerate_seed = true; //} } - /*--- Corner -> Any: never agglomerate ---*/ /*--- If there are more than 2 markers, the agglomeration will be discarded ---*/ if (counter > 2) agglomerate_seed = false; @@ -157,7 +147,6 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un /*--- Now we do a sweep over all the nodes that surround the seed point ---*/ for (auto CVPoint : fine_grid->nodes->GetPoints(iPoint)) { - /*--- The new point can be agglomerated ---*/ if (SetBoundAgglomeration(CVPoint, marker_seed, fine_grid, config)) { @@ -493,7 +482,8 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un 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); @@ -501,7 +491,9 @@ CMultiGridGeometry::CMultiGridGeometry(CGeometry* fine_grid, CConfig* config, un 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); @@ -535,11 +527,9 @@ bool CMultiGridGeometry::SetBoundAgglomeration(unsigned long CVPoint, vectornodes->GetAgglomerate(CVPoint)) && (fine_grid->nodes->GetDomain(CVPoint)) && (GeometricalCheck(CVPoint, fine_grid, config))) { - /*--- If the point belongs to a boundary, its type must be compatible with the seed marker. ---*/ if (fine_grid->nodes->GetBoundary(CVPoint)) { - /*--- Identify the markers of the vertex that we want to agglomerate ---*/ // count number of markers on the agglomeration candidate @@ -552,87 +542,61 @@ bool CMultiGridGeometry::SetBoundAgglomeration(unsigned long CVPoint, vectorGetnMarker() && counter < 3; jMarker++) { - // if (fine_grid->nodes->GetVertex(iPoint, jMarker) != -1) { - // copy_marker[counter] = jMarker; - // counter++; - // } - // } - /*--- 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 agglomerated ---*/ - /*--- Ridge(2) -> Valley(1) : never - * Valley -> Valley(1) : conditional (should be same marker) ---*/ - if ((counter == 1) && (marker_seed.size() == 1)) { + + /*--- 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 - // !!!! note that when the seed has 2 markers, we have a problem. - if (copy_marker[0] == marker_seed[0]) 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 ---*/ - // Nijso: that means the child is an mpi interface in the interior -> do NOT agglomerate unless the - // marker of the seed is also SEND_RECEIVE - else if (config->GetMarker_All_KindBC(copy_marker[0]) == SEND_RECEIVE) { - //agglomerate_CV = true; - agglomerate_CV = false; - } + + //if (config->GetMarker_All_KindBC(copy_marker[0]) == SEND_RECEIVE) { + // agglomerate_CV = true; + //} //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 (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 agglomerated ---*/ - /*--- ridge(2) -> ridge(2): conditionally allow (same marker) - * ridge -> valley : never (seed has 1 marker) - * ridge -> corner : never (seed has >2 marker ) - *---*/ - if ((counter == 2) && (marker_seed.size() == 2)) { + /*--- 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[0]) != 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 ---*/ - /*--- 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[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 = true; - } - else - /*--- check that ridges are equal on seed and on child ---*/ - if ((config->GetMarker_All_KindBC(copy_marker[0]) == config->GetMarker_All_KindBC(copy_marker[1])) - && - (config->GetMarker_All_KindBC(marker_seed[0]) == config->GetMarker_All_KindBC(marker_seed[1])) - ) { - cout << "ridges can be agglomerated" << endl; - 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. ---*/ - /*--- any marker -> interior : never agglomerate ---*/ + /*--- If the element belongs to the domain, it is never agglomerated. ---*/ + /*--- Any -> Interior : disallowed ---*/ else { - - // only agglomerate internal nodes with mpi nodes - //if (config->GetMarker_All_KindBC(marker_seed[0]) == SEND_RECEIVE) - // agglomerate_CV = true; - //else agglomerate_CV = false; - - // 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[0]) == SYMMETRY_PLANE) || - // (config->GetMarker_All_KindBC(marker_seed[0]) == EULER_WALL)) { - // agglomerate_CV = false; - //} } } diff --git a/SU2_CFD/src/solvers/CSolverFactory.cpp b/SU2_CFD/src/solvers/CSolverFactory.cpp index 743775ad139..ba7ae481484 100644 --- a/SU2_CFD/src/solvers/CSolverFactory.cpp +++ b/SU2_CFD/src/solvers/CSolverFactory.cpp @@ -307,6 +307,7 @@ CSolver* CSolverFactory::CreateSubSolver(SUB_SOLVER_TYPE kindSolver, CSolver **s 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);