diff options
Diffstat (limited to 'Source/Utils/WarpXMovingWindow.cpp')
-rw-r--r-- | Source/Utils/WarpXMovingWindow.cpp | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/Source/Utils/WarpXMovingWindow.cpp b/Source/Utils/WarpXMovingWindow.cpp index 600ad180e..3bb48d1a5 100644 --- a/Source/Utils/WarpXMovingWindow.cpp +++ b/Source/Utils/WarpXMovingWindow.cpp @@ -63,6 +63,12 @@ WarpX::UpdatePlasmaInjectionPosition (amrex::Real a_dt) // This needs to be converted in order to index `boost_direction` // which has 3 components, for both 2D and 3D simulations. WarpX::boost_direction[2*dir] * PhysConst::c * a_dt; +#elif ( AMREX_SPACEDIM == 1 ) + // In 1D, dir=0 corresponds to z + // This needs to be converted in order to index `boost_direction` + // which has 3 components, for 1D, 2D, and 3D simulations. + WarpX::boost_direction[2] * PhysConst::c * a_dt; + amrex::ignore_unused(dir); #endif } } @@ -365,13 +371,20 @@ WarpX::shiftMF (amrex::MultiFab& mf, const amrex::Geometry& geom, int num_shift, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) noexcept { // Compute x,y,z co-ordinates based on index type of mf +#if (AMREX_SPACEDIM==1) + amrex::Real x = 0.0; + amrex::Real y = 0.0; + amrex::Real fac_z = (1.0 - mf_type[0]) * dx[0]*0.5; + amrex::Real z = i*dx[0] + real_box.lo(0) + fac_z; +#elif (AMREX_SPACEDIM==2) amrex::Real fac_x = (1.0 - mf_type[0]) * dx[0]*0.5; amrex::Real x = i*dx[0] + real_box.lo(0) + fac_x; -#if (AMREX_SPACEDIM==2) amrex::Real y = 0.0; amrex::Real fac_z = (1.0 - mf_type[1]) * dx[1]*0.5; amrex::Real z = j*dx[1] + real_box.lo(1) + fac_z; #else + amrex::Real fac_x = (1.0 - mf_type[0]) * dx[0]*0.5; + amrex::Real x = i*dx[0] + real_box.lo(0) + fac_x; amrex::Real fac_y = (1.0 - mf_type[1]) * dx[1]*0.5; amrex::Real y = j*dx[1] + real_box.lo(1) + fac_y; amrex::Real fac_z = (1.0 - mf_type[2]) * dx[2]*0.5; @@ -417,6 +430,11 @@ WarpX::ShiftGalileanBoundary () m_v_galilean[0]*time_shift, std::numeric_limits<amrex::Real>::quiet_NaN(), m_v_galilean[2]*time_shift }; +#elif (AMREX_SPACEDIM == 1) + m_galilean_shift = { + std::numeric_limits<Real>::quiet_NaN(), + std::numeric_limits<Real>::quiet_NaN(), + m_v_galilean[2]*time_shift }; #endif #if (AMREX_SPACEDIM == 3) @@ -430,8 +448,13 @@ WarpX::ShiftGalileanBoundary () new_hi[0] = current_hi[0] + m_galilean_shift[0]; new_lo[1] = current_lo[1] + m_galilean_shift[2]; new_hi[1] = current_hi[1] + m_galilean_shift[2]; - } - #endif + } +#elif (AMREX_SPACEDIM == 1) + { + new_lo[0] = current_lo[0] + m_galilean_shift[2]; + new_hi[0] = current_hi[0] + m_galilean_shift[2]; + } +#endif time_of_last_gal_shift = cur_time; ResetProbDomain(amrex::RealBox(new_lo, new_hi)); |