-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reconstruct full 3D fields from cylindrical simulation #232
Conversation
F = cos * F_cos + sin * F_sin | ||
F_total[Nr:, :] = F[:, :] | ||
F_total[:Nr, :] = (-1) ** m * F[::-1, :] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code below is unchanged (just reindented)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow this is pretty cool. In terms of API, I don't have a strong opinion. I think the theta=None
option works. Even though, this in a way then might seem that this is the default behaviour.
Thanks for the feedback. |
This allows
openPMD-viewer
to return a 3D cartesian array, from a file contains thethetaMode
representation of the fields.More specifically,
ts.get_field
will return a numpy 3darray (and correspondinginfo
object) if the user passestheta=None
(note that the default value fortheta
is 0)This feature can be useful for postprocessing operations that are easier on a 3D cartesian grid (e.g. computing the total energy). One of the motivations of this PR is also to allow VisualPIC to work with cylindrical data (including 3D visualization of the fields).
Regarding the implementation:
theta=None
.construct_3d_from_circ
typically dominates the time to get the field. I tried to speed up this function using Cython (see this commit), but this made it 10x slower. I obviously did something wrong but I am not sure what. So in the end, this function remained in Python/Numpy in this PR.