Add a new regression test: random SN in a box#1547
Add a new regression test: random SN in a box#1547chongchonghe merged 27 commits intodevelopmentfrom
Conversation
for more information, see https://pre-commit.ci
Summary of ChangesHello @chongchonghe, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request integrates a new regression test, 'random SN in a box,' into the Quokka astrophysical simulation framework. It introduces a dedicated Python utility for generating diverse particle initial conditions and significantly enhances the C++ backend to track and process supernova feedback from these particles. The changes streamline the setup of particle-based simulations and improve the robustness of particle data handling during checkpoint and restart operations, particularly across varying MPI configurations. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds a new regression test for random supernovae in a box, driven by particles. This involved a significant and valuable refactoring of the RandomBlast problem to use the StochasticStellarPop particle framework. A new Python script is also added to generate particle data. The supernova deposition logic is updated to count SN explosions for diagnostics, and the robustness of checkpoint/restarts is improved. The changes are generally excellent. I've found a few issues, including a bug in the new particle generation script, the use of non-portable system calls, and a bug in an existing test that would cause it to always report success.
There was a problem hiding this comment.
💡 Codex Review
quokka/src/particles/particle_deposition.hpp
Lines 341 to 344 in 537a36b
The SN deposition path always removes a fixed m_ej = 10 M_sun and then clamps the remaining particle mass to m_dead_min (lines 299–344). With the new RandomBlast setup, many particles in particles_stochastic_n100.txt are well below 10 M⊙, yet when their death_time is reached this code still ejects 10 M⊙ and leaves a 1.4 M⊙ remnant, creating several solar masses out of nothing. Each low‑mass star that explodes will inflate the total mass and momentum budget, breaking conservation and the physical model. Consider skipping SNs for sub‑10 M⊙ stars or limiting ejecta to the particle’s current mass minus the remnant.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
@BenWibking @markkrumholz This is ready for your review. I have created regression test benchmark files for this new test problem. Once merged to the main branch, it will demonstrate that hydro+AMR+gravity+particles+cooling is fully reproducible. Dependent on #1546 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@BenWibking @markkrumholz Can you review this PR? I need this new test problem to test radiation module and tall box benchmark. |
|
Can you fix the merge conflict? Then I can review it. |
|
@BenWibking Ready |
|
BenWibking
left a comment
There was a problem hiding this comment.
LGTM assuming GPU tests pass
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |



Description
Refactored RandomBlast Problem: The testRandomBlast.cpp problem was significantly refactored to utilize the new particle system for SN feedback, removing the previous stochastic sampling method and integrating particle initialization from a file.
Particle Generation Script: Added a new Python script (create_particles.py) to generate initial particle distributions for various types (CIC, Sink, Rad, StochasticStellarPop) with options for spatial sampling (uniform, Gaussian, Plummer) and physical parameters.
Dependent on #1546 : Supernova (SN) Explosion Tracking: Modified the C++ particle physics core to accurately track and return the number of supernova explosions occurring within a simulation timestep, enhancing diagnostics and logging
Checklist
Before this pull request can be reviewed, all of these tasks should be completed. Denote completed tasks with an
xinside the square brackets[ ]in the Markdown source below:/azp run.