Skip to content

Implement preliminary multigroup (MG) version of DDMC. - #29

Merged
RyanWollaeger merged 15 commits into
developfrom
mg_ddmc
Jul 30, 2026
Merged

Implement preliminary multigroup (MG) version of DDMC.#29
RyanWollaeger merged 15 commits into
developfrom
mg_ddmc

Conversation

@RyanWollaeger

@RyanWollaeger RyanWollaeger commented Mar 19, 2026

Copy link
Copy Markdown
Collaborator

Background

  • The standard way to do multigroup IMC-DDMC is to treat DDMC as grey, since effective scattering (thermal redistribution) between DDMC groups introduces unnecessary computational cost and can be circomvented with accurate averaging to grey diffusion.
  • The implementation in this change set makes use of singularity-opac calls in the transport loop (reintroducing them to transport_ddmc), which may be avoided if multigroup absorption and scattering are stored as fields.

Description of Changes

  • Add ddmc_mg_utils.hpp for MG-specific DDMC functionality.
  • Add MG DDMC integration and sampling routines and structs.
  • Add mid-point rule integral for non-dimensional Planck function.
  • Enable multigroup template in transport_ddmc.
  • Use DDMC->IMC out-scatter and DDMC leakage frequency sampling.
  • Use integrals at face over group for total leakage proabilities.
  • Replace ddmc_face_prob with ddmc_(lo|hi)_face_prob.

Note: ddmc_face_prob is only symmetric at face for grey DDMC, so ddmc_(lo|hi)_face_prob for low and high side of face are needed.

Checklist

  • New features are documented
  • Tests added for bug fixes and new features
  • (@lanl.gov employees) Update copyright on changed files
  • Fix DDMC criterion for non-unity aspect ratio cells.
  • Add regression test for MG DDMC.

@RyanWollaeger
RyanWollaeger marked this pull request as ready for review March 19, 2026 22:35
@RyanWollaeger RyanWollaeger changed the title Implement preliminary multigroup (MG) version of DDMC. Draft: Implement preliminary multigroup (MG) version of DDMC. Mar 19, 2026
@RyanWollaeger

Copy link
Copy Markdown
Collaborator Author

Note the added bullet points in the description checklist.

@RyanWollaeger RyanWollaeger changed the title Draft: Implement preliminary multigroup (MG) version of DDMC. Implement preliminary multigroup (MG) version of DDMC. Apr 7, 2026
@RyanWollaeger

Copy link
Copy Markdown
Collaborator Author

The main code changes should now be ready - but a regression test is still needed - will add this shortly. (Removed the draft prefix to obtain the CI for the current changeset.)

@RyanWollaeger

Copy link
Copy Markdown
Collaborator Author

Ran imc_mg.in with DDMC, and tried a multigroup form of stepdiff_ddmc.in and stepdiff_smr_hybrid.in with uniform scattering opacity. These all seem to give the expected results, but are minor variations of the existing tests. Assuming it is okay to not check this mostly-same files in, I checked the MG regression box (I could turn it on, e.g. in imc_mg.in, so that test becomes a DDMC test, rather than adding a duplicate). Alternatively, we can update singularity-opac to obtain @pdmullen's power-law frequency opacity update for a non-trivial semi-analytic test.

Comment thread env/bash
@adamdempsey90

Copy link
Copy Markdown
Collaborator

Since this fixes the first capture issue, so let's get this in before #30.

Comment on lines +20 to +41
struct cell_scat_args {
const int &b; // block index
const int &ip; // x/X1 block cell index
const int &jp; // y/X2 block cell index
const int &kp; // z/X3 block cell index
const Real &ff; // Fleck factor
const Real &aa; // absorption opacity (1/length)
const Real &ss; // scattering opacity (1/length)
// frequency data
const int &n_nubinsd; // number of frequency groups
const Real &numind; // mininmum frequency
const Real &numaxd; // maximum frequency
const Real &hd; // Planck constant
};
struct ptcl_scat_args {
RngGen &rng_gen;
const Real &vv;
Real &vx; // particle x/X1-direction speed
Real &vy; // particle y/X2-direction speed
Real &vz; // particle z/X3-direction speed
Real ⅇ // particle frequency (in units of energy)
};

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 guess so long as you can guarantee the lifetime of these references extends beyond where the struct is used this if fine, but holding references in structs can be dangerous.

Comment thread src/jaybenne/scattering.hpp Outdated
+ Add ddmc_mg_utils.hpp for MG-specific DDMC functionality.
+ Add MG DDMC integration and sampling routines and structs.
+ Add midpoint rule integral for non-dimensional Planck function.
+ Enable multigroup template in transport_ddmc.
+ Use DDMC->IMC out-scatter and DDMC leakage frequency sampling.
+ Use integrals at face over group for total leakage proabilities.
+ Replace ddmc_face_prob with ddmc_(lo|hi)_face_prob.

Note: ddmc_face_prob is only symmetric at face for grey DDMC, so
ddmc_(lo|hi)_face_prob for low and high side of face are needed.
+ Change Stefan-Boltzmann to Boltzmann constant in Planck function.
+ Use Rayleigh-Jeans approximation for nu/T<1e-4.
+ Return 0 for leakage probability if no groups contribute.
+ Sample isotropic direction after DDMC frequency out-scatter.
+ Convert frequency to energy when calling opacity.
+ Fix nu->dnu (ee->dee) in call to midpoint_Planck in leakage.
+ Check for 0-absorption opacity in DDMC, if 0 return 0 outscatter.
+ Update singularity-eos,-opac submodules.
+ Avoid some if constexpr capture build errors with maybe_unused.
+ Separate mcblock absorption/scattering input nodes (Artemis-like).
+ Build and store vector of log-space group frequency midpoints.
+ Demo use of frequency group/bin points in sourcing.cpp.
+ Use frequency in 1/time in singularity-opac API functions.
+ Check heuristic if elastic scattering is dominant (is_elastic).
+ Avoid frequency redistribution during cell leakage if is_elastic.

Note: the elastic scattering-dominant mode is a provisional
solution, which needs more work for better consistency with the
original inelastic mode.
+ Suppress (for now) population control in multigroup mode.
+ Update metric for elastic-scattering based DDMC leakage.

Note: the code with the new metric is motivated in a comment.
+ Add is_leaked parameter to DDMC step arguments.
+ Move face temperature evaluation out of leakage integrals.
+ Remove erroneous MG if-check around population control.
@RyanWollaeger

Copy link
Copy Markdown
Collaborator Author

Added a power-law scattering version of the stepdiff test, along with the corresponding analytic solution (just a per-group form of the original stepdiff solution for elastic scattering). The analytic solution discretizes the frequency in the same way over the same number of groups.

+ Use pure (elastic) scattering power-law.
+ Add analytic solution comparison to CI workflows and CI-launcher.
@RyanWollaeger

Copy link
Copy Markdown
Collaborator Author

Tested out the shearing box with a power-law opacity (through artemis) - at a glance things didn't go crazy. Any objection to merging this?

@RyanWollaeger

Copy link
Copy Markdown
Collaborator Author

Tested out the shearing box with a power-law opacity (through artemis) - at a glance things didn't go crazy. Any objection to merging this?

Since this is approved and there are no objections - will go ahead and merge.

@RyanWollaeger
RyanWollaeger merged commit ab27f67 into develop Jul 30, 2026
3 checks passed
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.

2 participants