-
Notifications
You must be signed in to change notification settings - Fork 191
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
More efficient PML BoxArray #2631
Conversation
If the union of the grids is a single rectangular domain, we can simplify the process and generate more efficient PML BoxArray.
I used the simplified MakeBoxArray function to test #2640 - it seems to work. |
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.
Thank you for this PR, Weiqun! I have tried it locally on one of the test cases that we ran recently and I do not see anymore the small (10x10 in that case) PML box in the middle of the PML grid. So it seems to me that this works! I just left a couple of questions and/or comments. In particular, I think it would be great if we can add a few inline comments to the code, in order to make it a little bit easier to read for everyone.
for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) { | ||
if (do_pml_Lo[idim]){ | ||
domain0.growLo(idim, -ncell); | ||
} | ||
if (do_pml_Hi[idim]){ | ||
domain0.growHi(idim, -ncell); | ||
} |
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.
One question to make sure I understand what is being done here (it wasn't added in this PR, but still I'd like to ask). My understanding is that this is the case where we want the PML to overlap with the last ncell
of the regular domain. Shouldn't we then add ncell
(i.e. grow by +ncell
, instead of -ncell
) to the low index and subtract ncell
from the high index (i.e. grow by -ncell
, as already done here)? If ncell = 10
, the low index would have to be 0
instead of -10
(so -10 + (+ncell) = -10 + (+10) = 0
), such that the PML overlaps with the cells 0:9
of the regular domain rather than spanning the cells -10:-1
outside of the domain. While when I read domain0.growLo(idim, -ncell)
it seems like we are lowering the low index even more. I guess I'm missing either the starting point or what growLo
does precisely. Could you clarify this for me? Thanks!
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.
growLo
means growing in the direction that points to the lo (i.e., -inf) direction.
Co-authored-by: Edoardo Zoni <59625522+EZoni@users.noreply.github.com>
@WeiqunZhang Thank you for adding some comments, they definitely help! |
I think the CI test |
How do we reset the benchmark? I cannot find where the benchmark is stored? |
I think it should be this file here: https://github.com/ECP-WarpX/WarpX/blob/development/Regression/Checksum/benchmarks_json/Python_wrappers.json. |
Oh Thanks! I need to merge development into this to get the new files. |
Thanks @WeiqunZhang. Don't know what's happening with that test but now I see this in the CI log:
I will try to run it locally and see if it crashes there too. In the meantime, @ax3l do you have a guess on why CI is showing up green even if the benchmark regression analysis is failing for this Python test? We should definitely understand why this doesn't show up as red and try to fix it, otherwise it can lead to false positives. |
@EZoni Thank you for looking into this. What's strange is right after the development branch was merged into this there were no NaNs. But NaNs appeared after the commit in which the only change was the json file. |
@WeiqunZhang I ran the test Here's the result I got locally:
|
Python issue: Thanks for catching, there since #2593. X-ref: |
restarting CI |
@WeiqunZhang Hi, would it be possible to rebase on |
- maximum relative error: 2.50e-06 - new implementation: 10 PML grids - old implementation: 24 PML grids
- maximum relative error: 2.73e-04 - new implementation: (18,8,8) PML grids - old implementation: (48,18,18) PML grids
- maximum relative error: 6.44e-05 - new implementation: (2,6,6) PML grids - old implementation: (2,12,12) PML grids
- maximum relative error: 6.84e-04 - new implementation: (10,6,6) PML grids - old implementation: (24,12,12) PML grids
- maximum relative error: 2.55e-04 - new implementation: (18,8,8) PML grids - old implementation: (48,18,18) PML grids
- maximum relative error: 7.43e-04 - new implementation: (10,6,6) PML grids - old implementation: (24,12,12) PML grids
- maximum relative error: 2.41e-05 - new implementation: (6,6,6) PML grids - old implementation: (12,12,12) PML grids
- maximum relative error: 1.32e-01 (B numerical artifact) - new implementation: (0,20,20) PML grids - old implementation: (0,52,40) PML grids
- maximum relative error: 1.05e-01 (B numerical artifact) - new implementation: (0,20,20) PML grids - old implementation: (0,52,40) PML grids
- maximum relative error: 2.73e-04 - new implementation: (18,8,8) PML grids - old implementation: (48,18,18) PML grids
- maximum relative error: 1.07e-08 - new implementation: 8 PML grids - old implementation: 16 PML grids
- maximum relative error: 4.91e-03 - new implementation: 24 PML grids - old implementation: 98 PML grids
@WeiqunZhang I have reset the benchmarks of most CI tests that were failing. Each benchmark reset has a separate commit. Each commit message states the maximum relative error observed on the checksum benchmarks as well as the number of PML grids used with the new implementation, compared to the old one. Usually, the difference in the number of PML grids is quite large: we are now using much less PML grids than before. I believe this could explain the relative errors that we observe on the checksum benchmarks (for example, with PSATD I tend to think that some of the previous setups were kind of limit cases where some PML grids were extremely small, possibly too small compared to the number of guard cells used for the spectral solver). What do you think? Note that I have not yet reset two benchmarks:
|
Re: Re: |
@EZoni I removed the assertion so that the test with anisotropic refinement ratio can run without assertion failure. We have also discussed in the meeting that we will use ncell/ref_ratio on the coarse PML patch. So could you help me reset the benchmarks of the two cases? I will do a quick follow-up PR to fix the aniostropic refinement ratio issue after this is merged. |
@WeiqunZhang Thank you for the update! Sounds good, I will reset the remaining benchmarks. |
- maximum relative error: 1.07e-01 (B numerical artifact) - new implementation: (0,16,16) PML grids - old implementation: (0,40,34) PML grids
- maximum relative error: 3.98e-02 - new implementation: (0,2,2) PML grids - old implementation: (0,2,2) PML grids (different number of ghost cells on coarse PML patch)
If the union of the grids is a single rectangular domain, we can simplify
the process and generate more efficient PML BoxArray.