Skip to content
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

Allows reading laser envelope from Wake-T #356

Open
wants to merge 4 commits into
base: development
Choose a base branch
from

Conversation

delaossa
Copy link
Contributor

@delaossa delaossa commented Feb 14, 2025

Reading Wake-T files with FromOpenPMDProfile was not working well.
This PR includes a patch to make it work.
It may serve as a basis to discuss a better and more general implementation of FromOpenPMDProfile and FromArrayProfile classes.

  • A first issue was in the way that this method access the angularFrequency attribute in the hdf5 file, which is very specific for LASY envelope files only. Now, a new variable is_waket can be passed to FromOpenPMDProfile to read the Wake-T file. We should generalize the method. In the meantime this serves as a patch.
  • Second issue was in the parent class FromArrayProfile, which still treated the field array as 2D in some cases. This PR implement that the field array is always 3D.
  • A third and separate issue is on the way the laser angularFrequency is calculated when reading from a non-envelope laser file, such as the ones provided by FBPIC. In these cases, FromOpenPMDProfile obtains the central frequency with the field_to_envelope method. However, I have observed non-sensical values of this parameter. This affected the vector potential, a, to electric field, E, envelope transformation when reading Wake-T files, which needs the right value for the central angular frequency of the laser.
  • To allow for a proper a to E transformation when reading from Wake-T envelope files, and to circumvent the problem on the previous point, this PR allows lambda0 to be passed directly to FromOpenPMDProfile, so this value will be used instead of the one calculated by field_to_envelope.

@delaossa delaossa requested a review from MaxThevenet February 14, 2025 11:05
Copy link
Contributor

@MaxThevenet MaxThevenet left a comment

Choose a reason for hiding this comment

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

Thanks for this PR! See comments below.

@@ -68,29 +68,32 @@ def __init__(self, wavelength, pol, array, dim, axes, axes_order=["x", "y", "t"]
)
else: # dim = "rt"
assert axes_order in [["r", "t"], ["t", "r"]]
assert len(array.shape) == 3, "Field array is not 3D."
Copy link
Contributor

Choose a reason for hiding this comment

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

With these changes, can we still read FBPIC output successfully? And use lasy as we do for the FBPIC-Wake-T handshake?

@@ -75,8 +79,10 @@ def __init__(
field,
coord=None,
is_envelope=None,
is_waket=None,
Copy link
Contributor

Choose a reason for hiding this comment

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

For the record: we do this at the moment, but before the next release we need to make sure the code work without such a specific option.

else:
s = io.Series(path + "/" + prefix + "_%T.h5", io.Access.read_only)
if is_waket:
filepath = path + "/" + prefix + "%T.h5"
Copy link
Contributor

Choose a reason for hiding this comment

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

This maybe should be fixed in Wake-T.

Comment on lines +133 to +134
if field == "a":
array = (m_e * c * omg0 / e) * array
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you use vector_potential_to_field instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants