Skip to content

Commit 9f19341

Browse files
committed
fix cross-lines in implicit line agglomeration
1 parent d28ce20 commit 9f19341

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

Common/src/geometry/CMultiGridGeometry.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,6 +1106,30 @@ void CMultiGridGeometry::AgglomerateImplicitLines(unsigned long &Index_CoarseCV,
11061106
!GeometricalCheck(c, fine_grid, config) || !GeometricalCheck(d, fine_grid, config))
11071107
continue;
11081108

1109+
1110+
// Check for duplicate indices — guard against merging the same node twice.
1111+
if (a == b || a == c || a == d || b == c || b == d || c == d) {
1112+
if (debug) {
1113+
std::cout << "[MG_IMPLICIT] Duplicate indices detected in CROSS-LINE merge at stage " << pair_idx
1114+
<< " lines " << li1 << "," << li2 << " : indices = " << a << "," << b << "," << c
1115+
<< "," << d << "\n";
1116+
std::cout << "[MG_IMPLICIT] Parents: " << fine_grid->nodes->GetParent_CV(a) << ","
1117+
<< fine_grid->nodes->GetParent_CV(b) << "," << fine_grid->nodes->GetParent_CV(c) << ","
1118+
<< fine_grid->nodes->GetParent_CV(d) << "\n";
1119+
std::cout << "[MG_IMPLICIT] Reserved flags: " << reserved[a] << "," << reserved[b] << ","
1120+
<< reserved[c] << "," << reserved[d] << "\n";
1121+
} else {
1122+
std::cout << "[MG_IMPLICIT] Duplicate indices detected in CROSS-LINE merge; skipping merge for Index_CoarseCV="
1123+
<< Index_CoarseCV << "\n";
1124+
}
1125+
1126+
// Stop implicit-line agglomeration for other lines that share this parent
1127+
// so only one wall-line per parent is processed (prevents later conflicts).
1128+
for (auto other_li : entry.second) line_processed[other_li] = 1;
1129+
1130+
continue;
1131+
}
1132+
11091133
// create a new coarse control volume merging {a,b,c,d}
11101134
if (debug) {
11111135
std::cout << "[MG_IMPLICIT] Stage " << pair_idx <<
@@ -1130,6 +1154,8 @@ void CMultiGridGeometry::AgglomerateImplicitLines(unsigned long &Index_CoarseCV,
11301154

11311155
Index_CoarseCV++;
11321156
line_processed[li1] = line_processed[li2] = 1;
1157+
// mark all other lines sharing this parent as processed (stop their implicit agglomeration)
1158+
for (auto other_li : line_ids) if (other_li != li1 && other_li != li2) line_processed[other_li] = 1;
11331159
done_stage = false;
11341160
}
11351161
}

SU2_CFD/include/solvers/CScalarSolver.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ void CScalarSolver<VariableType>::Upwind_Residual(CGeometry* geometry, CSolver**
132132
/*--- Define booleans that are solver specific through CConfig's GlobalParams which have to be set in CFluidIteration
133133
* before calling these solver functions. ---*/
134134
const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT);
135-
const bool muscl = config->GetMUSCL();
135+
const bool muscl = config->GetMUSCL() && (iMesh == MESH_0);
136136
const bool limiter = (config->GetKind_SlopeLimit() != LIMITER::NONE) &&
137137
(config->GetInnerIter() <= config->GetLimiterIter());
138138

SU2_CFD/src/integration/CMultiGridIntegration.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ void CMultiGridIntegration::MultiGrid_Cycle(CGeometry ****geometry,
213213
/*--- Compute $P_(k+1) = I^(k+1)_k(r_k) - r_(k+1) ---*/
214214

215215
// Adapt damping based on recorded pre-smoothing iterations and apply to forcing term
216-
cout << "calling damp_restric_Adapt" << endl;
216+
//cout << "calling damp_restric_Adapt" << endl;
217217
su2double adapted_factor = Damp_Restric_Adapt(lastPreSmoothIters, config->GetnMGLevels() + 1, config);
218218
SetForcing_Term(solver_fine, solver_coarse, geometry_fine, geometry_coarse, config, iMesh+1, adapted_factor);
219219

@@ -775,7 +775,7 @@ static su2double Damp_Restric_Adapt(const unsigned short *lastPreSmoothIters,
775775
// already made through global MPI reductions, so calling the setter on all
776776
// ranks yields the same value everywhere.
777777
config->SetDamp_Res_Restric(new_factor);
778-
cout << "ending Damp_Restric_Adapt, damping = " <<config->GetDamp_Res_Restric() << endl;
778+
//cout << "ending Damp_Restric_Adapt, damping = " <<config->GetDamp_Res_Restric() << endl;
779779
return new_factor;
780780
}
781781

0 commit comments

Comments
 (0)