Skip to content

Automated generation of FW-CADIS source biasing parameters via Random Ray - #4136

Draft
j-fletcher wants to merge 31 commits into
openmc-dev:developfrom
j-fletcher:auto_sb
Draft

j-fletcher wants to merge 31 commits into
openmc-dev:developfrom
j-fletcher:auto_sb

Conversation

@j-fletcher

@j-fletcher j-fletcher commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Description

This PR is intended to be merged after #4135.

Adds the option within the FW-CADIS WeightWindowGenerator to bias forward fixed sources in the problem. The spatial mesh and energy groups used by the weight window structure are also used to discretize the source biasing parameters, along with an optional angular biasing "quadrature" which enables angular dependence.

First, the strength of the forward source(s) are estimated for each phase space voxel in the spatial-angular-energy mesh using a SourceBase.write_forward_source_mesh() method. This successively samples the problem's external source until one of the following convergence criteria is satisfied:

  • On average, every voxel that has been found to contain a source point has been sampled at least min_avg_samples_per_voxel times.
  • A total of max_samples source sites have been sampled.

The probability mass associated with each phase space voxel is then written to forward_source_mesh.h5 and read by the weight window generator during WeightWindowsGenerator::create_tally(). A new tally is created to track the scalar or angular flux during adjoint transport, and the elementwise strengths of the biased source are calculated as $\hat{q}(\vec{r}, \vec{\Omega}, E) = \psi^{+}(\vec{r}, \vec{\Omega}, E)q(\vec{r}, \vec{\Omega}, E)$ . Accordingly, a weight inversely proportional to the adjoint flux is also assigned to each phase space voxel. These parameters are then written to source_bias.h5.

Finally, in the forward Monte Carlo run, an instance of a new CorrelatedSource class can be instantiated from the source bias file. This action also performs an interpolation of the biasing parameters' angular dependence from the UnitSpherePointset used for tallying onto a UnitSphereTriangularMesh that enables sampling. The CorrelatedSource class is similar to MeshSource in that a single vector of probabilities governs the selection of a phase space voxel, from which uniform samples are then drawn. Sampling over the energy variable is performed uniformly in lethargy. This structure allows the source's angular, energy, and spatial distributions to vary in a correlated manner.

One key advantage of pre-calculating the forward source strengths is that biasing parameters can be calculated for forward sources that are not normally compatible with the Random Ray solver, provided that a reasonable "lookalike" can be defined for the forward Random Ray simulation which then estimates the adjoint source. The adjoint Random ray solve then calculates the source biasing parameters on the same discretization used to mesh the original forward source.

Checklist

  • I have performed a self-review of my own code
  • I have run clang-format (version 18) on any C++ source files (if applicable)
  • I have followed the style guidelines for Python source files (if applicable)
  • I have made corresponding changes to the documentation (if applicable)
  • I have added tests that prove my fix is effective or that my feature works (if applicable)

This branch has not been deployed

No deployments
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.

1 participant