Skip to content

Implement photoionization and add tests#1719

Merged
James471 merged 40 commits into
developmentfrom
photoionization
Jun 6, 2026
Merged

Implement photoionization and add tests#1719
James471 merged 40 commits into
developmentfrom
photoionization

Conversation

@James471

@James471 James471 commented Mar 6, 2026

Copy link
Copy Markdown
Contributor

Description

Implements photochemistry in quokka and changes the Microphysics hash to a compatible version. Also adds the one zone test and the stromgren sphere test problem

Related issues

Depends on AMReX-Astro/Microphysics#1975

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.

@review-notebook-app

Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 implements photoionization in Quokka, updates the Microphysics hash, and adds one-zone and Stromgren sphere test problems. The changes introduce a new photochemistry module, enhancing Quokka's ability to simulate astrophysical phenomena involving radiation and matter interactions. The included tests help ensure the correctness and stability of the new features.

Highlights

  • Photoionization Implementation: This PR introduces a new photochemistry module to Quokka, enabling simulations that model the interaction of radiation with matter.
  • Microphysics Compatibility: The Microphysics submodule has been updated to a compatible version, ensuring proper interaction with the new photochemistry routines.
  • Test Cases: Two new test problems, the one-zone test and the Stromgren sphere test, have been added to validate the implementation of the photochemistry module.
Activity
  • The pull request includes a description and a checklist of completed tasks.
  • The author has manually triggered the GPU tests.
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 implements photochemistry and adds corresponding tests. The changes include modifications to the main simulation loop and EOS to support a new PHOTOCHEMISTRY flag, and adds new networks for photoionization. The implementation of the photochemistry step as an operator-split source term seems correct. My main feedback is regarding code duplication in the new network definitions, which could be refactored for better maintainability. I've also pointed out several places with commented-out code that should be cleaned up before merging.

Note: Security Review did not run due to the size of the PR.

Comment thread src/networks/H_ionization_TInd/actual_rhs.H Outdated
Comment thread src/networks/photoionization/Make.package
Comment thread src/problems/RadStreamingPhotoionization/CMakeLists.txt Outdated
Comment thread src/problems/RadStreamingPhotoionization/testRadStreamingPhotoionization.cpp Outdated
@James471

Copy link
Copy Markdown
Contributor Author

/gemini review

@James471
James471 marked this pull request as ready for review April 21, 2026 09:44
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request labels Apr 21, 2026

@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 implements a major update to the project's development infrastructure, including a new quokka CLI tool, a complete migration of input files to TOML format, and extensive documentation updates. Feedback points out syntax errors in several new TOML files regarding array formatting and missing required parameters. Furthermore, portability issues were identified in the regression scripts due to hardcoded absolute paths and local directory references.

Comment thread inputs/PhotoionizationTests/StreamingNoEnergyChange.toml Outdated
Comment thread inputs/PhotoionizationTests/StreamingNoEnergyChange.toml Outdated
Comment thread inputs/PhotoionizationTests/StreamingPhotoheatingRecCooling.toml Outdated
Comment thread inputs/PhotoionizationTests/StreamingPhotoheatingRecCooling.toml Outdated
Comment thread inputs/PhotoionizationTests/StromgrenNoRecombination.toml Outdated
Comment thread inputs/PhotoionizationTests/StromgrenTempIndependentRecombination.toml Outdated
Comment thread inputs/PhotoionizationTests/StromgrenTempIndependentRecombination.toml Outdated
Comment thread scripts/bash/run-regression-exe.sh
Comment thread scripts/bash/run-regression-exe.sh
Comment thread docs/markdown/parameters.md
@BenWibking

Copy link
Copy Markdown
Collaborator

Ok, something went wrong with a merge into this branch. Essentially the last several weeks of PRs have somehow been included here as new commits.

@dosubot dosubot Bot added size:XXL This PR changes 1000+ lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Apr 21, 2026
@James471

Copy link
Copy Markdown
Contributor Author

Is it fine now? I had performed a merge from dev to my branch for some tests to pass, since I had branched from a very old commit of dev, and after that format.h had been removed causing tests to fail. I have now rebased, so the commit history should look normal.

@BenWibking

Copy link
Copy Markdown
Collaborator

Is it fine now? I had performed a merge from dev to my branch for some tests to pass, since I had branched from a very old commit of dev, and after that format.h had been removed causing tests to fail. I have now rebased, so the commit history should look normal.

Yeah, it looks fine now.

Comment thread extern/photoionization-julia/fraction.jl
Comment thread src/problems/OneZonePhotoionization/testOneZonePhotoionization.cpp
Comment thread src/problems/RadStreamingPhotoionization/CMakeLists.txt Outdated
Comment thread src/problems/RadStreamingPhotoionization/testRadStreamingPhotoionization.cpp Outdated
Comment thread src/problems/StromgrenSphere/CMakeLists.txt Outdated
@chongchonghe

Copy link
Copy Markdown
Contributor

