-
Notifications
You must be signed in to change notification settings - Fork 195
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
Add Time-Averaged Field Diagnostics #5285
Add Time-Averaged Field Diagnostics #5285
Conversation
Thanks for making this PR! One complication is that with #5176, adaptive timestepping will be possible. This means that the timestep length can change, so simply summing the multifabs and dividing by the period won't be enough for a proper time average. I don't think addressing this will be too hard, however. |
Thanks, @archermarx! I wasn't aware of that yet. 🙂 We can do a follow-up and catch if |
Yep, my thought exactly. The adaptive timestepping PR was just merged, too. |
I think #5296 should fix the clang-tidy errors that remain, which don't seem related to this PR. |
af628fc
to
822034d
Compare
Thanks for the catch! Please add a runtime assert in this PR now. |
0f8c5e0
to
063f151
Compare
Added commit that will cause the sim to abort when The last thing for this PR that remains from our list is the CI tests. @ax3l, should we also use the recently merged |
Just empirically, I tried this in our Laser-Ion Acceleration example. At step 1000, I compared between the electron density output from the in-situ generated averaged output and a post-processed output that I created from 25 instantaneous outputs. The relative difference is on the order of 1e-16. 🎉 Created with the following input script: |
@n01r @RevathiJambunathan |
@EZoni, the CI tests are still missing. I was thinking of adding these today since Perlmutter is under maintenance anyway. |
@@ -20,3 +30,14 @@ add_warpx_test( | |||
diags/diagInst/ # output | |||
OFF # dependency | |||
) | |||
|
|||
# We do not have an intervals parser for PICMI yet which would accept more than a single integer for the output period |
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.
We should think about implementing an intervals parser for our PICMI diagnostics which can handle more than a single integer. It should be able to do the same as our app input: https://warpx.readthedocs.io/en/latest/usage/parameters.html#intervals-parser
- Implement warnings and errors for certain inputs concerning averaging periods
- added first documentation on time averaged diags - put more operations on summation multifabs into if-environments
Even though the laser ion test is named as a dependency it is running this test again. That should ideally be avoided. It would be good to just run the analysis script as test.
bf71c29
to
171ce3c
Compare
for more information, see https://pre-commit.ci
@EZoni, feel free to review :) |
For PICMI, the TimeAveragedDiag test is automatically disabled because we cannot simply define the necessary output intervals. We need to be able to define period=[100,69:100] like for the app input.
5979cc4
to
22bc9a9
Compare
for more information, see https://pre-commit.ci
Examples/Physics_applications/laser_ion/analysis_test_laser_ion.py
Outdated
Show resolved
Hide resolved
Examples/Physics_applications/laser_ion/analysis_test_laser_ion.py
Outdated
Show resolved
Hide resolved
Modify checksum evaluation call to follow example from PR ECP-WarpX#5297. Co-authored-by: Edoardo Zoni <[email protected]>
for more information, see https://pre-commit.ci
@n01r |
Sounds good to me, @EZoni :) |
I guess this (in the PR description) isn't a problem anymore, right?
|
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.
Thanks for this PR, looks great to me, and it's being thoroughly tested with your simulations. I left only a few minor comments.
Examples/Physics_applications/laser_ion/analysis_test_laser_ion.py
Outdated
Show resolved
Hide resolved
@@ -266,6 +270,12 @@ protected: | |||
* The second vector is loops over the total number of levels. | |||
*/ | |||
amrex::Vector< amrex::Vector< amrex::MultiFab > > m_mf_output; | |||
/** summation multifab, where all fields (computed, cell-centered, and stacked) | |||
* are summed for every step in a time averaging period. | |||
* The first vector is for total number of snapshots. (=1 for FullDiagnostics) |
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.
Just checking, =1
in this comment means something like "only one element"? If so (that is, if 1
does not refer to the index to be used to access that vector layer), a more verbose description might be clearer.
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.
Unsure. I think @RevathiJambunathan may have added/suggested this comment.
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.
Actually, that was copy-pasted and then modified from the comment of the m_mf_output
above.
We could consider making this in all the places where it appears in this file.
But a separate PR would probably be better for this.
Oh, yea. That is not a thing anymore. |
Co-authored-by: Edoardo Zoni <[email protected]>
Co-authored-by: Edoardo Zoni <[email protected]>
Updating the relative tolerance to 1e-12 to keep it strict because the test compares two diagnostics that come from the same run on the same machine, just that one averaging happens in-situ while the other is done in post-processing. Co-authored-by: Edoardo Zoni <[email protected]>
Thanks! If possible, I would suggest that we track the work planned for follow-up PRs in an issue, just so we don't forget. |
Thanks, as you prefer. I think #5165 will be closed automatically because this PR is linked. You can either reopen that one after the PR is merged or open a new issue for follow-up work, as you prefer. |
This PR adds time-averaged field diagnostics to the WarpX output
Currently, compiling for GPU creates a linking error. We would like to see the CI output to possibly find the issue.
Hence, we do not flag this as WIP right now.
This PR is based on work performed during the 2024 WarpX Refactoring Hackathon and was created together with @RevathiJambunathan. 🙂
Successfully merging this pull request may close #5165.