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 "KEigenvalue.h" 22 : 23 : registerMooseObject("CardinalApp", KEigenvalue); 24 : 25 : InputParameters 26 2233 : KEigenvalue::validParams() 27 : { 28 2233 : InputParameters params = GeneralPostprocessor::validParams(); 29 2233 : params += OpenMCBase::validParams(); 30 2233 : params.addClassDescription("k eigenvalue computed by OpenMC"); 31 4466 : params.addParam<MooseEnum>("value_type", 32 4466 : getEigenvalueEnum(), 33 : "Type of eigenvalue global tally to report"); 34 4466 : params.addParam<MooseEnum>( 35 : "output", 36 4466 : getStatsOutputEnum(), 37 : "The value to output. Options are $k_{eff}$ (mean), the standard deviation " 38 : "of $k_{eff}$ (std_dev), or the relative error of $k_{eff}$ (rel_err)."); 39 2233 : return params; 40 0 : } 41 : 42 731 : KEigenvalue::KEigenvalue(const InputParameters & parameters) 43 : : GeneralPostprocessor(parameters), 44 : OpenMCBase(this, parameters), 45 731 : _type(getParam<MooseEnum>("value_type").getEnum<eigenvalue::EigenvalueEnum>()), 46 2193 : _output(getParam<MooseEnum>("output").getEnum<statistics::OutputEnum>()) 47 : { 48 731 : if (openmc::settings::run_mode != openmc::RunMode::EIGENVALUE) 49 4 : mooseError("Eigenvalues are only computed when running OpenMC in eigenvalue mode!"); 50 727 : } 51 : 52 : Real 53 740 : KEigenvalue::getValue() const 54 : { 55 740 : switch (_output) 56 : { 57 578 : case statistics::OutputEnum::Mean: 58 578 : return kMean(_type); 59 : 60 98 : case statistics::OutputEnum::StDev: 61 98 : return kStandardDeviation(_type); 62 : 63 64 : case statistics::OutputEnum::RelError: 64 64 : return kRelativeError(); 65 : 66 0 : default: 67 0 : mooseError("Internal error: Unhandled statistics::OutputEnum enum in KEigenvalue."); 68 : break; 69 : } 70 : } 71 : 72 : Real 73 94 : KEigenvalue::kRelativeError() const 74 : { 75 94 : const auto mean = kMean(_type); 76 94 : return mean > 0.0 ? kStandardDeviation(_type) / mean : 0.0; 77 : } 78 : 79 : #endif