-
Notifications
You must be signed in to change notification settings - Fork 13
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
fix openPMD plotfile output #804
Conversation
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
Out-of-bounds array access: https://app.circleci.com/pipelines/circleci/TJttRfCZuo9qQMru3cFqzy/SoCatADYnqm7LfdmA3zswt/1080/workflows/79cefde6-56f9-4d61-907d-d5d4c15e7315/jobs/2338 To be investigated. |
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
Quality Gate passedIssues Measures |
@markkrumholz Not urgent, but this is now ready for review. |
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.
There seems to be a slight inconsistency in the design: as written now, the code will always fail if run for a case with more cell-centered than face-centered ghost zones, due to the AMREX_ALWAYS_ASSERT added to the routine that does the averaging to centers. However, both doDiagnostics and renderAscent seem to support having more cell-centered than face-centered ghost zones, and gracefully use a std::min to handle that. This is confusing. I think we should put similar assertions in every routine if we don't want to support having nghost_cc > nghost_fc, or we should edit the averaging to center routine to also support this case. One possible way to do this would be to have the routine take an optional argument that provides a fill value to add to ghost zones that cannot be filled because the corresponding face-centered cells do not exist. I don't have strong feelings about which of these options we pick, but I think the design should be consistent as to whether we do or don't support the case nghost_cc > nghost_fc.
In the current code, if I am remembering correctly, averaging to centers is only done for outputs. Everywhere an output needs to do that, it provides an appropriate number of ghost zones to use (that may be less than nghost_cc). If we are not doing MHD, then we don't need to carry around extra ghost faces we don't need, and we only need to average them to centers for outputs. I don't see an issue with this design in principle. I don't think it's a good idea to allow averaging to centers with a fill value. That is almost certain to produce bugs in the future. The assertion just forces anyone who uses the averaging function to specify something sensible upfront. In any case, I don't know where we would need to do this. |
Actually, ghost cells in outputs are only really needed for Ascent, due to the way it uses them to compute surfaces and streamlines in parallel without doing extra communication itself. For all other outputs, we could just get rid of the ghost cells. They are not supported in OpenPMD outputs at all, and in AMReX plotfiles I don't think they are used for anything. Edit: I need to double check whether they are used by any of the diagnostics. |
Just to clarify- the case where nghost_cc > nghost_fc is tested as part of the SphericalCollapse test suite problem, since tracer particles without MHD enabled set nghost_fc = 2, while nghost_cc is always 4. |
So my confusion is these lines (2092 - 2096) of
It seems to me like you are grabbing the state vectors, extracting their number of ghost zones, and then throwing an assertion that will fail anytime the cell-centered state variables have more ghost zones than the face-centered ones. So it seems like this should fail any time |
Description
Fixes a segmentation fault during openPMD plotfile output when face-centered variables are enabled.
There was an implicit assumption in
AMRSimulation<problem_t>::AverageFCToCC()
that the number of face-centered ghost zones was the same as the number of cell-centered ghost zones. This PR allows the number of ghosts to differ.I manually tested that this works inside the CUDA dev container by compiling Quokka with
-DQUOKKA_OPENPMD=ON
, running the HydroBlast3D problem, and then examining the output files with openPMD-viewer.Related issues
Fixes #742.
Checklist
Before this pull request can be reviewed, all of these tasks should be completed. Denote completed tasks with an
x
inside the square brackets[ ]
in the Markdown source below:/azp run
.