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 "EnergyOutFilter.h" 21 : 22 : #include "OpenMCCellAverageProblem.h" 23 : #include "EnergyGroupStructures.h" 24 : #include "EnergyFilter.h" 25 : #include "CardinalEnums.h" 26 : 27 : #include "openmc/tallies/filter_energy.h" 28 : 29 : registerMooseObject("CardinalApp", EnergyOutFilter); 30 : 31 : InputParameters 32 170 : EnergyOutFilter::validParams() 33 : { 34 170 : auto params = FilterBase::validParams(); 35 170 : params += EnergyBinBase::validParams(); 36 170 : params.addClassDescription( 37 : "A class which provides a thin wrapper around an OpenMC EnergyOutFilter. Energy bins " 38 : "can either be manually specified in 'energy_boundaries' or picked from a list " 39 : "provided in 'group_structure'."); 40 : 41 170 : return params; 42 0 : } 43 : 44 86 : EnergyOutFilter::EnergyOutFilter(const InputParameters & parameters) 45 86 : : FilterBase(parameters), EnergyBinBase(this, parameters) 46 : { 47 86 : if (_openmc_problem.runRandomRay()) 48 2 : mooseError("EnergyOutFilter is presently not supported when running the random ray solver!"); 49 : 50 : // Initialize the OpenMC EnergyoutFilter. 51 84 : _filter_index = openmc::model::tally_filters.size(); 52 : 53 : auto energy_out_filter = 54 84 : dynamic_cast<openmc::EnergyoutFilter *>(openmc::Filter::create("energyout")); 55 84 : energy_out_filter->set_bins(_energy_bnds); 56 84 : _filter = energy_out_filter; 57 84 : } 58 : 59 : std::string 60 320 : EnergyOutFilter::binName(unsigned int bin_index) const 61 : { 62 320 : return "gp" + (_reverse_bins ? Moose::stringify(_energy_bnds.size() - bin_index - 1) 63 640 : : Moose::stringify(bin_index + 1)); 64 : } 65 : 66 : #endif