Skip to content

Implement photoionization and add tests#1719

Open
James471 wants to merge 38 commits into
developmentfrom
photoionization
Open

Implement photoionization and add tests#1719
James471 wants to merge 38 commits into
developmentfrom
photoionization

Conversation

@James471
Copy link
Copy Markdown

@James471 James471 commented Mar 6, 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

None

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.

Copy link
Copy Markdown
Contributor

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

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
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
Copy link
Copy Markdown
Contributor

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

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.

@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

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 7, 2026

Claude encountered an error —— View job


Code Review in Progress

  • Gather context and read changed files
  • Review photoionization implementation (src/radiation/photochemistry.hpp)
  • Review network files (src/networks/photoionization/)
  • Review test problems (RadStreamingPhotoionization, StromgrenSphere)
  • Review TOML input files
  • Check integration with existing simulation code
  • Provide comprehensive review feedback

@chongchonghe chongchonghe self-requested a review May 11, 2026 14:14
Comment thread src/problems/OneZonePhotoionization/CMakeLists.txt
Comment thread src/problems/OneZonePhotoionization/testOneZonePhotoionization.cpp
Comment thread src/problems/OneZonePhotoionization/testOneZonePhotoionization.cpp
Comment thread src/radiation/photochemistry.hpp
Comment thread src/radiation/photochemistry.hpp Outdated
Comment thread src/problems/StromgrenSphere/testStromgrenSphere.cpp Outdated
Comment thread src/radiation/radiation_system.hpp Outdated
Comment thread src/radiation/photochemistry.hpp Outdated
Comment thread src/problems/StromgrenSphere/CMakeLists.txt Outdated
Copy link
Copy Markdown
Contributor

@chongchonghe chongchonghe left a comment

Choose a reason for hiding this comment

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

I have finished a review of this PR. It generally looks really good, and I think it will be ready to merge once you addressed all the comments and after Mark and/or Ben review.

I left many comments, and all are all easy and quick fixes. One format change is required: since we don't do subfolders in the inputs/ folder, to make it consistent with the rest of the code, can you move the toml files in inputs/PhotoionizationTests to inputs/ ? Then, you should be able to use the scripts/bash/quokka script to do quick build and run, because the quokka script assumes a unified file structure. Also need to rewrite the .toml file into TOML format, as gemini pointed out.

@BenWibking
Copy link
Copy Markdown
Collaborator

auggie review

@augmentcode
Copy link
Copy Markdown

augmentcode Bot commented May 12, 2026

This pull request is abnormally large and would use a significant amount of tokens to review. If you still wish to review it, comment "augment review" and we will review it.

@BenWibking
Copy link
Copy Markdown
Collaborator

augment review

@augmentcode
Copy link
Copy Markdown

augmentcode Bot commented May 12, 2026

🤖 Augment PR Summary

Summary: This PR implements photochemistry (photoionization) in Quokka by adding a new photochemistry module, a photoionization reaction network, and associated test problems (one-zone streaming and Strömgren sphere).

Changes:

  • Added src/radiation/photochemistry.hpp/.cpp — a new operator-split photochemistry driver that integrates species, radiation, and energy using Microphysics' VODE burner
  • Added src/networks/photoionization/ — a new reaction network with photoionization, recombination, collisional ionization, heating, and cooling terms (RHS + analytic Jacobian)
  • Added src/networks/network_header.template — a configurable template for generating network_properties.H at build time
  • Extended EOS.hpp to support PHOTOCHEMISTRY alongside CHEMISTRY for multi-species EOS calls
  • Integrated photochemistry into the radiation subcycle loop in QuokkaSimulation.hpp
  • Added two test problems: RadStreamingPhotoionization (one-zone) and StromgrenSphere, with Julia reference solutions and analytical comparisons
  • Updated the Microphysics submodule to a compatible version

Technical Notes: The photochemistry uses an operator-split approach applied after the radiation update. The Jacobian is provided analytically for efficient VODE integration. Various physics switches (recombination, collisional ionization, heating/cooling) are exposed as runtime parameters. Test validation compares against Julia ODE solutions and analytical Strömgren sphere evolution.

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

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

Review completed. 6 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread src/networks/photoionization/actual_rhs.H Outdated
Comment thread src/networks/photoionization/actual_rhs.H Outdated
Comment thread src/networks/photoionization/actual_rhs.H
Comment thread src/radiation/photochemistry.hpp Outdated
Comment thread src/problems/StromgrenSphere/CMakeLists.txt Outdated
Comment thread src/networks/photoionization/actual_rhs.H Outdated
@James471 James471 force-pushed the photoionization branch 2 times, most recently from 90abd39 to 531c9bc Compare May 12, 2026 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request 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