diff options
5 files changed, 23 insertions, 15 deletions
diff --git a/Docs/source/usage/parameters.rst b/Docs/source/usage/parameters.rst index 0a12dc82d..5cfc7a421 100644 --- a/Docs/source/usage/parameters.rst +++ b/Docs/source/usage/parameters.rst @@ -2659,7 +2659,8 @@ Reduced Diagnostics to file. The electromagnetic field components are interpolated to the measurement point by default, but can they be saved as non-averaged by setting ``<reduced_diags_name>.raw_fields = true``, in which case the raw fields for the cell - containing the measurement point are saved. + containing the measurement point are saved. In RZ geometry, this only saves the + 0'th azimuthal mode component of the fields. The interpolation order can be set by specifying ``<reduced_diags_name>.interp_order``, otherwise it is set to ``1``. Integrated electric and magnetic field components can instead be obtained by specifying diff --git a/Source/Diagnostics/ReducedDiags/FieldProbe.H b/Source/Diagnostics/ReducedDiags/FieldProbe.H index c7b0a9869..1150137d1 100644 --- a/Source/Diagnostics/ReducedDiags/FieldProbe.H +++ b/Source/Diagnostics/ReducedDiags/FieldProbe.H @@ -66,7 +66,7 @@ public: */ //! noutputs is 11 for particle id + (x, y, z, Ex, Ey, Ez, Bx, By, Bz, S) - static constexpr int noutputs = FieldProbePIdx::nattribs + 3 + 1; + static const int noutputs = 11; private: amrex::Real x_probe = 0._rt; diff --git a/Source/Diagnostics/ReducedDiags/FieldProbe.cpp b/Source/Diagnostics/ReducedDiags/FieldProbe.cpp index 669b18d29..55e5054e0 100644 --- a/Source/Diagnostics/ReducedDiags/FieldProbe.cpp +++ b/Source/Diagnostics/ReducedDiags/FieldProbe.cpp @@ -51,12 +51,6 @@ FieldProbe::FieldProbe (std::string rd_name) : ReducedDiags{rd_name}, m_probe(&WarpX::GetInstance()) { - // RZ coordinate is not working -#if (defined WARPX_DIM_RZ) - WARPX_ALWAYS_ASSERT_WITH_MESSAGE(false, - "FieldProbe reduced diagnostics does not work for RZ coordinate."); -#endif - // read number of levels int nLevel = 0; const amrex::ParmParse pp_amr("amr"); diff --git a/Source/Diagnostics/ReducedDiags/FieldProbeParticleContainer.H b/Source/Diagnostics/ReducedDiags/FieldProbeParticleContainer.H index dbb55fc0a..d658f209c 100644 --- a/Source/Diagnostics/ReducedDiags/FieldProbeParticleContainer.H +++ b/Source/Diagnostics/ReducedDiags/FieldProbeParticleContainer.H @@ -19,13 +19,20 @@ * This enumerated struct is used to index the field probe particle * values that are being stored as SoA data. Nattribs * is enumerated to give the number of attributes stored. + * The strange insertion of `theta` below is due to the use of + * GetParticlePosition for the field probe locations, which reads the probe + * theta value from PIdx::theta = 4. */ struct FieldProbePIdx { enum { Ex = 0, Ey, Ez, - Bx, By, Bz, + Bx, +#ifdef WARPX_DIM_RZ + theta, ///< RZ needs all three position components +#endif + By, Bz, S, //!< the Poynting vector nattribs }; diff --git a/Source/Diagnostics/ReducedDiags/FieldProbeParticleContainer.cpp b/Source/Diagnostics/ReducedDiags/FieldProbeParticleContainer.cpp index 501bfc815..d928bd33f 100644 --- a/Source/Diagnostics/ReducedDiags/FieldProbeParticleContainer.cpp +++ b/Source/Diagnostics/ReducedDiags/FieldProbeParticleContainer.cpp @@ -114,6 +114,7 @@ FieldProbeParticleContainer::AddNParticles (int lev, amrex::ignore_unused(x, y); p.pos(0) = z[i]; #endif + // write position, cpu id, and particle id to particle pinned_tile.push_back(p); } @@ -121,6 +122,11 @@ FieldProbeParticleContainer::AddNParticles (int lev, // write Real attributes (SoA) to particle initialized zero DefineAndReturnParticleTile(0, 0, 0); + // for RZ write theta value +#ifdef WARPX_DIM_RZ + pinned_tile.push_back_real(FieldProbePIdx::theta, np, 0.0); +#endif + pinned_tile.push_back_real(FieldProbePIdx::Ex, np, 0.0); pinned_tile.push_back_real(FieldProbePIdx::Ey, np, 0.0); pinned_tile.push_back_real(FieldProbePIdx::Ez, np, 0.0); @@ -129,16 +135,16 @@ FieldProbeParticleContainer::AddNParticles (int lev, pinned_tile.push_back_real(FieldProbePIdx::Bz, np, 0.0); pinned_tile.push_back_real(FieldProbePIdx::S, np, 0.0); + auto old_np = particle_tile.numParticles(); + auto new_np = old_np + pinned_tile.numParticles(); + particle_tile.resize(new_np); + amrex::copyParticles( + particle_tile, pinned_tile, 0, old_np, pinned_tile.numParticles()); + /* * Redistributes particles to their appropriate tiles if the box * structure of the simulation changes to accomodate data more * efficiently. */ - auto old_np = particle_tile.numParticles(); - auto new_np = old_np + pinned_tile.numParticles(); - particle_tile.resize(new_np); - amrex::copyParticles( - particle_tile, pinned_tile, 0, old_np, pinned_tile.numParticles()); Redistribute(); - } |