aboutsummaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/Evolve/WarpXEvolveEM.cpp17
-rw-r--r--Source/Parallelization/GuardCellManager.H25
-rw-r--r--Source/Parallelization/GuardCellManager.cpp7
-rw-r--r--Source/Parallelization/WarpXComm.cpp21
-rw-r--r--Source/Utils/WarpXMovingWindow.cpp54
-rw-r--r--Source/WarpX.H16
6 files changed, 96 insertions, 44 deletions
diff --git a/Source/Evolve/WarpXEvolveEM.cpp b/Source/Evolve/WarpXEvolveEM.cpp
index 8ad3b2401..c98a4688e 100644
--- a/Source/Evolve/WarpXEvolveEM.cpp
+++ b/Source/Evolve/WarpXEvolveEM.cpp
@@ -90,15 +90,22 @@ WarpX::EvolveEM (int numsteps)
// Beyond one step, we have E^{n} and B^{n}.
// Particles have p^{n-1/2} and x^{n}.
// This is probably overkill
- FillBoundaryE(guard_cells.ngE);
+ // FillBoundaryE(guard_cells.ngE);
// This is probably overkill
- FillBoundaryB(guard_cells.ngE);
+ // FillBoundaryB(guard_cells.ngE);
+ IntVect my_nc;
+ my_nc = guard_cells.ng_FieldGather+guard_cells.ng_NCIFilter;
+ FillBoundaryE(my_nc);
+ FillBoundaryB(my_nc);
+ FillBoundaryAux(guard_cells.ng_Aux);
UpdateAuxilaryData();
-
}
if (do_subcycling == 0 || finest_level == 0) {
OneStep_nosub(cur_time);
+ // E : guard cells are up-to-date
+ // B : guard cells are NOT up-to-date
+ // F : guard cells are NOT up-to-date
} else if (do_subcycling == 1 && finest_level == 1) {
OneStep_sub1(cur_time);
} else {
@@ -108,6 +115,7 @@ WarpX::EvolveEM (int numsteps)
if (num_mirrors>0){
applyMirrors(cur_time);
+ // E : guard cells are NOT up-to-date
}
#ifdef WARPX_USE_PY
@@ -191,6 +199,7 @@ WarpX::EvolveEM (int numsteps)
FillBoundaryE(guard_cells.ngE);
// This is probably overkill
FillBoundaryB(guard_cells.ngE);
+ FillBoundaryAux(guard_cells.ng_Aux);
UpdateAuxilaryData();
for (int lev = 0; lev <= finest_level; ++lev) {
@@ -245,6 +254,7 @@ WarpX::EvolveEM (int numsteps)
FillBoundaryE(guard_cells.ngE);
// This is probably overkill
FillBoundaryB(guard_cells.ngE);
+ FillBoundaryAux(guard_cells.ng_Aux);
UpdateAuxilaryData();
for (int lev = 0; lev <= finest_level; ++lev) {
@@ -325,6 +335,7 @@ WarpX::OneStep_nosub (Real cur_time)
EvolveE(dt[0]); // We now have E^{n+1}
FillBoundaryE(guard_cells.ngE_FieldSolver);
EvolveF(0.5*dt[0], DtType::SecondHalf);
+ FillBoundaryF(guard_cells.ngF);
EvolveB(0.5*dt[0]); // We now have B^{n+1}
if (do_pml) {
DampPML();
diff --git a/Source/Parallelization/GuardCellManager.H b/Source/Parallelization/GuardCellManager.H
index 4b85a4332..706b5df79 100644
--- a/Source/Parallelization/GuardCellManager.H
+++ b/Source/Parallelization/GuardCellManager.H
@@ -22,20 +22,21 @@ public:
const int max_level);
// Guard cells to initialize multifabs
- amrex::IntVect ngExtra;
- amrex::IntVect ngE;
- amrex::IntVect ngJ;
- amrex::IntVect ngRho;
- amrex::IntVect ngF;
- int ngF_int;
+ amrex::IntVect ngExtra = amrex::IntVect::TheZeroVector();
+ amrex::IntVect ngE = amrex::IntVect::TheZeroVector();
+ amrex::IntVect ngJ = amrex::IntVect::TheZeroVector();
+ amrex::IntVect ngRho = amrex::IntVect::TheZeroVector();
+ amrex::IntVect ngF = amrex::IntVect::TheZeroVector();
+ int ngF_int = 0;
// Guard cells to exchange data
- amrex::IntVect ngB_FieldSolver;
- amrex::IntVect ngE_FieldSolver;
- amrex::IntVect ng_FieldGather;
- amrex::IntVect ngJ_CurrentDepo;
- amrex::IntVect ng_MovingWindow;
- amrex::IntVect ng_NCIFilter;
+ amrex::IntVect ngB_FieldSolver = amrex::IntVect::TheZeroVector();
+ amrex::IntVect ngE_FieldSolver = amrex::IntVect::TheZeroVector();
+ amrex::IntVect ng_FieldGather = amrex::IntVect::TheZeroVector();
+ amrex::IntVect ngJ_CurrentDepo = amrex::IntVect::TheZeroVector();
+ amrex::IntVect ng_MovingWindow = amrex::IntVect::TheZeroVector();
+ amrex::IntVect ng_NCIFilter = amrex::IntVect::TheZeroVector();
+ amrex::IntVect ng_Aux = amrex::IntVect::TheZeroVector();
};
#endif // GUARDCELLMANAGER_H_
diff --git a/Source/Parallelization/GuardCellManager.cpp b/Source/Parallelization/GuardCellManager.cpp
index c790c3472..166f0d58d 100644
--- a/Source/Parallelization/GuardCellManager.cpp
+++ b/Source/Parallelization/GuardCellManager.cpp
@@ -131,5 +131,10 @@ guardCellManager::Init(
int FGcell[4] = {0,1,1,2}; // Index is nox
ng_FieldGather = IntVect(AMREX_D_DECL(FGcell[nox],FGcell[nox],FGcell[nox]));
ngJ_CurrentDepo = ng_FieldGather;
- ng_NCIFilter = IntVect(AMREX_D_DECL(0,0,4));
+ if (do_fdtd_nci_corr){
+ ng_NCIFilter = IntVect::TheZeroVector();
+ ng_NCIFilter[AMREX_SPACEDIM-1] = 4;
+ }
+ ng_Aux = 2*ng_FieldGather+ng_NCIFilter;
+ ng_Aux = ng_Aux.min(ngE);
}
diff --git a/Source/Parallelization/WarpXComm.cpp b/Source/Parallelization/WarpXComm.cpp
index 0dae38e2e..7d2473f30 100644
--- a/Source/Parallelization/WarpXComm.cpp
+++ b/Source/Parallelization/WarpXComm.cpp
@@ -484,6 +484,27 @@ WarpX::FillBoundaryF (int lev, PatchType patch_type, IntVect ng)
}
void
+WarpX::FillBoundaryAux (IntVect ng)
+{
+ for (int lev = 0; lev <= finest_level-1; ++lev)
+ {
+ FillBoundaryAux(lev, ng);
+ }
+}
+
+void
+WarpX::FillBoundaryAux (int lev, IntVect ng)
+{
+ const auto& period = Geom(lev).periodicity();
+ Efield_aux[lev][0]->FillBoundary(0, Efield_aux[lev][0]->nComp(), ng, period);
+ Efield_aux[lev][1]->FillBoundary(0, Efield_aux[lev][1]->nComp(), ng, period);
+ Efield_aux[lev][2]->FillBoundary(0, Efield_aux[lev][2]->nComp(), ng, period);
+ Bfield_aux[lev][0]->FillBoundary(0, Bfield_aux[lev][0]->nComp(), ng, period);
+ Bfield_aux[lev][1]->FillBoundary(0, Bfield_aux[lev][1]->nComp(), ng, period);
+ Bfield_aux[lev][2]->FillBoundary(0, Bfield_aux[lev][2]->nComp(), ng, period);
+}
+
+void
WarpX::SyncCurrent ()
{
BL_PROFILE("SyncCurrent()");
diff --git a/Source/Utils/WarpXMovingWindow.cpp b/Source/Utils/WarpXMovingWindow.cpp
index c577da7f3..59810d817 100644
--- a/Source/Utils/WarpXMovingWindow.cpp
+++ b/Source/Utils/WarpXMovingWindow.cpp
@@ -99,32 +99,34 @@ WarpX::MoveWindow (bool move_j)
for (int dim = 0; dim < 3; ++dim) {
// Fine grid
- shiftMF(*Bfield_fp[lev][dim], geom[lev], num_shift, dir, B_external_grid[dim]);
- shiftMF(*Efield_fp[lev][dim], geom[lev], num_shift, dir, E_external_grid[dim]);
+ shiftMF(*Bfield_fp[lev][dim], geom[lev], num_shift, dir, guard_cells.ngE, B_external_grid[dim]);
+ shiftMF(*Efield_fp[lev][dim], geom[lev], num_shift, dir, guard_cells.ngE, E_external_grid[dim]);
if (move_j) {
- shiftMF(*current_fp[lev][dim], geom[lev], num_shift, dir);
+ shiftMF(*current_fp[lev][dim], geom[lev], num_shift, dir, guard_cells.ngJ);
}
if (do_pml && pml[lev]->ok()) {
const std::array<MultiFab*, 3>& pml_B = pml[lev]->GetB_fp();
const std::array<MultiFab*, 3>& pml_E = pml[lev]->GetE_fp();
- shiftMF(*pml_B[dim], geom[lev], num_shift, dir);
- shiftMF(*pml_E[dim], geom[lev], num_shift, dir);
+ IntVect ng_exchange = pml_B[dim]->nGrowVect();
+ shiftMF(*pml_B[dim], geom[lev], num_shift, dir, ng_exchange);
+ shiftMF(*pml_E[dim], geom[lev], num_shift, dir, ng_exchange);
}
if (lev > 0) {
// Coarse grid
- shiftMF(*Bfield_cp[lev][dim], geom[lev-1], num_shift_crse, dir, B_external_grid[dim]);
- shiftMF(*Efield_cp[lev][dim], geom[lev-1], num_shift_crse, dir, E_external_grid[dim]);
- shiftMF(*Bfield_aux[lev][dim], geom[lev], num_shift, dir);
- shiftMF(*Efield_aux[lev][dim], geom[lev], num_shift, dir);
+ shiftMF(*Bfield_cp[lev][dim], geom[lev-1], num_shift_crse, dir, guard_cells.ngE, B_external_grid[dim]);
+ shiftMF(*Efield_cp[lev][dim], geom[lev-1], num_shift_crse, dir, guard_cells.ngE, E_external_grid[dim]);
+ shiftMF(*Bfield_aux[lev][dim], geom[lev], num_shift, dir, guard_cells.ngE);
+ shiftMF(*Efield_aux[lev][dim], geom[lev], num_shift, dir, guard_cells.ngE);
if (move_j) {
- shiftMF(*current_cp[lev][dim], geom[lev-1], num_shift_crse, dir);
+ shiftMF(*current_cp[lev][dim], geom[lev-1], num_shift_crse, dir, guard_cells.ngJ);
}
if (do_pml && pml[lev]->ok()) {
const std::array<MultiFab*, 3>& pml_B = pml[lev]->GetB_cp();
const std::array<MultiFab*, 3>& pml_E = pml[lev]->GetE_cp();
- shiftMF(*pml_B[dim], geom[lev-1], num_shift_crse, dir);
- shiftMF(*pml_E[dim], geom[lev-1], num_shift_crse, dir);
+ IntVect ng_exchange = pml_B[dim]->nGrowVect();
+ shiftMF(*pml_B[dim], geom[lev-1], num_shift_crse, dir, ng_exchange);
+ shiftMF(*pml_E[dim], geom[lev-1], num_shift_crse, dir, ng_exchange);
}
}
}
@@ -132,19 +134,21 @@ WarpX::MoveWindow (bool move_j)
// Shift scalar component F for dive cleaning
if (do_dive_cleaning) {
// Fine grid
- shiftMF(*F_fp[lev], geom[lev], num_shift, dir);
+ shiftMF(*F_fp[lev], geom[lev], num_shift, dir, guard_cells.ngF);
if (do_pml && pml[lev]->ok()) {
MultiFab* pml_F = pml[lev]->GetF_fp();
- shiftMF(*pml_F, geom[lev], num_shift, dir);
+ IntVect ng_exchange = pml_F->nGrowVect();
+ shiftMF(*pml_F, geom[lev], num_shift, dir, ng_exchange);
}
if (lev > 0) {
// Coarse grid
- shiftMF(*F_cp[lev], geom[lev-1], num_shift_crse, dir);
+ shiftMF(*F_cp[lev], geom[lev-1], num_shift_crse, dir, guard_cells.ngF);
if (do_pml && pml[lev]->ok()) {
MultiFab* pml_F = pml[lev]->GetF_cp();
- shiftMF(*pml_F, geom[lev-1], num_shift_crse, dir);
+ IntVect ng_exchange = pml_F->nGrowVect();
+ shiftMF(*pml_F, geom[lev-1], num_shift_crse, dir, ng_exchange);
}
- shiftMF(*rho_cp[lev], geom[lev-1], num_shift_crse, dir);
+ shiftMF(*rho_cp[lev], geom[lev-1], num_shift_crse, dir, guard_cells.ngRho);
}
}
@@ -152,10 +156,10 @@ WarpX::MoveWindow (bool move_j)
if (move_j) {
if (rho_fp[lev]){
// Fine grid
- shiftMF(*rho_fp[lev], geom[lev], num_shift, dir);
+ shiftMF(*rho_fp[lev], geom[lev], num_shift, dir, guard_cells.ngRho);
if (lev > 0){
// Coarse grid
- shiftMF(*rho_cp[lev], geom[lev-1], num_shift_crse, dir);
+ shiftMF(*rho_cp[lev], geom[lev-1], num_shift_crse, dir, guard_cells.ngRho);
}
}
}
@@ -204,7 +208,7 @@ WarpX::MoveWindow (bool move_j)
void
WarpX::shiftMF (MultiFab& mf, const Geometry& geom, int num_shift, int dir,
- amrex::Real external_field)
+ IntVect ng_exchange, amrex::Real external_field)
{
BL_PROFILE("WarpX::shiftMF()");
const BoxArray& ba = mf.boxArray();
@@ -216,7 +220,15 @@ WarpX::shiftMF (MultiFab& mf, const Geometry& geom, int num_shift, int dir,
MultiFab tmpmf(ba, dm, nc, ng);
MultiFab::Copy(tmpmf, mf, 0, 0, nc, ng);
- tmpmf.FillBoundary(geom.periodicity());
+
+ // Not sure why this is needed, but it is...
+ ng_exchange[0] = 1;
+ ng_exchange[1] = num_shift; // 2
+ Print()<<"ng_exchange "<<ng_exchange<<'\n';
+
+ tmpmf.FillBoundary(0, tmpmf.nComp(), ng_exchange, geom.periodicity());
+
+
// Make a box that covers the region that the window moved into
const IndexType& typ = ba.ixType();
diff --git a/Source/WarpX.H b/Source/WarpX.H
index da9431d32..f645e8e9a 100644
--- a/Source/WarpX.H
+++ b/Source/WarpX.H
@@ -72,7 +72,7 @@ public:
MultiParticleContainer& GetPartContainer () { return *mypc; }
static void shiftMF(amrex::MultiFab& mf, const amrex::Geometry& geom, int num_shift, int dir,
- amrex::Real external_field = 0.);
+ amrex::IntVect ng_exchange, amrex::Real external_field = 0.);
static void GotoNextLine (std::istream& is);
@@ -215,12 +215,14 @@ public:
void UpdateAuxilaryDataSameType ();
// Fill boundary cells including coarse/fine boundaries
- void FillBoundaryB (amrex::IntVect ng);
- void FillBoundaryE (amrex::IntVect ng);
- void FillBoundaryF (amrex::IntVect ng);
- void FillBoundaryE (int lev, amrex::IntVect ng);
- void FillBoundaryB (int lev, amrex::IntVect ng);
- void FillBoundaryF (int lev, amrex::IntVect ng);
+ void FillBoundaryB (amrex::IntVect ng);
+ void FillBoundaryE (amrex::IntVect ng);
+ void FillBoundaryF (amrex::IntVect ng);
+ void FillBoundaryAux (amrex::IntVect ng);
+ void FillBoundaryE (int lev, amrex::IntVect ng);
+ void FillBoundaryB (int lev, amrex::IntVect ng);
+ void FillBoundaryF (int lev, amrex::IntVect ng);
+ void FillBoundaryAux (int lev, amrex::IntVect ng);
void SyncCurrent ();
void SyncRho ();