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

Implementation of 4th order particle shape beyond implicit solver cases #4706

Merged
merged 5 commits into from
Feb 21, 2024

Conversation

kale-j
Copy link
Contributor

@kale-j kale-j commented Feb 19, 2024

Extension of 4th order particle shape to (hopefully all) other gather and deposition schemes

Motivation:

4th order particle shape improves energy conservation. This can be needed for laser-solid interaction problems if one does not use current filtering, especially if strong magnetic fields are present.

Overview of changes:

  1. Added the 4th order case for Compute_shifted_shape_factor and the gather/deposition routines which were previously missing
  2. Rewrote the 4th order shape factor to have fewer divisions/operations and be stylistically closer to the other cases. The new version is mathematically equivalent to the earlier version written by Justin Angus. The new version comes more-or-less directly from the pic code epoch
  3. Added a test that includes 4th order particle shape to the regression testing suite

Benchmarking done:

  1. Verified that this branch produces identical results as development for the regression test ImplicitPicard_VandB_2d, when particle_shape=4 is used
  2. Verified that warpx produces the same energy conservation/growth rates as epoch for a few different stable and unstable test cases (epoch corresponds to energy-conserving gather with galerkin_scheme=0 and esirkepov deposition)

Notes:

  1. The choice of test problem was somewhat arbitrary, motivated by 1) including a check on charge conservation, and 2) trying to keep the the test cheap
  2. Disclaimer: although I checked that this branch works with a variety of gather/deposition scenarios (including the default energy-conserving case), it's possible I may have missed some

kweic and others added 4 commits February 19, 2024 11:19
Modified shape factors written for Villasenor algorithm to use simpler (mathematically equivalent) expressions
Added test for particle_shape=4
Choice of 2d Langmuir wave case is based on cost (resolution would need to be increased relative to existing 3d tests)

Fixed bugs related to rebase
Removed tabs that did not properly convert to whitespace
@ax3l ax3l added the component: core Core WarpX functionality label Feb 20, 2024
Copy link
Member

@ax3l ax3l left a comment

Choose a reason for hiding this comment

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

This looks great to me, thank you!

I let @JustinRayAngus also take a 2nd look and then we can merge :)

@kale-j
Copy link
Contributor Author

kale-j commented Feb 20, 2024

Sounds good -- happy to see this finally get off my personal branch

sx[1] = (T(1.0))/(T(24.0))*(T(4.75) - T(11.0)*xint + T(4.0)*xint*xint*(T(1.5) + xint - xint*xint));
sx[2] = (T(1.0))/(T(24.0))*(T(14.375) + T(6.0)*xint*xint*(xint*xint - T(2.5)));
sx[3] = (T(1.0))/(T(24.0))*(T(4.75) + T(11.0)*xint + T(4.0)*xint*xint*(T(1.5) - xint - xint*xint));
sx[4] = (T(1.0))/(T(24.0))*(T(0.5) + xint)*(T(0.5) + xint)*(T(0.5) + xint)*(T(0.5)+xint);
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice!

Copy link
Contributor

@JustinRayAngus JustinRayAngus left a comment

Choose a reason for hiding this comment

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

Looks good to me.

Copy link
Member

@RevathiJambunathan RevathiJambunathan left a comment

Choose a reason for hiding this comment

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

Thank you for this PR!
I left a cosmetic suggestion :)

Co-authored-by: Revathi  Jambunathan <41089244+RevathiJambunathan@users.noreply.github.com>
@ax3l ax3l enabled auto-merge (squash) February 21, 2024 23:19
@ax3l ax3l self-assigned this Feb 21, 2024
@ax3l ax3l merged commit 994fedd into BLAST-WarpX:development Feb 21, 2024
41 checks passed
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