Line data Source code
1 : /**********************************************************************/ 2 : /* DO NOT MODIFY THIS HEADER */ 3 : /* MAGPIE - Mesoscale Atomistic Glue Program for Integrated Execution */ 4 : /* */ 5 : /* Copyright 2017 Battelle Energy Alliance, LLC */ 6 : /* ALL RIGHTS RESERVED */ 7 : /**********************************************************************/ 8 : 9 : #include "IsotopeRecoilRateSampler.h" 10 : #include "NeutronicsSpectrumSamplerBase.h" 11 : 12 : // MOOSE includes 13 : #include "MooseMesh.h" 14 : #include "MooseVariable.h" 15 : 16 : #include "libmesh/mesh_tools.h" 17 : 18 : registerMooseObject("MagpieApp", IsotopeRecoilRateSampler); 19 : 20 : InputParameters 21 0 : IsotopeRecoilRateSampler::validParams() 22 : { 23 0 : InputParameters params = GeneralVectorPostprocessor::validParams(); 24 0 : params.addRequiredParam<std::string>( 25 : "target_isotope", "The isotope name that you want to get the total recoil rate for"); 26 0 : params.addRequiredParam<std::vector<unsigned int>>( 27 : "point_ids", "The indices of the points in neutronics_sampler"); 28 0 : params.addRequiredParam<UserObjectName>( 29 : "neutronics_sampler", "The neutronics sampler object that the data is retrieved from"); 30 0 : params.addParam<PostprocessorName>( 31 0 : "scaling_factor", 1, "A scaling factor multiplying the isotope recoil rate"); 32 0 : params.addClassDescription("Gets the total recoil rate from target_isotope at points provided in " 33 : "point_id contained in the neutronics_sampler"); 34 0 : return params; 35 0 : } 36 : 37 0 : IsotopeRecoilRateSampler::IsotopeRecoilRateSampler(const InputParameters & parameters) 38 : : GeneralVectorPostprocessor(parameters), 39 0 : _target_isotope(getParam<std::string>("target_isotope")), 40 0 : _point_ids(getParam<std::vector<unsigned int>>("point_ids")), 41 0 : _neutronics_sampler(getUserObject<NeutronicsSpectrumSamplerBase>("neutronics_sampler")), 42 0 : _scaling_factor(getPostprocessorValue("scaling_factor")), 43 0 : _recoil_rates(declareVector("recoil_rates")) 44 : { 45 0 : _recoil_rates.assign(_point_ids.size(), 0); 46 0 : for (auto & p : _point_ids) 47 0 : if (_neutronics_sampler.getNumberOfPoints() < p) 48 0 : mooseError("The provided neutronics sampler object only has", 49 0 : _neutronics_sampler.getNumberOfPoints(), 50 : " points but point id ", 51 : p, 52 : " is requested"); 53 : 54 0 : if (!_neutronics_sampler.hasIsotope(_target_isotope)) 55 0 : mooseError("Target isotope ", _target_isotope, " not preset in neutronics sampler object"); 56 0 : } 57 : 58 : void 59 0 : IsotopeRecoilRateSampler::execute() 60 : { 61 0 : for (unsigned int j = 0; j < _point_ids.size(); ++j) 62 0 : _recoil_rates[j] = 63 0 : _scaling_factor * _neutronics_sampler.totalRecoilRate(_point_ids[j], _target_isotope); 64 0 : }