This looks really good in general! I made some quick comments and will continue to review tomorrow.

@James471

Copy link
Copy Markdown
Contributor Author

Thanks ChongChong! I'll make the changes suggested by you and Ben towards the end collectively once you have finished reviewing.

@James471
James471 force-pushed the photoionization branch from bdd308a to 8b01192 Compare May 3, 2026 11:59
Comment thread src/problems/RadStreamingPhotoionization/testRadStreamingPhotoionization.cpp Outdated
@chongchonghe

Copy link
Copy Markdown
Contributor

@claude review

@chongchonghe
chongchonghe self-requested a review May 11, 2026 14:14
Comment thread src/problems/OneZonePhotoionization/CMakeLists.txt
@chongchonghe

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

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

@quokka-astro quokka-astro deleted a comment from claude Bot Jun 5, 2026
@chongchonghe
chongchonghe self-requested a review June 5, 2026 10:28
chongchonghe
chongchonghe previously approved these changes Jun 5, 2026
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jun 5, 2026
@BenWibking

Copy link
Copy Markdown
Collaborator

This is what Codex says:

• The patch has runtime correctness issues for default photochemistry energy handling and reduced-speed radiation, and it registers a
  3D-only problem in 2D builds. These should be addressed before considering the change correct.

  Full review comments:

  - [P2] Avoid treating generated energy as final energy — /Users/benwibking/amrex_codes/quokka/src/radiation/photochemistry.hpp:112-
    112
    When a photochemistry input omits integrator.subtract_internal_energy = 0, Microphysics uses its default of returning only the
    generated energy after burner(). This eos_input_re call interprets that delta as the final specific energy, so the later dEint =
    photochemstate.e * rho - Eint subtracts the initial internal energy again (or zeroes it for energy_switch=0); force that parameter
    for photochemistry or reconstruct from the final temperature as the chemistry path does.

  - [P2] Use the reduced light speed in the chemistry RHS — /Users/benwibking/amrex_codes/quokka/src/networks/photoionization/
    actual_rhs.H:82-82
    For PHOTOCHEMISTRY problems that set RadSystem_Traits::c_hat_over_c < 1, computePhotoChemistry stores the reduced speed in
    state.c_hat, but the RHS and Jacobian hard-code C::c_light. Those runs will absorb photons and heat gas on a full-c timescale
    while radiation transport/source terms use the reduced speed, making ionization fronts too fast; use state.c_hat consistently here
    and in the Jacobian.

  - [P2] Restrict StromgrenSphere target to 3D — /Users/benwibking/amrex_codes/quokka/src/problems/StromgrenSphere/CMakeLists.txt:1-1
    With the documented 2d preset this block still adds and registers StromgrenSphere, but the problem implementation unconditionally
    uses z coordinates (prob_lo[2], dx[2]) and 3D source normalization/inputs. The 2D target is therefore invalid; guard it with
    AMReX_SPACEDIM EQUAL 3 unless the problem is made dimension-aware.

@BenWibking
BenWibking added this pull request to the merge queue Jun 5, 2026
@BenWibking
BenWibking removed this pull request from the merge queue due to a manual request Jun 5, 2026
@James471

James471 commented Jun 6, 2026

Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines

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

@James471
James471 enabled auto-merge June 6, 2026 06:02
@James471
James471 added this pull request to the merge queue Jun 6, 2026
Merged via the queue into development with commit d338bfb Jun 6, 2026
52 of 53 checks passed
@James471
James471 deleted the photoionization branch June 9, 2026 04:48
Meowwish pushed a commit to Meowwish/quokka_metal that referenced this pull request Jun 15, 2026
…ry (quokka-astro#1892)

### Description

Add support for reduced speed of light approximation, and test coupling
of photochemistry with hydro by a D-Type test.

### Related issues
Dependent on quokka-astro#1719 

### 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>
Co-authored-by: ChongChong He <chongchonghe99@gmail.com>
Co-authored-by: Quokka Dev <rsla@quokka-dev.example.com>
lizmcole pushed a commit that referenced this pull request Jul 16, 2026
### Description
Implements photochemistry in quokka and changes the Microphysics hash to
a compatible version. Also adds the one zone test and the stromgren
sphere test problem

### Related issues
Depends on AMReX-Astro/Microphysics#1975 

### 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.
- [ ] *(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>
Co-authored-by: ChongChong He <chongchonghe99@gmail.com>
Co-authored-by: Ben Wibking <ben@wibking.com>
lizmcole pushed a commit that referenced this pull request Jul 16, 2026
…ry (#1892)

### Description

Add support for reduced speed of light approximation, and test coupling
of photochemistry with hydro by a D-Type test.

### Related issues
Dependent on #1719 

### 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>
Co-authored-by: ChongChong He <chongchonghe99@gmail.com>
Co-authored-by: Quokka Dev <rsla@quokka-dev.example.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request lgtm This PR has been approved by a maintainer size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants