From 727ebf6b085d58223033f235faebc1b7cd9a0b59 Mon Sep 17 00:00:00 2001 From: Luca Fedeli Date: Mon, 26 Aug 2019 17:35:56 +0200 Subject: Fixed issues due to merge with dev --- Source/Particles/PhotonParticleContainer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Source/Particles/PhotonParticleContainer.cpp') diff --git a/Source/Particles/PhotonParticleContainer.cpp b/Source/Particles/PhotonParticleContainer.cpp index b4070a773..670f091d0 100644 --- a/Source/Particles/PhotonParticleContainer.cpp +++ b/Source/Particles/PhotonParticleContainer.cpp @@ -22,7 +22,7 @@ PhotonParticleContainer::PhotonParticleContainer (AmrCore* amr_core, int ispecie // where is the name of your species ParmParse pp(species_name); - // read .size_in_inches in the input file, and + // read .size_in_inches in the input file, and // store it into member data. pp.query("size_in_inches", size_in_inches); @@ -56,7 +56,7 @@ PhotonParticleContainer::PushPX(WarpXParIter& pti, auto& Byp = attribs[PIdx::By]; auto& Bzp = attribs[PIdx::Bz]; const long np = pti.numParticles(); - + // Probably want to push photons in some way here. // PhysicalParticleContainer::PushPX is probably // a good start. Let's start by writing CPU code. @@ -77,7 +77,7 @@ PhotonParticleContainer::Evolve (int lev, Real t, Real dt) { // This does gather, push and depose. - // Push and depose have been re-written for photon, + // Push and depose have been re-written for photon, // so they do not do anything. // Currently, I guess photons do gather fields from the mesh. PhysicalParticleContainer::Evolve (lev, -- cgit v1.2.3 From 4c2c9f149dffcd7943db92444490ade82ae47b67 Mon Sep 17 00:00:00 2001 From: Luca Date: Thu, 29 Aug 2019 03:23:02 +0200 Subject: Updated PushPX routine --- Source/Particles/PhotonParticleContainer.cpp | 46 +++++++++++++++++++--------- 1 file changed, 31 insertions(+), 15 deletions(-) (limited to 'Source/Particles/PhotonParticleContainer.cpp') diff --git a/Source/Particles/PhotonParticleContainer.cpp b/Source/Particles/PhotonParticleContainer.cpp index 670f091d0..5c84f8199 100644 --- a/Source/Particles/PhotonParticleContainer.cpp +++ b/Source/Particles/PhotonParticleContainer.cpp @@ -11,6 +11,9 @@ #include #include +// Import low-level single-particle kernels +#include + using namespace amrex; PhotonParticleContainer::PhotonParticleContainer (AmrCore* amr_core, int ispecies, @@ -44,25 +47,38 @@ PhotonParticleContainer::PushPX(WarpXParIter& pti, Cuda::ManagedDeviceVector& giv, Real dt) { - // This wraps the call to warpx_particle_pusher so that inheritors can modify the call. + // This wraps the momentum and position advance so that inheritors can modify the call. auto& attribs = pti.GetAttribs(); - auto& uxp = attribs[PIdx::ux]; - auto& uyp = attribs[PIdx::uy]; - auto& uzp = attribs[PIdx::uz]; - auto& Exp = attribs[PIdx::Ex]; - auto& Eyp = attribs[PIdx::Ey]; - auto& Ezp = attribs[PIdx::Ez]; - auto& Bxp = attribs[PIdx::Bx]; - auto& Byp = attribs[PIdx::By]; - auto& Bzp = attribs[PIdx::Bz]; - const long np = pti.numParticles(); + // Extract pointers to the different particle quantities + Real* const AMREX_RESTRICT x = xp.dataPtr(); + Real* const AMREX_RESTRICT y = yp.dataPtr(); + Real* const AMREX_RESTRICT z = zp.dataPtr(); + Real* const AMREX_RESTRICT gi = giv.dataPtr(); + Real* const AMREX_RESTRICT ux = attribs[PIdx::ux].dataPtr(); + Real* const AMREX_RESTRICT uy = attribs[PIdx::uy].dataPtr(); + Real* const AMREX_RESTRICT uz = attribs[PIdx::uz].dataPtr(); + const Real* const AMREX_RESTRICT Ex = attribs[PIdx::Ex].dataPtr(); + const Real* const AMREX_RESTRICT Ey = attribs[PIdx::Ey].dataPtr(); + const Real* const AMREX_RESTRICT Ez = attribs[PIdx::Ez].dataPtr(); + const Real* const AMREX_RESTRICT Bx = attribs[PIdx::Bx].dataPtr(); + const Real* const AMREX_RESTRICT By = attribs[PIdx::By].dataPtr(); + const Real* const AMREX_RESTRICT Bz = attribs[PIdx::Bz].dataPtr(); - // Probably want to push photons in some way here. - // PhysicalParticleContainer::PushPX is probably - // a good start. Let's start by writing CPU code. - for (WarpXParIter pti(*this, 0); pti.isValid(); ++pti) + if (WarpX::do_boosted_frame_diagnostic && do_boosted_frame_diags) { + copy_attribs(pti, x, y, z); } + + //No need to update momentum for photons (now) + + amrex::ParallelFor( + pti.numParticles(), + [=] AMREX_GPU_DEVICE (long i) { + + UpdatePositionPhoton( x[i], y[i], z[i], + ux[i], uy[i], uz[i], dt ); + } + ); } void -- cgit v1.2.3 From 3992ec8b1de4c38b100e1b01360ae41836e5a413 Mon Sep 17 00:00:00 2001 From: Luca Fedeli Date: Thu, 29 Aug 2019 17:51:28 +0200 Subject: Added some comments --- Source/Particles/PhotonParticleContainer.H | 3 ++- Source/Particles/PhotonParticleContainer.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'Source/Particles/PhotonParticleContainer.cpp') diff --git a/Source/Particles/PhotonParticleContainer.H b/Source/Particles/PhotonParticleContainer.H index 3f948271b..1c2c61dac 100644 --- a/Source/Particles/PhotonParticleContainer.H +++ b/Source/Particles/PhotonParticleContainer.H @@ -48,7 +48,7 @@ public: - + // DepositCurrent should do nothing for photons virtual void DepositCurrent(WarpXParIter& pti, RealVector& wp, RealVector& uxp, @@ -65,6 +65,7 @@ public: int depos_lev, amrex::Real dt) override {}; + // DepositCurrentFortran should do nothing for photons virtual void DepositCurrentFortran(WarpXParIter& pti, RealVector& wp, RealVector& uxp, diff --git a/Source/Particles/PhotonParticleContainer.cpp b/Source/Particles/PhotonParticleContainer.cpp index 5c84f8199..64b2e0095 100644 --- a/Source/Particles/PhotonParticleContainer.cpp +++ b/Source/Particles/PhotonParticleContainer.cpp @@ -69,7 +69,7 @@ PhotonParticleContainer::PushPX(WarpXParIter& pti, copy_attribs(pti, x, y, z); } - //No need to update momentum for photons (now) + //No need to update momentum for photons (for now) amrex::ParallelFor( pti.numParticles(), -- cgit v1.2.3 From 0b2df2923cb1c4bafa95e3ddd5f22bc5681ddb32 Mon Sep 17 00:00:00 2001 From: MaxThevenet Date: Thu, 5 Sep 2019 09:39:13 -0700 Subject: add newline at end of file --- Source/Particles/PhotonParticleContainer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Particles/PhotonParticleContainer.cpp') diff --git a/Source/Particles/PhotonParticleContainer.cpp b/Source/Particles/PhotonParticleContainer.cpp index 326f756b1..61e602ffb 100644 --- a/Source/Particles/PhotonParticleContainer.cpp +++ b/Source/Particles/PhotonParticleContainer.cpp @@ -111,4 +111,4 @@ PhotonParticleContainer::Evolve (int lev, cBx, cBy, cBz, t, dt); -} \ No newline at end of file +} -- cgit v1.2.3