Skip to content

Add print of SN explosion counts#1546

Merged
BenWibking merged 11 commits into
developmentfrom
chong/particles/print-SN-counts
Jan 8, 2026
Merged

Add print of SN explosion counts#1546
BenWibking merged 11 commits into
developmentfrom
chong/particles/print-SN-counts

Conversation

@chongchonghe

@chongchonghe chongchonghe commented Dec 27, 2025

Copy link
Copy Markdown
Contributor

Description

Print the number of stars that went SN explosion in each step (if >0) when verbose = true.

Also change the format of some print logs in the particle module to make them more consistent and avoid excessive logs.

Related issues

Are there any GitHub issues that are fixed by this pull request? Add a link to them here.

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:

  • I have added a description (see above).
  • I have added a link to any related issues (if applicable; see above).
  • I have read the Contributing Guide.
  • I have added tests for any new physics that this PR adds to the code.
  • (For quokka-astro org members) I have manually triggered the GPU tests with the magic comment /azp run.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @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 enhances the simulation's observability by integrating a new feature to track and report the number of supernova explosions per simulation step. This provides users with more detailed feedback on stellar evolution events, particularly when running in verbose mode, without altering the core physics or simulation behavior.

Highlights

  • Supernova Explosion Counting: The core change introduces a mechanism to count the number of supernova (SN) explosions occurring in each simulation step. This count is now returned by the depositSN functions.
  • Function Signature Updates: The return type of depositSN methods in PhysicsParticleDescriptorBase, PhysicsParticleDescriptor, and PhysicsParticleRegister has been updated from amrex::Real to std::pair<int, amrex::Real>, allowing them to return both the SN explosion count and the maximum velocity.
  • Verbose Output for SN Events: When the verbose flag is enabled, the simulation will now print the number of SN explosions that occurred in a given step, along with the simulation time and level, providing better insight into SN feedback.
  • Logging Consistency: Minor adjustments were made to standardize warning messages and particle statistics output by prepending [WARNING] and [PARTICLES] respectively, improving log readability.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request correctly implements the feature to count and print the number of supernova explosions. The changes are well-structured, modifying function signatures to return the count alongside the maximum velocity, and correctly using GPU atomics and MPI reductions to aggregate the count. The new log output is a valuable addition for debugging and analysis. I have one minor suggestion to improve logging consistency.

Comment thread src/simulation.hpp Outdated
@chongchonghe chongchonghe marked this pull request as ready for review December 27, 2025 04:10
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. particles labels Dec 27, 2025
@sonarqubecloud

Copy link
Copy Markdown

Please retry analysis of this Pull-Request directly on SonarQube Cloud

@chongchonghe

Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 2 pipeline(s).

@chongchonghe

Copy link
Copy Markdown
Contributor Author

@BenWibking @markkrumholz This is ready for review.

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jan 7, 2026
@BenWibking BenWibking added this pull request to the merge queue Jan 7, 2026
Merged via the queue into development with commit 1be74e0 Jan 8, 2026
49 of 50 checks passed
github-merge-queue Bot pushed a commit that referenced this pull request Jan 10, 2026
### 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 `x` inside the square brackets
`[ ]` in the Markdown source below:_
- [x] I have added a description (see above).
- [x] I have added a link to any related issues (if applicable; see
above).
- [x] I have read the [Contributing
Guide](https://github.com/quokka-astro/quokka/blob/development/CONTRIBUTING.md).
- [x] I have added tests for any new physics that this PR adds to the
code.
- [x] *(For quokka-astro org members)* I have manually triggered the GPU
tests with the magic comment `/azp run`.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
@chongchonghe chongchonghe deleted the chong/particles/print-SN-counts branch January 14, 2026 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer particles size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants