Skip to content

Turn on/off radiation - #118

Merged
adamdempsey90 merged 10 commits into
developfrom
dempsey/pkg_time
May 26, 2026
Merged

Turn on/off radiation#118
adamdempsey90 merged 10 commits into
developfrom
dempsey/pkg_time

Conversation

@adamdempsey90

Copy link
Copy Markdown
Collaborator

Background

This adds the machinery to turn on/off and initialize/shutdown a package during a simulation. To start, I have enrolled moments and raytrace into this.

When moments comes on, it will set all variables to LTE values.

We should do the same for IMC and pretty much all of the packages.

I have tested this locally, and it works correctly, even through restarts.

Description of Changes

Checklist

  • New features are documented
  • Tests added for bug fixes and new features
  • (@lanl.gov employees) Update copyright on changed files
  • Any contribution that was created or modified with the assistance of generative AI must have a comment disclosing this such as // This file was created in part or in whole by generative AI

Comment thread src/radiation/moments/moments.cpp Outdated

@RyanWollaeger RyanWollaeger left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

enum class PackageControl { inactive = -1, shutdown = 0, active = 1, initial = 2 };

template <class PKG>
inline PackageControl CheckPackageStatus(PKG &pkg, const Real time) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Not a problem for today... but something like this might be a bit more nuanced for non operator-split physics. For example, I don't think we would want to turn off physics in between the the 1st and 2nd stage of RK2. Not an issue at the moment, just thinking aloud.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is only called before entering Step, so there won't be any switching mid RK-stage

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I have expanded this use to physics that is done in the rk substeps, in those cases i also only turn on/off for the first stage

Comment thread src/radiation/moments/moments.cpp Outdated
Comment thread src/radiation/moments/moments.cpp Outdated
@adamdempsey90

Copy link
Copy Markdown
Collaborator Author

I will add this machinery also to the cooling package

Comment thread src/radiation/imc/imc_driver.cpp Outdated
Comment on lines 43 to +45
//! \fn TaskListStatus SelfGravity::PoissonDriver
//! \brief
void SolvePoisson(TaskCollection &tc, Mesh *pmesh) {
void SolvePoisson(TaskCollection &tc, Mesh *pmesh, const Real time, const int stage) {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I noticed this doesn't return TaskListStatus, but should it @pdmullen ?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think not. All we are doing is passing the TaskCollection tc to SolvePoisson and having that function add a region with its own tasks.

When we call Execute on the final TaskCollection, that returns TaskListStatus (see StepTasks.Execute()).

The comment is wrong in the //! \fn though.

Comment thread src/radiation/moments/moments_driver.cpp
Comment thread src/radiation/moments/moments.cpp Outdated
@adamdempsey90
adamdempsey90 merged commit 2ba459c into develop May 26, 2026
6 checks passed
@adamdempsey90
adamdempsey90 deleted the dempsey/pkg_time branch May 26, 2026 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants