From 044344d7dd0fe44a9ed9ba06f4edffbd64a64b8c Mon Sep 17 00:00:00 2001 From: MaxThevenet Date: Mon, 8 Jul 2019 08:32:26 -0700 Subject: Test implementation for direct deposition order 1 --- Source/Particles/WarpXParticleContainer.cpp | 140 ++++++++++++++++++++++++---- 1 file changed, 123 insertions(+), 17 deletions(-) (limited to 'Source/Particles/WarpXParticleContainer.cpp') diff --git a/Source/Particles/WarpXParticleContainer.cpp b/Source/Particles/WarpXParticleContainer.cpp index 95e692c28..829efe53f 100644 --- a/Source/Particles/WarpXParticleContainer.cpp +++ b/Source/Particles/WarpXParticleContainer.cpp @@ -333,6 +333,8 @@ WarpXParticleContainer::DepositCurrent(WarpXParIter& pti, // Lower corner of tile box physical domain const std::array& xyzmin_tile = WarpX::LowerCorner(tilebox, depos_lev); const std::array& xyzmin = xyzmin_tile; + Print()<<" xyzmin_tile "<charge, - &xyzmin[0], &xyzmin[1], &xyzmin[2], - &dt, &dx[0], &dx[1], &dx[2], - &WarpX::nox,&WarpX::noy,&WarpX::noz, &j_is_nodal, - &lvect,&WarpX::current_deposition_algo); + bool use_new = true; + if (use_new){ + Real dxi = 1.0/dx[0]; + Real dzi = 1.0/dx[2]; + Real invvol = dxi*dzi; + Real dts2dx = 0.5*dt*dxi; + Real dts2dz = 0.5*dt*dzi; + Real clightsq = 1.0/PhysConst::c/PhysConst::c; + Real c = PhysConst::c; + + Real xmin = xyzmin[0]; + Real zmin = xyzmin[2]; + Real q = this->charge; + Real stagger_shift = j_is_nodal ? 0.0 : 0.5; + Print()<<"xmin "<array(pti); + auto jy_arr = jy->array(pti); + auto jz_arr = jz->array(pti); + + // auto const& jx_arr = jx->array(); + // auto const& jy_arr = jy->array(); + // auto const& jz_arr = jz->array(); + + // - momenta are stored as a struct of array, in `attribs` + auto& attribs = pti.GetAttribs(); + Real* AMREX_RESTRICT uxp = attribs[PIdx::ux].dataPtr(); + Real* AMREX_RESTRICT uyp = attribs[PIdx::uy].dataPtr(); + Real* AMREX_RESTRICT uzp = attribs[PIdx::uz].dataPtr(); + Real* AMREX_RESTRICT w = attribs[PIdx::w ].dataPtr(); + Cuda::ManagedDeviceVector Vx, Vy, Vz; + pti.GetPosition(Vx, Vy, Vz); + Real* AMREX_RESTRICT xp = Vx.dataPtr() + offset; + // Real* AMREX_RESTRICT yp = y.dataPtr(); + Real* AMREX_RESTRICT zp = Vz.dataPtr() + offset; + // Loop over the particles and convert momentum + // const long np = pti.numParticles(); + Print()<<"np_to_depose "<charge, + &xyzmin[0], &xyzmin[1], &xyzmin[2], + &dt, &dx[0], &dx[1], &dx[2], + &WarpX::nox,&WarpX::noy,&WarpX::noz, &j_is_nodal, + &lvect,&WarpX::current_deposition_algo); + } #ifdef WARPX_RZ warpx_current_deposition_rz_volume_scaling( jx_ptr, &ngJ, jxntot.getVect(), -- cgit v1.2.3