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 "ComputeDiffusionCoeffMGAux.h" 22 : 23 : registerMooseObject("CardinalApp", ComputeDiffusionCoeffMGAux); 24 : 25 : InputParameters 26 88 : ComputeDiffusionCoeffMGAux::validParams() 27 : { 28 88 : auto params = OpenMCAuxKernel::validParams(); 29 88 : params.addClassDescription( 30 : "An auxkernel that computes a multi-group diffusion coefficient using a group-wise total " 31 : "reaction rate, a list of group-wise P1 scattering reaction rates, and the group-wise " 32 : "scalar flux. This is intended to be added by the MGXS action."); 33 176 : params.addRequiredCoupledVar( 34 : "total_rxn_rate", 35 : "The total reaction rates to use for computing the multi-group diffusion coefficient."); 36 176 : params.addRequiredCoupledVar("p1_scatter_rxn_rates", 37 : "The P1 group-wise scattering reaction rates to use for computing " 38 : "the multi-group diffusion coefficient."); 39 176 : params.addRequiredCoupledVar( 40 : "scalar_flux", 41 : "The group-wise scalar flux used for computing the multi-group diffusion coefficient."); 42 176 : params.addParam<Real>("void_diffusion_coefficient", 43 176 : 1e3, 44 : "The value the diffusion coefficient should take in a void region."); 45 : 46 88 : return params; 47 0 : } 48 : 49 44 : ComputeDiffusionCoeffMGAux::ComputeDiffusionCoeffMGAux(const InputParameters & parameters) 50 : : OpenMCAuxKernel(parameters), 51 44 : _void_diff(getParam<Real>("void_diffusion_coefficient")), 52 44 : _total_rxn_rate(coupledValue("total_rxn_rate")), 53 88 : _scalar_flux(coupledValue("scalar_flux")) 54 : { 55 248 : for (unsigned int i = 0; i < coupledComponents("p1_scatter_rxn_rates"); ++i) 56 160 : _p1_scattering_rates.emplace_back(&coupledValue("p1_scatter_rxn_rates", i)); 57 44 : } 58 : 59 : Real 60 49152 : ComputeDiffusionCoeffMGAux::computeValue() 61 : { 62 49152 : Real num = _total_rxn_rate[_qp]; 63 139264 : for (unsigned int g = 0; g < _p1_scattering_rates.size(); ++g) 64 90112 : num -= (*_p1_scattering_rates[g])[_qp]; 65 : 66 49152 : const Real transport_xs = _scalar_flux[_qp] > 0.0 ? num / _scalar_flux[_qp] : 0.0; 67 : const Real diff_coeff = 68 49152 : transport_xs > libMesh::TOLERANCE ? 1.0 / (3.0 * transport_xs) : _void_diff; 69 49152 : return diff_coeff; 70 : } 71 : 72 : #endif