aboutsummaryrefslogtreecommitdiff
path: root/Source/Parallelization
diff options
context:
space:
mode:
authorGravatar Edoardo Zoni <59625522+EZoni@users.noreply.github.com> 2021-10-12 10:06:38 -0700
committerGravatar GitHub <noreply@github.com> 2021-10-12 10:06:38 -0700
commit6950e706f1e60d643204c598f7a293c70e5d85cb (patch)
treec175459379bb8848ff10e49540714f99b1e0a34f /Source/Parallelization
parent2282b42ae4f79f2c6d8e2d9103c9327acd11669b (diff)
downloadWarpX-6950e706f1e60d643204c598f7a293c70e5d85cb.tar.gz
WarpX-6950e706f1e60d643204c598f7a293c70e5d85cb.tar.zst
WarpX-6950e706f1e60d643204c598f7a293c70e5d85cb.zip
Fix PML Behavior in FillBoundary for F,G (#2383)
* Fix PML Behavior in FillBoundary for F,G * Update Benchmark of Test pml_psatd_dive_divb_cleaning
Diffstat (limited to 'Source/Parallelization')
-rw-r--r--Source/Parallelization/WarpXComm.cpp76
1 files changed, 27 insertions, 49 deletions
diff --git a/Source/Parallelization/WarpXComm.cpp b/Source/Parallelization/WarpXComm.cpp
index d03c9c721..a36521f69 100644
--- a/Source/Parallelization/WarpXComm.cpp
+++ b/Source/Parallelization/WarpXComm.cpp
@@ -767,42 +767,34 @@ WarpX::FillBoundaryF (int lev, IntVect ng)
void
WarpX::FillBoundaryF (int lev, PatchType patch_type, IntVect ng)
{
- if (patch_type == PatchType::fine && F_fp[lev])
+ if (patch_type == PatchType::fine)
{
if (do_pml && pml[lev]->ok())
{
- pml[lev]->ExchangeF(patch_type, F_fp[lev].get(),
- do_pml_in_domain);
+ if (F_fp[lev]) pml[lev]->ExchangeF(patch_type, F_fp[lev].get(), do_pml_in_domain);
pml[lev]->FillBoundaryF(patch_type);
}
- const auto& period = Geom(lev).periodicity();
- if ( safe_guard_cells ) {
- F_fp[lev]->FillBoundary(period);
- } else {
- AMREX_ALWAYS_ASSERT_WITH_MESSAGE(
- ng <= F_fp[lev]->nGrowVect(),
- "Error: in FillBoundaryF, requested more guard cells than allocated");
- F_fp[lev]->FillBoundary(ng, period);
+ if (F_fp[lev])
+ {
+ const amrex::Periodicity& period = Geom(lev).periodicity();
+ const amrex::IntVect& nghost = (safe_guard_cells) ? F_fp[lev]->nGrowVect() : ng;
+ F_fp[lev]->FillBoundary(nghost, period);
}
}
- else if (patch_type == PatchType::coarse && F_cp[lev])
+ else if (patch_type == PatchType::coarse)
{
if (do_pml && pml[lev]->ok())
{
- pml[lev]->ExchangeF(patch_type, F_cp[lev].get(),
- do_pml_in_domain);
- pml[lev]->FillBoundaryF(patch_type);
+ if (F_cp[lev]) pml[lev]->ExchangeF(patch_type, F_cp[lev].get(), do_pml_in_domain);
+ pml[lev]->FillBoundaryF(patch_type);
}
- const auto& cperiod = Geom(lev-1).periodicity();
- if ( safe_guard_cells ) {
- F_cp[lev]->FillBoundary(cperiod);
- } else {
- AMREX_ALWAYS_ASSERT_WITH_MESSAGE(
- ng <= F_cp[lev]->nGrowVect(),
- "Error: in FillBoundaryF, requested more guard cells than allocated");
- F_cp[lev]->FillBoundary(ng, cperiod);
+ if (F_cp[lev])
+ {
+ const amrex::Periodicity& period = Geom(lev-1).periodicity();
+ const amrex::IntVect& nghost = (safe_guard_cells) ? F_cp[lev]->nGrowVect() : ng;
+ F_cp[lev]->FillBoundary(nghost, period);
}
}
}
@@ -819,48 +811,34 @@ void WarpX::FillBoundaryG (int lev, IntVect ng)
void WarpX::FillBoundaryG (int lev, PatchType patch_type, IntVect ng)
{
- if (patch_type == PatchType::fine && G_fp[lev])
+ if (patch_type == PatchType::fine)
{
if (do_pml && pml[lev]->ok())
{
- pml[lev]->ExchangeG(patch_type, G_fp[lev].get(), do_pml_in_domain);
+ if (G_fp[lev]) pml[lev]->ExchangeG(patch_type, G_fp[lev].get(), do_pml_in_domain);
pml[lev]->FillBoundaryG(patch_type);
}
- const auto& period = Geom(lev).periodicity();
-
- if (safe_guard_cells)
+ if (G_fp[lev])
{
- G_fp[lev]->FillBoundary(period);
- }
- else
- {
- AMREX_ALWAYS_ASSERT_WITH_MESSAGE(ng <= G_fp[lev]->nGrowVect(),
- "Error: in FillBoundaryG, requested more guard cells than allocated");
-
- G_fp[lev]->FillBoundary(ng, period);
+ const amrex::Periodicity& period = Geom(lev).periodicity();
+ const amrex::IntVect& nghost = (safe_guard_cells) ? G_fp[lev]->nGrowVect() : ng;
+ G_fp[lev]->FillBoundary(nghost, period);
}
}
- else if (patch_type == PatchType::coarse && G_cp[lev])
+ else if (patch_type == PatchType::coarse)
{
if (do_pml && pml[lev]->ok())
{
- pml[lev]->ExchangeG(patch_type, G_cp[lev].get(), do_pml_in_domain);
+ if (G_cp[lev]) pml[lev]->ExchangeG(patch_type, G_cp[lev].get(), do_pml_in_domain);
pml[lev]->FillBoundaryG(patch_type);
}
- const auto& cperiod = Geom(lev-1).periodicity();
-
- if (safe_guard_cells)
+ if (G_cp[lev])
{
- G_cp[lev]->FillBoundary(cperiod);
- }
- else
- {
- AMREX_ALWAYS_ASSERT_WITH_MESSAGE(ng <= G_cp[lev]->nGrowVect(),
- "Error: in FillBoundaryG, requested more guard cells than allocated");
-
- G_cp[lev]->FillBoundary(ng, cperiod);
+ const amrex::Periodicity& period = Geom(lev-1).periodicity();
+ const amrex::IntVect& nghost = (safe_guard_cells) ? G_cp[lev]->nGrowVect() : ng;
+ G_cp[lev]->FillBoundary(nghost, period);
}
}
}