LCOV - code coverage report
Current view: top level - src/auxkernels - ComputeTCScatterMGXSAux.C (source / functions) Hit Total Coverage
Test: neams-th-coe/cardinal: be601f Lines: 18 19 94.7 %
Date: 2025-07-15 20:50:38 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /********************************************************************/
       2             : /*                  SOFTWARE COPYRIGHT NOTIFICATION                 */
       3             : /*                             Cardinal                             */
       4             : /*                                                                  */
       5             : /*                  (c) 2021 UChicago Argonne, LLC                  */
       6             : /*                        ALL RIGHTS RESERVED                       */
       7             : /*                                                                  */
       8             : /*                 Prepared by UChicago Argonne, LLC                */
       9             : /*               Under Contract No. DE-AC02-06CH11357               */
      10             : /*                With the U. S. Department of Energy               */
      11             : /*                                                                  */
      12             : /*             Prepared by Battelle Energy Alliance, LLC            */
      13             : /*               Under Contract No. DE-AC07-05ID14517               */
      14             : /*                With the U. S. Department of Energy               */
      15             : /*                                                                  */
      16             : /*                 See LICENSE for full restrictions                */
      17             : /********************************************************************/
      18             : 
      19             : #ifdef ENABLE_OPENMC_COUPLING
      20             : 
      21             : #include "ComputeTCScatterMGXSAux.h"
      22             : 
      23             : registerMooseObject("CardinalApp", ComputeTCScatterMGXSAux);
      24             : 
      25             : InputParameters
      26          72 : ComputeTCScatterMGXSAux::validParams()
      27             : {
      28          72 :   auto params = OpenMCAuxKernel::validParams();
      29          72 :   params.addClassDescription(
      30             :       "An auxkernel that computes a transport-corrected P0 scattering multi-group cross "
      31             :       "section using a list of scattering reaction rates and the group-wise scalar flux. "
      32             :       "This is intended to be added by the MGXS action.");
      33         144 :   params.addRequiredCoupledVar("p0_scatter_rxn_rate",
      34             :                                "The P0 group-wise scattering reaction rates to use for computing "
      35             :                                "the transport-corrected scattering cross section.");
      36         144 :   params.addRequiredCoupledVar("p1_scatter_rxn_rates",
      37             :                                "The P1 group-wise scattering reaction rates to use for computing "
      38             :                                "the transport-corrected scattering cross section.");
      39         144 :   params.addRequiredCoupledVar("scalar_flux",
      40             :                                "The group-wise scalar flux used to compute the transport-corrected "
      41             :                                "scattering cross section.");
      42             : 
      43          72 :   return params;
      44           0 : }
      45             : 
      46          36 : ComputeTCScatterMGXSAux::ComputeTCScatterMGXSAux(const InputParameters & parameters)
      47             :   : OpenMCAuxKernel(parameters),
      48          36 :     _p0_scattering_rates(coupledValue("p0_scatter_rxn_rate")),
      49          72 :     _scalar_flux(coupledValue("scalar_flux"))
      50             : {
      51         216 :   for (unsigned int i = 0; i < coupledComponents("p1_scatter_rxn_rates"); ++i)
      52         144 :     _p1_scattering_rates.emplace_back(&coupledValue("p1_scatter_rxn_rates", i));
      53          36 : }
      54             : 
      55             : Real
      56       40960 : ComputeTCScatterMGXSAux::computeValue()
      57             : {
      58       40960 :   Real num = _p0_scattering_rates[_qp];
      59      122880 :   for (unsigned int g = 0; g < _p1_scattering_rates.size(); ++g)
      60       81920 :     num -= (*_p1_scattering_rates[g])[_qp];
      61             : 
      62       40960 :   return _scalar_flux[_qp] > 0.0 ? num / _scalar_flux[_qp] : 0.0;
      63             : }
      64             : 
      65             : #endif

Generated by: LCOV version 1.14