Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Source/Particles/WarpXParticleContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ WarpXParticleContainer::AddNParticles (int /*lev*/, long n,
r[i-ibegin] = std::sqrt(x[i]*x[i] + y[i]*y[i] + z[i]*z[i]);
theta[i-ibegin] = std::atan2(y[i], x[i]);
const amrex::ParticleReal rxy = std::sqrt(x[i]*x[i] + y[i]*y[i]);
phi[i-ibegin] = std::atan2(rxy, r[i-ibegin]);
phi[i-ibegin] = std::atan2(z[i], rxy);
#endif
}

Expand All @@ -274,7 +274,7 @@ WarpXParticleContainer::AddNParticles (int /*lev*/, long n,
amrex::ignore_unused(x,y);
pinned_tile.push_back_real(PIdx::z, z.data() + ibegin, z.data() + iend);
#elif defined(WARPX_DIM_RCYLINDER) || defined(WARPX_DIM_RSPHERE)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section should be:

#elif defined(WARPX_DIM_RCYLINDER) || defined(WARPX_DIM_RSPHERE)
    pinned_tile.push_back_real(PIdx::r, r.data(), r.data() + np);
    amrex::ignore_unused(y,z);
#endif

The same line works for both sphere and cylinder.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks! Updated to use the computed radial coordinate r for both RCYLINDER and RSPHERE.

pinned_tile.push_back_real(PIdx::r, x.data() + ibegin, x.data() + iend);
pinned_tile.push_back_real(PIdx::r, r.data(), r.data() + np);
amrex::ignore_unused(y,z);
#endif

Expand Down
Loading