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 968 : ComputeMGXSAux::validParams() 27 : { 28 968 : auto params = OpenMCAuxKernel::validParams(); 29 968 : 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 1936 : params.addRequiredCoupledVar( 34 : "rxn_rates", 35 : "The group-wise reaction rates to use for computing the multi-group cross section."); 36 1936 : 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 968 : return params; 41 0 : } 42 : 43 484 : ComputeMGXSAux::ComputeMGXSAux(const InputParameters & parameters) : OpenMCAuxKernel(parameters) 44 : { 45 2016 : for (unsigned int i = 0; i < coupledComponents("rxn_rates"); ++i) 46 1048 : _mg_reaction_rates.emplace_back(&coupledValue("rxn_rates", i)); 47 : 48 2056 : for (unsigned int i = 0; i < coupledComponents("normalize_by"); ++i) 49 1088 : _norm_factors.emplace_back(&coupledValue("normalize_by", i)); 50 484 : } 51 : 52 : Real 53 524288 : ComputeMGXSAux::computeValue() 54 : { 55 : Real mgxs = 0.0; 56 : Real norm = 0.0; 57 1097728 : for (unsigned int i = 0; i < _mg_reaction_rates.size(); ++i) 58 573440 : mgxs += (*_mg_reaction_rates[i])[_qp]; 59 1122304 : for (unsigned int i = 0; i < _norm_factors.size(); ++i) 60 598016 : norm += (*_norm_factors[i])[_qp]; 61 : 62 524288 : return norm > 0.0 ? mgxs / norm : 0.0; 63 : } 64 : 65 : #endif