Skip to content

Conversation

@mlouis9
Copy link

@mlouis9 mlouis9 commented Feb 10, 2026

Description

Depends on #3495: This code is stacked on top of the branch from #3495, only commits from d679fae onward are original, any changes to previous commits were merely to rebase onto newer versions of develop.

This code implements the ability to calculate subcritical multiplication parameters k,kq,ks in fixed source mode (#3495 implements this for eigenvalue mode, along with source effectiveness factor). These quantities are tallied by noting that, in fixed source mode, built-in k-estimators will implicitly accumulate across all generations in a batch, and so give M (the fixed source multiplicity), which can be used to compute k via k = 1 - 1/M. To reuse as much existing code as possible, tallies etc. are kept in terms of M until output and statepoint writing.

kq is tallied by accumulating built-in k-estimators for only the first generation of source neutrons. Finally ks is computed from kq, M via algebraic relations, and the estimated standard deviation is computed accounting for the correlation between kq and M estimates.

This involves the following code changes

  1. eigenvalue.cpp
    • Generalization of logic for calculate_generation_keff()
      • Operations now branch on KeffType, which just maps global simulation parameters to corresponding local parameters
      • Involves initializing pointers and updating them in a switch statement
    • Generalization of logic for calculate_average_keff()
      • Similar mapping of global to local parameters based on KeffType involving pointer initialization
      • To avoid modifying particle physics, delineated simulation::k from simulation::keff which biases physics and is not wanted in fixed source mode.
    • Generalization of logic of openmc_get_keff() into get_combined_k_from_tallies, which is used to support additional openmc_get_kq()
    • Added openc_get_ks(), which used accumulated k-kq product tallies to compute the correct standard deviation of a combined ks estimator (inferred from combined estimators for k, kq) accounting for covariance between k, kq estimators
    • Modified logic for writing k_combined in fixed source subcritical mode, and added additional datasets for kq,ks combined and generation.
  2. Changes to input and settings
    • Added options settings.calculate_subcritical_k and print_all_k_factors to control the calculation and printing of these quantities in fixed source mode
  3. simulation.cpp
    • Added additional conditionals to perform previously eigenvalue-only computations in fixed source subcritical mode
      • Accumulating global tallies for k-estimators, kq-estimators, printing, and calculating generation and average keff
    • Added logic to transport_history_based_single_particle to accumulate tallies only for first generation neutrons
  4. particle.cpp and physics.cpp
    • Added conditional logic to accumulate k estimators in fixed source subcritical mode
  5. tally.cpp
    • Add accumulation of global tallies for first-generation-only tallies and k-kq product tallies in subcritical fixed source mode
  6. Added a test case using the same physical model as the test in Calculation of kinetic parameters relevant to fissile system with an external neutron source #3495, achieved similar results
  7. Added documentation on subcritical multiplication factors and new settings

Checklist

  • I have performed a self-review of my own code
  • I have run clang-format (version 15) 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)

@mlouis9 mlouis9 requested a review from jtramm as a code owner February 10, 2026 13:56
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