diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/Evolve/WarpXEvolveES.cpp | 4 | ||||
-rw-r--r-- | Source/FortranInterface/WarpX_f.F90 | 43 | ||||
-rw-r--r-- | Source/FortranInterface/WarpX_f.H | 2 | ||||
-rw-r--r-- | Source/Particles/MultiParticleContainer.H | 9 | ||||
-rw-r--r-- | Source/Particles/MultiParticleContainer.cpp | 8 | ||||
-rw-r--r-- | Source/Particles/WarpXParticleContainer.H | 9 | ||||
-rw-r--r-- | Source/Particles/WarpXParticleContainer.cpp | 31 | ||||
-rw-r--r-- | Source/Particles/push_particles_ES.F90 | 110 |
8 files changed, 3 insertions, 213 deletions
diff --git a/Source/Evolve/WarpXEvolveES.cpp b/Source/Evolve/WarpXEvolveES.cpp index 7d6260bd4..77e037154 100644 --- a/Source/Evolve/WarpXEvolveES.cpp +++ b/Source/Evolve/WarpXEvolveES.cpp @@ -66,7 +66,7 @@ WarpX::EvolveES (int numsteps) { // Beyond one step, particles have p^{n-1/2} and x^{n}. if (is_synchronized) { // on first step, push X by 0.5*dt - mypc->PushXES(0.5*dt[lev]); + mypc->PushX(0.5*dt[lev]); UpdatePlasmaInjectionPosition(0.5*dt[lev]); mypc->Redistribute(); mypc->DepositCharge(rhoNodal); @@ -103,7 +103,7 @@ WarpX::EvolveES (int numsteps) { if (cur_time + dt[0] >= stop_time - 1.e-3*dt[0] || step == numsteps_max-1) { // on last step, push by only 0.5*dt to synchronize all at n+1/2 - mypc->PushXES(-0.5*dt[lev]); + mypc->PushX(-0.5*dt[lev]); UpdatePlasmaInjectionPosition(-0.5*dt[lev]); is_synchronized = true; } diff --git a/Source/FortranInterface/WarpX_f.F90 b/Source/FortranInterface/WarpX_f.F90 index dc78f5039..71b1ae9fa 100644 --- a/Source/FortranInterface/WarpX_f.F90 +++ b/Source/FortranInterface/WarpX_f.F90 @@ -16,49 +16,6 @@ module warpx_module contains - subroutine warpx_compute_E (lo, hi, & - phi, phlo, phhi, & - Ex, Exlo, Exhi, & - Ey, Eylo, Eyhi, & - Ez, Ezlo, Ezhi, & - dx) bind(c,name='warpx_compute_E') - integer(c_int), intent(in) :: lo(3), hi(3), phlo(3), phhi(3), Exlo(3), Exhi(3), & - Eylo(3), Eyhi(3), Ezlo(3), Ezhi(3) - real(amrex_real), intent(in) :: dx(3) - real(amrex_real), intent(in ) :: phi(phlo(1):phhi(1),phlo(2):phhi(2),phlo(3):phhi(3)) - real(amrex_real), intent(inout) :: Ex (Exlo(1):Exhi(1),Exlo(2):Exhi(2),Exlo(3):Exhi(3)) - real(amrex_real), intent(inout) :: Ey (Eylo(1):Eyhi(1),Eylo(2):Eyhi(2),Eylo(3):Eyhi(3)) - real(amrex_real), intent(inout) :: Ez (Ezlo(1):Ezhi(1),Ezlo(2):Ezhi(2),Ezlo(3):Ezhi(3)) - - integer :: i, j, k - real(amrex_real) :: dxinv(3) - - dxinv = 1.0 / dx - - do k = lo(3), hi(3) - do j = lo(2), hi(2) - - do i = lo(1), hi(1)-1 - Ex(i,j,k) = dxinv(1) * (phi(i,j,k) - phi(i+1,j,k)) - end do - - if (j < hi(2)) then - do i = lo(1), hi(1) - Ey(i,j,k) = dxinv(2) * (phi(i,j,k) - phi(i,j+1,k)) - end do - end if - - if (k < hi(3)) then - do i = lo(1), hi(1) - Ez(i,j,k) = dxinv(3) * (phi(i,j,k) - phi(i,j,k+1)) - end do - end if - - end do - end do - - end subroutine warpx_compute_E - subroutine warpx_build_buffer_masks (lo, hi, msk, mlo, mhi, gmsk, glo, ghi, ng) & bind(c, name='warpx_build_buffer_masks') integer, dimension(3), intent(in) :: lo, hi, mlo, mhi, glo, ghi diff --git a/Source/FortranInterface/WarpX_f.H b/Source/FortranInterface/WarpX_f.H index 6a732c4ed..74fd9f379 100644 --- a/Source/FortranInterface/WarpX_f.H +++ b/Source/FortranInterface/WarpX_f.H @@ -34,7 +34,6 @@ #define WRPX_INTERPOLATE_CIC warpx_interpolate_cic_3d #define WRPX_INTERPOLATE_CIC_TWO_LEVELS warpx_interpolate_cic_two_levels_3d #define WRPX_PUSH_LEAPFROG warpx_push_leapfrog_3d -#define WRPX_PUSH_LEAPFROG_POSITIONS warpx_push_leapfrog_positions_3d #elif (AMREX_SPACEDIM == 2) @@ -43,7 +42,6 @@ #define WRPX_INTERPOLATE_CIC warpx_interpolate_cic_2d #define WRPX_INTERPOLATE_CIC_TWO_LEVELS warpx_interpolate_cic_two_levels_2d #define WRPX_PUSH_LEAPFROG warpx_push_leapfrog_2d -#define WRPX_PUSH_LEAPFROG_POSITIONS warpx_push_leapfrog_positions_2d #endif diff --git a/Source/Particles/MultiParticleContainer.H b/Source/Particles/MultiParticleContainer.H index 8dd26ff60..65c13e39b 100644 --- a/Source/Particles/MultiParticleContainer.H +++ b/Source/Particles/MultiParticleContainer.H @@ -92,13 +92,6 @@ public: amrex::Real t, amrex::Real dt); /// - /// This pushes the particle positions by one half time step for all the species in the - /// MultiParticleContainer. It is used to desynchronize the particles after initializaton - /// or when restarting from a checkpoint. This is the electrostatic version. - /// - void PushXES (amrex::Real dt); - - /// /// This deposits the particle charge onto rho, accumulating the value for all the species /// in the MultiParticleContainer. rho is assumed to contain node-centered multifabs. /// This version is hard-coded for CIC deposition. @@ -139,7 +132,7 @@ public: /// /// This pushes the particle positions by one half time step for all the species in the /// MultiParticleContainer. It is used to desynchronize the particles after initializaton - /// or when restarting from a checkpoint. This is the electromagnetic version. + /// or when restarting from a checkpoint. /// void PushX (amrex::Real dt); diff --git a/Source/Particles/MultiParticleContainer.cpp b/Source/Particles/MultiParticleContainer.cpp index bbfdace7f..f9a0d230b 100644 --- a/Source/Particles/MultiParticleContainer.cpp +++ b/Source/Particles/MultiParticleContainer.cpp @@ -312,14 +312,6 @@ MultiParticleContainer::EvolveES (const Vector<std::array<std::unique_ptr<MultiF } void -MultiParticleContainer::PushXES (Real dt) -{ - for (auto& pc : allcontainers) { - pc->PushXES(dt); - } -} - -void MultiParticleContainer:: DepositCharge (Vector<std::unique_ptr<MultiFab> >& rho, bool local) { diff --git a/Source/Particles/WarpXParticleContainer.H b/Source/Particles/WarpXParticleContainer.H index 53ce8d320..19086d1d8 100644 --- a/Source/Particles/WarpXParticleContainer.H +++ b/Source/Particles/WarpXParticleContainer.H @@ -201,15 +201,6 @@ public: /// This pushes the particle positions by one half time step. /// It is used to desynchronize the particles after initializaton /// or when restarting from a checkpoint. - /// This is the electrostatic version of the particle push. - /// - void PushXES (amrex::Real dt); - - /// - /// This pushes the particle positions by one half time step. - /// It is used to desynchronize the particles after initializaton - /// or when restarting from a checkpoint. - /// This is the electromagnetic version of the particle push. /// void PushX ( amrex::Real dt); void PushX (int lev, amrex::Real dt); diff --git a/Source/Particles/WarpXParticleContainer.cpp b/Source/Particles/WarpXParticleContainer.cpp index 9fc69bc73..7628cfd85 100644 --- a/Source/Particles/WarpXParticleContainer.cpp +++ b/Source/Particles/WarpXParticleContainer.cpp @@ -743,37 +743,6 @@ Real WarpXParticleContainer::maxParticleVelocity(bool local) { } void -WarpXParticleContainer::PushXES (Real dt) -{ - BL_PROFILE("WPC::PushXES()"); - - const int num_levels = finestLevel() + 1; - - for (int lev = 0; lev < num_levels; ++lev) { - const auto& gm = m_gdb->Geom(lev); - const RealBox& prob_domain = gm.ProbDomain(); - for (WarpXParIter pti(*this, lev); pti.isValid(); ++pti) { - auto& particles = pti.GetArrayOfStructs(); - int nstride = particles.dataShape().first; - const long np = pti.numParticles(); - - auto& attribs = pti.GetAttribs(); - auto& uxp = attribs[PIdx::ux]; - auto& uyp = attribs[PIdx::uy]; - auto& uzp = attribs[PIdx::uz]; - - WRPX_PUSH_LEAPFROG_POSITIONS(particles.dataPtr(), nstride, np, - uxp.dataPtr(), uyp.dataPtr(), -#if AMREX_SPACEDIM == 3 - uzp.dataPtr(), -#endif - &dt, - prob_domain.lo(), prob_domain.hi()); - } - } -} - -void WarpXParticleContainer::PushX (amrex::Real dt) { const int nLevels = finestLevel(); diff --git a/Source/Particles/push_particles_ES.F90 b/Source/Particles/push_particles_ES.F90 index 60833d456..a22ee5a62 100644 --- a/Source/Particles/push_particles_ES.F90 +++ b/Source/Particles/push_particles_ES.F90 @@ -151,114 +151,4 @@ contains end subroutine warpx_push_leapfrog_2d - -! -! This routine advances the particle positions using the current -! velocity. This is needed to desynchronize the particle positions -! from the velocities after particle initialization. -! -! Arguments: -! particles : a pointer to the particle array-of-structs -! ns : the stride length of particle struct (the size of the struct in number of reals) -! np : the number of particles -! xx_p : the electric field in the x-direction at the particle positions -! vy_p : the electric field in the y-direction at the particle positions -! vz_p : the electric field in the z-direction at the particle positions -! dt : the time step -! prob_lo : the left-hand corner of the problem domain -! prob_hi : the right-hand corner of the problem domain -! - subroutine warpx_push_leapfrog_positions_3d(particles, ns, np, & - vx_p, vy_p, vz_p, dt, & - prob_lo, prob_hi) & - bind(c,name='warpx_push_leapfrog_positions_3d') - integer, value, intent(in) :: ns, np - real(amrex_particle_real), intent(inout) :: particles(ns,np) - real(amrex_particle_real), intent(inout) :: vx_p(np), vy_p(np), vz_p(np) - real(amrex_real), intent(in) :: dt - real(amrex_real), intent(in) :: prob_lo(3), prob_hi(3) - - integer n - - do n = 1, np - - particles(1, n) = particles(1, n) + dt * vx_p(n) - particles(2, n) = particles(2, n) + dt * vy_p(n) - particles(3, n) = particles(3, n) + dt * vz_p(n) - -! bounce off the walls in the x... - do while (particles(1, n) .lt. prob_lo(1) .or. particles(1, n) .gt. prob_hi(1)) - if (particles(1, n) .lt. prob_lo(1)) then - particles(1, n) = 2.d0*prob_lo(1) - particles(1, n) - else - particles(1, n) = 2.d0*prob_hi(1) - particles(1, n) - end if - vx_p(n) = -vx_p(n) - end do - -! ... y... - do while (particles(2, n) .lt. prob_lo(2) .or. particles(2, n) .gt. prob_hi(2)) - if (particles(2, n) .lt. prob_lo(2)) then - particles(2, n) = 2.d0*prob_lo(2) - particles(2, n) - else - particles(2, n) = 2.d0*prob_hi(2) - particles(2, n) - end if - vy_p(n) = -vy_p(n) - end do - -! ... and z directions - do while (particles(3, n) .lt. prob_lo(3) .or. particles(3, n) .gt. prob_hi(3)) - if (particles(3, n) .lt. prob_lo(3)) then - particles(3, n) = 2.d0*prob_lo(3) - particles(3, n) - else - particles(3, n) = 2.d0*prob_hi(3) - particles(3, n) - end if - vz_p(n) = -vz_p(n) - end do - - end do - - end subroutine warpx_push_leapfrog_positions_3d - - subroutine warpx_push_leapfrog_positions_2d(particles, ns, np, & - vx_p, vy_p, dt, & - prob_lo, prob_hi) & - bind(c,name='warpx_push_leapfrog_positions_2d') - integer, value, intent(in) :: ns, np - real(amrex_particle_real), intent(inout) :: particles(ns,np) - real(amrex_particle_real), intent(inout) :: vx_p(np), vy_p(np) - real(amrex_real), intent(in) :: dt - real(amrex_real), intent(in) :: prob_lo(2), prob_hi(2) - - integer n - - do n = 1, np - - particles(1, n) = particles(1, n) + dt * vx_p(n) - particles(2, n) = particles(2, n) + dt * vy_p(n) - -! bounce off the walls in the x... - do while (particles(1, n) .lt. prob_lo(1) .or. particles(1, n) .gt. prob_hi(1)) - if (particles(1, n) .lt. prob_lo(1)) then - particles(1, n) = 2.d0*prob_lo(1) - particles(1, n) - else - particles(1, n) = 2.d0*prob_hi(1) - particles(1, n) - end if - vx_p(n) = -vx_p(n) - end do - -! ... y... - do while (particles(2, n) .lt. prob_lo(2) .or. particles(2, n) .gt. prob_hi(2)) - if (particles(2, n) .lt. prob_lo(2)) then - particles(2, n) = 2.d0*prob_lo(2) - particles(2, n) - else - particles(2, n) = 2.d0*prob_hi(2) - particles(2, n) - end if - vy_p(n) = -vy_p(n) - end do - - end do - - end subroutine warpx_push_leapfrog_positions_2d - end module warpx_ES_push_particles |