From d341e4c3473fc85017532bac8e05c202416d6ec9 Mon Sep 17 00:00:00 2001 From: Weiqun Zhang Date: Wed, 4 Sep 2024 14:31:09 -0700 Subject: [PATCH] MLMG: Minimum domain width By default, the minimum domain width at the coarsest multigrid level is 2 and 4, for non-EB and EB runs, respectively. Previously, it was set to 4 for runs compiled with EB support but without EB at run time. So the results of those runs would be different from runs not compiled with EB support. This is not a correctness issue. Nevertheless, for the sake of consistence, we set the minimum domain width to 4 only if there is non-trivial EB at run time. --- Src/LinearSolvers/MLMG/AMReX_MLABecLaplacian.H | 2 +- Src/LinearSolvers/MLMG/AMReX_MLLinOp.H | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Src/LinearSolvers/MLMG/AMReX_MLABecLaplacian.H b/Src/LinearSolvers/MLMG/AMReX_MLABecLaplacian.H index 9b56b8049d..7b5fb06942 100644 --- a/Src/LinearSolvers/MLMG/AMReX_MLABecLaplacian.H +++ b/Src/LinearSolvers/MLMG/AMReX_MLABecLaplacian.H @@ -1281,7 +1281,7 @@ MLABecLaplacianT::supportNSolve () const bool support = false; if (this->m_overset_mask[0][0]) { if (this->m_geom[0].back().Domain().coarsenable(MLLinOp::mg_coarsen_ratio, - MLLinOp::mg_domain_min_width) + this->mg_domain_min_width) && this->m_grids[0].back().coarsenable(MLLinOp::mg_coarsen_ratio, MLLinOp::mg_box_min_width)) { support = true; diff --git a/Src/LinearSolvers/MLMG/AMReX_MLLinOp.H b/Src/LinearSolvers/MLMG/AMReX_MLLinOp.H index 3cc623b761..ce6a8b5333 100644 --- a/Src/LinearSolvers/MLMG/AMReX_MLLinOp.H +++ b/Src/LinearSolvers/MLMG/AMReX_MLLinOp.H @@ -570,11 +570,7 @@ protected: static constexpr int mg_coarsen_ratio = 2; static constexpr int mg_box_min_width = 2; -#ifdef AMREX_USE_EB - static constexpr int mg_domain_min_width = 4; -#else - static constexpr int mg_domain_min_width = 2; -#endif + int mg_domain_min_width = 2; LPInfo info; @@ -803,6 +799,15 @@ MLLinOpT::defineGrids (const Vector& a_geom, { BL_PROFILE("MLLinOp::defineGrids()"); +#ifdef AMREX_USE_EB + if ( ! a_factory.empty() ) { + auto const* ebf = dynamic_cast(a_factory[0]); + if (ebf && !(ebf->isAllRegular())) { // Has non-trivial EB + mg_domain_min_width = 4; + } + } +#endif + m_num_amr_levels = 0; for (int amrlev = 0; amrlev < a_geom.size(); amrlev++) { if (!a_grids[amrlev].empty()) {