@@ -1850,6 +1850,34 @@ void CSolver::PerformCFLReductions(CGeometry *geometry, CConfig *config, unsigne
18501850 config->SetCFL (iMesh, Avg_CFL_Local);
18511851}
18521852
1853+ void CSolver::SynchronizeCFLFlags (bool &reduceCFL, bool &resetCFL, bool &canIncrease) {
1854+ #ifdef HAVE_MPI
1855+ /* Synchronize CFL decision flags across all MPI ranks to ensure consistent global strategy.
1856+ This prevents different ranks from making conflicting CFL decisions which would cause:
1857+ - Inconsistent CFL values for corresponding points across domain decomposition
1858+ - Potential divergence when some ranks reduce CFL while others increase
1859+ - Multigrid issues when coarse levels don't respond to fine grid instabilities
1860+
1861+ Logic:
1862+ - reduceCFL: Use logical OR - if ANY rank needs to reduce, ALL should reduce (safety)
1863+ - resetCFL: Use logical OR - if ANY rank detects catastrophic divergence, ALL should reset
1864+ - canIncrease: Use logical AND - only increase if ALL ranks are stable (conservative) */
1865+
1866+ int reduceCFL_int = reduceCFL ? 1 : 0 ;
1867+ int resetCFL_int = resetCFL ? 1 : 0 ;
1868+ int canIncrease_int = canIncrease ? 1 : 0 ;
1869+
1870+ SU2_MPI::Allreduce (MPI_IN_PLACE, &reduceCFL_int, 1 , MPI_INT, MPI_LOR, SU2_MPI::GetComm ());
1871+ SU2_MPI::Allreduce (MPI_IN_PLACE, &resetCFL_int, 1 , MPI_INT, MPI_LOR, SU2_MPI::GetComm ());
1872+ SU2_MPI::Allreduce (MPI_IN_PLACE, &canIncrease_int, 1 , MPI_INT, MPI_LAND, SU2_MPI::GetComm ());
1873+
1874+ reduceCFL = (reduceCFL_int != 0 );
1875+ resetCFL = (resetCFL_int != 0 );
1876+ canIncrease = (canIncrease_int != 0 );
1877+ #endif
1878+ /* No synchronization needed for serial builds - flags remain as computed locally */
1879+ }
1880+
18531881void CSolver::ApplyCFLToCoarseGrid (CGeometry *geometry, CSolver **solver_container,
18541882 CConfig *config, unsigned short iMesh,
18551883 bool reduceCFL, bool resetCFL, bool canIncrease,
@@ -2487,28 +2515,8 @@ void CSolver::AdaptCFLNumber(CGeometry **geometry,
24872515 }
24882516 }
24892517
2490- /* Synchronize CFL decision flags across all MPI ranks to ensure consistent global strategy.
2491- This prevents different ranks from making conflicting CFL decisions which would cause:
2492- - Inconsistent CFL values for corresponding points across domain decomposition
2493- - Potential divergence when some ranks reduce CFL while others increase
2494- - Multigrid issues when coarse levels don't respond to fine grid instabilities
2495-
2496- Logic:
2497- - reduceCFL: Use logical OR - if ANY rank needs to reduce, ALL should reduce (safety)
2498- - resetCFL: Use logical OR - if ANY rank detects catastrophic divergence, ALL should reset
2499- - canIncrease: Use logical AND - only increase if ALL ranks are stable (conservative) */
2500-
2501- int reduceCFL_int = reduceCFL ? 1 : 0 ;
2502- int resetCFL_int = resetCFL ? 1 : 0 ;
2503- int canIncrease_int = canIncrease ? 1 : 0 ;
2504-
2505- SU2_MPI::Allreduce (MPI_IN_PLACE, &reduceCFL_int, 1 , MPI_INT, MPI_LOR, SU2_MPI::GetComm ());
2506- SU2_MPI::Allreduce (MPI_IN_PLACE, &resetCFL_int, 1 , MPI_INT, MPI_LOR, SU2_MPI::GetComm ());
2507- SU2_MPI::Allreduce (MPI_IN_PLACE, &canIncrease_int, 1 , MPI_INT, MPI_LAND, SU2_MPI::GetComm ());
2508-
2509- reduceCFL = (reduceCFL_int != 0 );
2510- resetCFL = (resetCFL_int != 0 );
2511- canIncrease = (canIncrease_int != 0 );
2518+ /* Synchronize CFL decision flags across all MPI ranks */
2519+ SynchronizeCFLFlags (reduceCFL, resetCFL, canIncrease);
25122520
25132521 if (rank == MASTER_NODE && iter % 50 == 0 ) {
25142522 cout << " MPI-Synchronized CFL Flags - Iter " << iter
0 commit comments