diff options
author | 2021-03-04 13:00:13 -0800 | |
---|---|---|
committer | 2021-03-04 13:00:13 -0800 | |
commit | a0870a3063e9e655e281cc31e2d1b6580294696e (patch) | |
tree | 2f52fa0d2efa77d77f92c558c92b534bf2c021bd /Source/Parallelization | |
parent | bca858c89e9012f15c94ce896dbe7ea4fedbc322 (diff) | |
download | WarpX-a0870a3063e9e655e281cc31e2d1b6580294696e.tar.gz WarpX-a0870a3063e9e655e281cc31e2d1b6580294696e.tar.zst WarpX-a0870a3063e9e655e281cc31e2d1b6580294696e.zip |
Implement averaged algo on staggered grids & merge spectral classes (#1544)
* Refactor and clean up some spectral classes
* Abort when current correction or Vay deposition are not implemented
* Implement general equations for averaged Galilean
* Allocate averaged MultiFabs also when aux_is_nodal=1 and do_nodal=0
* Allocate +ngextra guard cells also for averaged MultiFabs
* Make alias MultiFabs for averaged aux data
* With averaging, interpolate from avg_fp (not fp) to aux
* Fix some limits of the coefficients
* Fix bug causing NaNs in spectral coefficients
* Add 2D CI test with same analysis as nodal test
* Add 3D CI test with same analysis as nodal test
* Add limit that was not covered (knorm=0 && knorm_c!=0 && nu=0)
* Allocate T2_coef only if Galilean algorithm is used
* Allocate X4_coef only if Galilean algorithm is used
* Remove extra ghost cell from 'avg_fp' MultiFabs
Diffstat (limited to 'Source/Parallelization')
-rw-r--r-- | Source/Parallelization/WarpXComm.cpp | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/Source/Parallelization/WarpXComm.cpp b/Source/Parallelization/WarpXComm.cpp index d96106671..11179df80 100644 --- a/Source/Parallelization/WarpXComm.cpp +++ b/Source/Parallelization/WarpXComm.cpp @@ -43,13 +43,18 @@ WarpX::UpdateAuxilaryDataStagToNodal () } #endif - const amrex::IntVect& Bx_stag = Bfield_fp[0][0]->ixType().toIntVect(); - const amrex::IntVect& By_stag = Bfield_fp[0][1]->ixType().toIntVect(); - const amrex::IntVect& Bz_stag = Bfield_fp[0][2]->ixType().toIntVect(); + amrex::Vector<std::array<std::unique_ptr<amrex::MultiFab>,3>> const & Bmf = WarpX::fft_do_time_averaging ? + Bfield_avg_fp : Bfield_fp; + amrex::Vector<std::array<std::unique_ptr<amrex::MultiFab>,3>> const & Emf = WarpX::fft_do_time_averaging ? + Efield_avg_fp : Efield_fp; - const amrex::IntVect& Ex_stag = Efield_fp[0][0]->ixType().toIntVect(); - const amrex::IntVect& Ey_stag = Efield_fp[0][1]->ixType().toIntVect(); - const amrex::IntVect& Ez_stag = Efield_fp[0][2]->ixType().toIntVect(); + const amrex::IntVect& Bx_stag = Bmf[0][0]->ixType().toIntVect(); + const amrex::IntVect& By_stag = Bmf[0][1]->ixType().toIntVect(); + const amrex::IntVect& Bz_stag = Bmf[0][2]->ixType().toIntVect(); + + const amrex::IntVect& Ex_stag = Emf[0][0]->ixType().toIntVect(); + const amrex::IntVect& Ey_stag = Emf[0][1]->ixType().toIntVect(); + const amrex::IntVect& Ez_stag = Emf[0][2]->ixType().toIntVect(); // For level 0, we only need to do the average. #ifdef AMREX_USE_OMP @@ -60,16 +65,16 @@ WarpX::UpdateAuxilaryDataStagToNodal () Array4<Real> const& bx_aux = Bfield_aux[0][0]->array(mfi); Array4<Real> const& by_aux = Bfield_aux[0][1]->array(mfi); Array4<Real> const& bz_aux = Bfield_aux[0][2]->array(mfi); - Array4<Real const> const& bx_fp = Bfield_fp[0][0]->const_array(mfi); - Array4<Real const> const& by_fp = Bfield_fp[0][1]->const_array(mfi); - Array4<Real const> const& bz_fp = Bfield_fp[0][2]->const_array(mfi); + Array4<Real const> const& bx_fp = Bmf[0][0]->const_array(mfi); + Array4<Real const> const& by_fp = Bmf[0][1]->const_array(mfi); + Array4<Real const> const& bz_fp = Bmf[0][2]->const_array(mfi); Array4<Real> const& ex_aux = Efield_aux[0][0]->array(mfi); Array4<Real> const& ey_aux = Efield_aux[0][1]->array(mfi); Array4<Real> const& ez_aux = Efield_aux[0][2]->array(mfi); - Array4<Real const> const& ex_fp = Efield_fp[0][0]->const_array(mfi); - Array4<Real const> const& ey_fp = Efield_fp[0][1]->const_array(mfi); - Array4<Real const> const& ez_fp = Efield_fp[0][2]->const_array(mfi); + Array4<Real const> const& ex_fp = Emf[0][0]->const_array(mfi); + Array4<Real const> const& ey_fp = Emf[0][1]->const_array(mfi); + Array4<Real const> const& ez_fp = Emf[0][2]->const_array(mfi); // Loop over full box including ghost cells // (input arrays will be padded with zeros beyond ghost cells |