Skip to content

Feature lenses x y #4305

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

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

Conversation

RTSandberg
Copy link
Contributor

This PR modifies the periodic plasma lens to allow for separate lens strengths in x and y.

TODO

  • Lenses in x and y
  • Document
  • Test in CI?

@ax3l ax3l requested a review from RemiLehe September 18, 2023 15:38
@ax3l ax3l requested a review from dpgrote September 18, 2023 15:39
@ax3l ax3l added the component: core Core WarpX functionality label Sep 18, 2023
self.warpx_strengths_Bx = warpx_strengths_Bx
self.warpx_strengths_By = warpx_strengths_By

assert (self.strengths_E is not None) or (self.strengths_B is not None)\
Copy link
Member

Choose a reason for hiding this comment

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

This check is not needed here since the same check is done in C++.

pywarpx.particles.repeated_plasma_lens_strengths_E = self.strengths_E
pywarpx.particles.repeated_plasma_lens_strengths_B = self.strengths_B
if self.warpx_strengths_Ex is not None or self.warpx_strengths_Ey is not None:
print('Using Ex and Ey, ignoring \'strengths_E\' if provided',flush=True)
Copy link
Member

@dpgrote dpgrote Sep 19, 2023

Choose a reason for hiding this comment

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

Is this print statement needed, or is this left over from debugging?
BTW, a handy trick in Python is to take advantage of single and double quotes.
print('Using Ex and Ey, ignoring "strengths_E" if provided',flush=True)

Also, the if statement is not needed. The three variables can be directly assigned. Anything set to None is ignored when the parameters are processed.

        pywarpx.particles.repeated_plasma_lens_strengths_Ex = self.warpx_strengths_Ex
        pywarpx.particles.repeated_plasma_lens_strengths_Ey = self.warpx_strengths_Ey
        pywarpx.particles.repeated_plasma_lens_strengths_E = self.strengths_E

And the same for B

@@ -22,25 +22,39 @@ void init_MultiParticleContainer (py::module& m)
)

.def("set_plasma_lens_strength",
Copy link
Member

Choose a reason for hiding this comment

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

There should be two versions of set_plasma_lens_strength, the original one with two arguments and the new one with four.

@RTSandberg
Copy link
Contributor Author

Thanks for your comments @dpgrote ! I haven't finished checking or documenting this and then it fell by the wayside (as happens so often...). Hopefully I get to finishing the test in the near future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: core Core WarpX functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants