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 : #include "DelayedGroupFilter.h" 21 : 22 : #include "OpenMCCellAverageProblem.h" 23 : 24 : #include "openmc/tallies/filter_delayedgroup.h" 25 : 26 : registerMooseObject("CardinalApp", DelayedGroupFilter); 27 : 28 : InputParameters 29 22 : DelayedGroupFilter::validParams() 30 : { 31 22 : auto params = FilterBase::validParams(); 32 22 : params.addClassDescription( 33 : "A class which provides a thin wrapper around an OpenMC DelayedGroupFilter."); 34 44 : params.addRequiredRangeCheckedParam<std::vector<int>>( 35 : "dnp_groups", 36 : "dnp_groups > 0 & dnp_groups < 7", 37 : "The delayed neutron precursor bins to filter for. Valid bin indices are integers between 1 " 38 : "and 6 (inclusive)."); 39 : 40 22 : return params; 41 0 : } 42 : 43 12 : DelayedGroupFilter::DelayedGroupFilter(const InputParameters & parameters) 44 24 : : FilterBase(parameters), _delayed_groups(getParam<std::vector<int>>("dnp_groups")) 45 : { 46 12 : if (_openmc_problem.runRandomRay()) 47 2 : mooseError("DelayedGroupFilter is presently not supported when running the random ray solver!"); 48 : 49 20 : _openmc_problem.checkEmptyVector(_delayed_groups, "dnp_groups"); 50 : 51 : // Initialize the OpenMC DelayedGroupFilter. 52 10 : _filter_index = openmc::model::tally_filters.size(); 53 : 54 : auto dnp_grp_filter = 55 20 : dynamic_cast<openmc::DelayedGroupFilter *>(openmc::Filter::create("delayedgroup")); 56 : try 57 : { 58 10 : dnp_grp_filter->set_groups(openmc::span<int>(&_delayed_groups[0], _delayed_groups.size())); 59 : } 60 0 : catch (const std::exception & e) 61 : { 62 0 : paramError("dnp_groups", e.what()); 63 0 : } 64 10 : _filter = dnp_grp_filter; 65 10 : } 66 : 67 : std::string 68 96 : DelayedGroupFilter::binName(unsigned int bin_index) const 69 : { 70 192 : return "d" + Moose::stringify(bin_index + 1); 71 : } 72 : #endif