LCOV - code coverage report
Current view: top level - src/auxkernels - ComputeMGXSAux.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 "ComputeMGXSAux.h"
      22             : 
      23             : registerMooseObject("CardinalApp", ComputeMGXSAux);
      24             : 
      25             : InputParameters
      26        1208 : ComputeMGXSAux::validParams()
      27             : {
      28        1208 :   auto params = OpenMCAuxKernel::validParams();
      29        1208 :   params.addClassDescription(
      30             :       "An auxkernel that computes a multi-group cross section using a list of group-wise reaction "
      31             :       "rates and a list of "
      32             :       "normalization factors. This is intended to be added by the MGXS action.");
      33        2416 :   params.addRequiredCoupledVar(
      34             :       "rxn_rates",
      35             :       "The group-wise reaction rates to use for computing the multi-group cross section.");
      36        2416 :   params.addRequiredCoupledVar("normalize_by",
      37             :                                "The normalization factor to use when computing multi-group cross "
      38             :                                "sections. This is usually the group-wise scalar flux.");
      39             : 
      40        1208 :   return params;
      41           0 : }
      42             : 
      43         604 : ComputeMGXSAux::ComputeMGXSAux(const InputParameters & parameters) : OpenMCAuxKernel(parameters)
      44             : {
      45        2576 :   for (unsigned int i = 0; i < coupledComponents("rxn_rates"); ++i)
      46        1368 :     _mg_reaction_rates.emplace_back(&coupledValue("rxn_rates", i));
      47             : 
      48        2656 :   for (unsigned int i = 0; i < coupledComponents("normalize_by"); ++i)
      49        1448 :     _norm_factors.emplace_back(&coupledValue("normalize_by", i));
      50         604 : }
      51             : 
      52             : Real
      53   228383744 : ComputeMGXSAux::computeValue()
      54             : {
      55             :   Real mgxs = 0.0;
      56             :   Real norm = 0.0;
      57   532769792 :   for (unsigned int i = 0; i < _mg_reaction_rates.size(); ++i)
      58   304386048 :     mgxs += (*_mg_reaction_rates[i])[_qp];
      59   570770944 :   for (unsigned int i = 0; i < _norm_factors.size(); ++i)
      60   342387200 :     norm += (*_norm_factors[i])[_qp];
      61             : 
      62   228383744 :   return norm > 0.0 ? mgxs / norm : 0.0;
      63             : }
      64             : 
      65             : #endif

Generated by: LCOV version 1.14