From 32cafef475cc6c162b4b1eb94aa83c433ef4ab9d Mon Sep 17 00:00:00 2001 From: RevathiJambunathan Date: Mon, 14 Oct 2019 16:25:38 -0700 Subject: Adding documentation for the particle_slice_width_lab input --- Docs/source/running_cpp/parameters.rst | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Docs/source/running_cpp') diff --git a/Docs/source/running_cpp/parameters.rst b/Docs/source/running_cpp/parameters.rst index 9912a352d..f649b3194 100644 --- a/Docs/source/running_cpp/parameters.rst +++ b/Docs/source/running_cpp/parameters.rst @@ -848,6 +848,13 @@ Diagnostics and output The time interval between the back-transformed reduced diagnostics (where this time interval is expressed in the laboratory frame). +* ``slice.particle_slice_width_lab`` (`float`, in meters) + Only used when ``warpx.do_boosted_frame_diagnostic`` is ``1`` and + ``slice.num_slice_snapshots_lab`` is non-zero. Particles are + copied from the full back-transformed diagnostic to the reduced + slice diagnostic if there are within the user-defined width from + the slice region defined by ``slice.dom_lo`` and ``slice.dom_hi``. + Checkpoints and restart ----------------------- WarpX supports checkpoints/restart via AMReX. -- cgit v1.2.3 From f2d444a547875e6ac526d9d0200d03cbf1a274ac Mon Sep 17 00:00:00 2001 From: RevathiJambunathan Date: Mon, 14 Oct 2019 16:34:25 -0700 Subject: fixing EOL whitespace --- Docs/source/running_cpp/parameters.rst | 2 +- Source/Diagnostics/BoostedFrameDiagnostic.H | 2 +- Source/Diagnostics/BoostedFrameDiagnostic.cpp | 60 +++++++++++++------------- Source/Particles/PhysicalParticleContainer.cpp | 44 +++++++++---------- 4 files changed, 54 insertions(+), 54 deletions(-) (limited to 'Docs/source/running_cpp') diff --git a/Docs/source/running_cpp/parameters.rst b/Docs/source/running_cpp/parameters.rst index f649b3194..7bd22551f 100644 --- a/Docs/source/running_cpp/parameters.rst +++ b/Docs/source/running_cpp/parameters.rst @@ -853,7 +853,7 @@ Diagnostics and output ``slice.num_slice_snapshots_lab`` is non-zero. Particles are copied from the full back-transformed diagnostic to the reduced slice diagnostic if there are within the user-defined width from - the slice region defined by ``slice.dom_lo`` and ``slice.dom_hi``. + the slice region defined by ``slice.dom_lo`` and ``slice.dom_hi``. Checkpoints and restart ----------------------- diff --git a/Source/Diagnostics/BoostedFrameDiagnostic.H b/Source/Diagnostics/BoostedFrameDiagnostic.H index 87cf3085f..2d205b036 100644 --- a/Source/Diagnostics/BoostedFrameDiagnostic.H +++ b/Source/Diagnostics/BoostedFrameDiagnostic.H @@ -176,7 +176,7 @@ public: int N_slice_snapshots, amrex::Real gamma_boost, amrex::Real t_boost, amrex::Real dt_boost, int boost_direction, const amrex::Geometry& geom, - amrex::RealBox& slice_realbox, + amrex::RealBox& slice_realbox, amrex::Real particle_slice_width_lab); /// Flush() is called at the end of the simulation when the buffers that contain diff --git a/Source/Diagnostics/BoostedFrameDiagnostic.cpp b/Source/Diagnostics/BoostedFrameDiagnostic.cpp index 326fe8d0e..129a547e6 100644 --- a/Source/Diagnostics/BoostedFrameDiagnostic.cpp +++ b/Source/Diagnostics/BoostedFrameDiagnostic.cpp @@ -1378,38 +1378,38 @@ AddPartDataToParticleBuffer( auto np = tmp_particle_buffer[isp].GetRealData(DiagIdx::w).size(); if (np == 0) return; - // allocate size of particle buffer array to np + // allocate size of particle buffer array to np particles_buffer_[isp].resize(np); // Data pointers to particle attributes // - Real* const AMREX_RESTRICT wp_buff = + Real* const AMREX_RESTRICT wp_buff = particles_buffer_[isp].GetRealData(DiagIdx::w).data(); - Real* const AMREX_RESTRICT x_buff = + Real* const AMREX_RESTRICT x_buff = particles_buffer_[isp].GetRealData(DiagIdx::x).data(); - Real* const AMREX_RESTRICT y_buff = + Real* const AMREX_RESTRICT y_buff = particles_buffer_[isp].GetRealData(DiagIdx::y).data(); - Real* const AMREX_RESTRICT z_buff = + Real* const AMREX_RESTRICT z_buff = particles_buffer_[isp].GetRealData(DiagIdx::z).data(); - Real* const AMREX_RESTRICT ux_buff = + Real* const AMREX_RESTRICT ux_buff = particles_buffer_[isp].GetRealData(DiagIdx::ux).data(); - Real* const AMREX_RESTRICT uy_buff = + Real* const AMREX_RESTRICT uy_buff = particles_buffer_[isp].GetRealData(DiagIdx::uy).data(); - Real* const AMREX_RESTRICT uz_buff = + Real* const AMREX_RESTRICT uz_buff = particles_buffer_[isp].GetRealData(DiagIdx::uz).data(); - - Real* const AMREX_RESTRICT wp_temp = + + Real* const AMREX_RESTRICT wp_temp = tmp_particle_buffer[isp].GetRealData(DiagIdx::w).data(); - Real* const AMREX_RESTRICT x_temp = + Real* const AMREX_RESTRICT x_temp = tmp_particle_buffer[isp].GetRealData(DiagIdx::x).data(); - Real* const AMREX_RESTRICT y_temp = + Real* const AMREX_RESTRICT y_temp = tmp_particle_buffer[isp].GetRealData(DiagIdx::y).data(); - Real* const AMREX_RESTRICT z_temp = + Real* const AMREX_RESTRICT z_temp = tmp_particle_buffer[isp].GetRealData(DiagIdx::z).data(); - Real* const AMREX_RESTRICT ux_temp = + Real* const AMREX_RESTRICT ux_temp = tmp_particle_buffer[isp].GetRealData(DiagIdx::ux).data(); - Real* const AMREX_RESTRICT uy_temp = + Real* const AMREX_RESTRICT uy_temp = tmp_particle_buffer[isp].GetRealData(DiagIdx::uy).data(); - Real* const AMREX_RESTRICT uz_temp = + Real* const AMREX_RESTRICT uz_temp = tmp_particle_buffer[isp].GetRealData(DiagIdx::uz).data(); // copy all the particles from tmp to buffer @@ -1422,7 +1422,7 @@ AddPartDataToParticleBuffer( z_buff[i] = z_temp[i]; ux_buff[i] = ux_temp[i]; uy_buff[i] = uy_temp[i]; - uz_buff[i] = uz_temp[i]; + uz_buff[i] = uz_temp[i]; }); } } @@ -1438,23 +1438,23 @@ AddPartDataToParticleBuffer( auto np = tmp_particle_buffer[isp].GetRealData(DiagIdx::w).size(); if (np == 0) return; - - Real* const AMREX_RESTRICT wp_temp = + + Real* const AMREX_RESTRICT wp_temp = tmp_particle_buffer[isp].GetRealData(DiagIdx::w).data(); - Real* const AMREX_RESTRICT x_temp = + Real* const AMREX_RESTRICT x_temp = tmp_particle_buffer[isp].GetRealData(DiagIdx::x).data(); - Real* const AMREX_RESTRICT y_temp = + Real* const AMREX_RESTRICT y_temp = tmp_particle_buffer[isp].GetRealData(DiagIdx::y).data(); - Real* const AMREX_RESTRICT z_temp = + Real* const AMREX_RESTRICT z_temp = tmp_particle_buffer[isp].GetRealData(DiagIdx::z).data(); - Real* const AMREX_RESTRICT ux_temp = + Real* const AMREX_RESTRICT ux_temp = tmp_particle_buffer[isp].GetRealData(DiagIdx::ux).data(); - Real* const AMREX_RESTRICT uy_temp = + Real* const AMREX_RESTRICT uy_temp = tmp_particle_buffer[isp].GetRealData(DiagIdx::uy).data(); - Real* const AMREX_RESTRICT uz_temp = + Real* const AMREX_RESTRICT uz_temp = tmp_particle_buffer[isp].GetRealData(DiagIdx::uz).data(); - // temporary arrays to store copy_flag and copy_index + // temporary arrays to store copy_flag and copy_index // for particles that cross the reduced domain for diagnostics. amrex::Gpu::ManagedDeviceVector FlagForPartCopy(np); amrex::Gpu::ManagedDeviceVector IndexForPartCopy(np); @@ -1467,11 +1467,11 @@ AddPartDataToParticleBuffer( [=] AMREX_GPU_DEVICE(int i) { Flag[i] = 0; - if ( x_temp[i] >= (diag_domain_lab_.lo(0)-particle_slice_dx_lab_) && + if ( x_temp[i] >= (diag_domain_lab_.lo(0)-particle_slice_dx_lab_) && x_temp[i] <= (diag_domain_lab_.hi(0)+particle_slice_dx_lab_) ) { #if (AMREX_SPACEDIM == 3) if (y_temp[i] >= (diag_domain_lab_.lo(1)-particle_slice_dx_lab_) && - y_temp[i] <= (diag_domain_lab_.hi(1)+particle_slice_dx_lab_) ) + y_temp[i] <= (diag_domain_lab_.hi(1)+particle_slice_dx_lab_) ) #endif { Flag[i] = 1; @@ -1504,12 +1504,12 @@ AddPartDataToParticleBuffer( Real* const AMREX_RESTRICT uz_buff = particles_buffer_[isp].GetRealData(DiagIdx::uz).data(); - // Copy particle data from tmp array to reduced buffer array + // Copy particle data from tmp array to reduced buffer array // on the GPU using the flag value and index location. amrex::ParallelFor(np, [=] AMREX_GPU_DEVICE(int i) { - if (Flag[i] == 1) + if (Flag[i] == 1) { int loc = IndexLocation[i]; wp_buff[loc] = wp_temp[i]; diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp index 5444de649..9a174befa 100644 --- a/Source/Particles/PhysicalParticleContainer.cpp +++ b/Source/Particles/PhysicalParticleContainer.cpp @@ -1795,7 +1795,7 @@ void PhysicalParticleContainer::GetParticleSlice(const int direction, const Real for (WarpXParIter pti(*this, lev); pti.isValid(); ++pti) { - int counter_for_ParticleCopy = 0; + int counter_for_ParticleCopy = 0; const Box& box = pti.validbox(); auto index = std::make_pair(pti.index(), pti.LocalTileIndex()); const RealBox tile_real_box(box, dx, plo); @@ -1813,17 +1813,17 @@ void PhysicalParticleContainer::GetParticleSlice(const int direction, const Real Real* const AMREX_RESTRICT uypnew = attribs[PIdx::uy].dataPtr(); Real* const AMREX_RESTRICT uzpnew = attribs[PIdx::uz].dataPtr(); - Real* const AMREX_RESTRICT + Real* const AMREX_RESTRICT xpold = tmp_particle_data[lev][index][TmpIdx::xold].dataPtr(); Real* const AMREX_RESTRICT ypold = tmp_particle_data[lev][index][TmpIdx::yold].dataPtr(); - Real* const AMREX_RESTRICT + Real* const AMREX_RESTRICT zpold = tmp_particle_data[lev][index][TmpIdx::zold].dataPtr(); - Real* const AMREX_RESTRICT + Real* const AMREX_RESTRICT uxpold = tmp_particle_data[lev][index][TmpIdx::uxold].dataPtr(); - Real* const AMREX_RESTRICT + Real* const AMREX_RESTRICT uypold = tmp_particle_data[lev][index][TmpIdx::uyold].dataPtr(); - Real* const AMREX_RESTRICT + Real* const AMREX_RESTRICT uzpold = tmp_particle_data[lev][index][TmpIdx::uzold].dataPtr(); const long np = pti.numParticles(); @@ -1831,17 +1831,17 @@ void PhysicalParticleContainer::GetParticleSlice(const int direction, const Real Real uzfrm = -WarpX::gamma_boost*WarpX::beta_boost*PhysConst::c; Real inv_c2 = 1.0/PhysConst::c/PhysConst::c; - // temporary arrays to store copy_flag and copy_index + // temporary arrays to store copy_flag and copy_index // for particles that cross the z-slice amrex::Gpu::ManagedDeviceVector FlagForPartCopy(np); amrex::Gpu::ManagedDeviceVector IndexForPartCopy(np); - int* const AMREX_RESTRICT Flag = FlagForPartCopy.dataPtr(); - int* const AMREX_RESTRICT IndexLocation = IndexForPartCopy.dataPtr(); + int* const AMREX_RESTRICT Flag = FlagForPartCopy.dataPtr(); + int* const AMREX_RESTRICT IndexLocation = IndexForPartCopy.dataPtr(); //Flag particles that need to be copied if they cross the z_slice - amrex::ParallelFor(np, - [=] AMREX_GPU_DEVICE(int i) + amrex::ParallelFor(np, + [=] AMREX_GPU_DEVICE(int i) { Flag[i] = 0; if ( (((zpnew[i] >= z_new) && (zpold[i] <= z_old)) || @@ -1854,7 +1854,7 @@ void PhysicalParticleContainer::GetParticleSlice(const int direction, const Real // exclusive scan to obtain location indices using flag values // These location indices are used to copy data from // src to dst when the copy-flag is set to 1. - amrex::Gpu::exclusive_scan(Flag,Flag+np,IndexLocation); + amrex::Gpu::exclusive_scan(Flag,Flag+np,IndexLocation); int total_partdiag_size = IndexLocation[np-1] + Flag[np-1]; @@ -1865,19 +1865,19 @@ void PhysicalParticleContainer::GetParticleSlice(const int direction, const Real amrex::Real betaboost = WarpX::beta_boost; amrex::Real Phys_c = PhysConst::c; - Real* const AMREX_RESTRICT diag_wp = + Real* const AMREX_RESTRICT diag_wp = diagnostic_particles[lev][index].GetRealData(DiagIdx::w).data(); - Real* const AMREX_RESTRICT diag_xp = + Real* const AMREX_RESTRICT diag_xp = diagnostic_particles[lev][index].GetRealData(DiagIdx::x).data(); - Real* const AMREX_RESTRICT diag_yp = + Real* const AMREX_RESTRICT diag_yp = diagnostic_particles[lev][index].GetRealData(DiagIdx::y).data(); - Real* const AMREX_RESTRICT diag_zp = + Real* const AMREX_RESTRICT diag_zp = diagnostic_particles[lev][index].GetRealData(DiagIdx::z).data(); - Real* const AMREX_RESTRICT diag_uxp = + Real* const AMREX_RESTRICT diag_uxp = diagnostic_particles[lev][index].GetRealData(DiagIdx::ux).data(); - Real* const AMREX_RESTRICT diag_uyp = + Real* const AMREX_RESTRICT diag_uyp = diagnostic_particles[lev][index].GetRealData(DiagIdx::uy).data(); - Real* const AMREX_RESTRICT diag_uzp = + Real* const AMREX_RESTRICT diag_uzp = diagnostic_particles[lev][index].GetRealData(DiagIdx::uz).data(); // Copy particle data to diagnostic particle array on the GPU @@ -1887,7 +1887,7 @@ void PhysicalParticleContainer::GetParticleSlice(const int direction, const Real { if (Flag[i] == 1) { - // Lorentz Transform particles to lab-frame + // Lorentz Transform particles to lab-frame const Real gamma_new_p = std::sqrt(1.0 + inv_c2* (uxpnew[i]*uxpnew[i] + uypnew[i]*uypnew[i] @@ -1927,8 +1927,8 @@ void PhysicalParticleContainer::GetParticleSlice(const int direction, const Real + uypnew[i]*weight_new; const Real uzp = uz_old_p*weight_old + uz_new_p *weight_new; - - int loc = IndexLocation[i]; + + int loc = IndexLocation[i]; diag_wp[loc] = wpnew[i]; diag_xp[loc] = xp; diag_yp[loc] = yp; -- cgit v1.2.3