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 : #include "VolumetricHeatSourceICAction.h" 20 : #include "FEProblem.h" 21 : 22 : registerMooseAction("CardinalApp", VolumetricHeatSourceICAction, "add_heat_source_ic"); 23 : registerMooseAction("CardinalApp", VolumetricHeatSourceICAction, "add_heat_source_postprocessor"); 24 : 25 : InputParameters 26 12 : VolumetricHeatSourceICAction::validParams() 27 : { 28 12 : InputParameters params = CardinalAction::validParams(); 29 24 : params.addRequiredParam<FunctionName>("function", "Function providing shape of the heat source"); 30 24 : params.addRequiredParam<VariableName>("variable", "Name of the volumetric heat source variable"); 31 24 : params.addRequiredParam<Real>("magnitude", "Magnitude of the heat source upon integration"); 32 12 : return params; 33 0 : } 34 : 35 12 : VolumetricHeatSourceICAction::VolumetricHeatSourceICAction(const InputParameters & parameters) 36 : : CardinalAction(parameters), 37 12 : _variable(getParam<VariableName>("variable")), 38 24 : _function(getParam<FunctionName>("function")), 39 36 : _magnitude(getParam<Real>("magnitude")) 40 : { 41 12 : } 42 : 43 : void 44 24 : VolumetricHeatSourceICAction::act() 45 : { 46 24 : if (_current_task == "add_heat_source_postprocessor") 47 : { 48 12 : const std::string pp_type = "FunctionElementIntegral"; 49 12 : InputParameters params = _factory.getValidParams(pp_type); 50 12 : params.set<FunctionName>("function") = _function; 51 12 : params.set<ExecFlagEnum>("execute_on") = EXEC_INITIAL; 52 : 53 12 : setObjectBlocks(params, _blocks); 54 : 55 36 : params.set<std::vector<OutputName>>("outputs") = {"none"}; 56 12 : _problem->addPostprocessor(pp_type, "cardinal_heat_source_integral", params); 57 12 : } 58 : 59 24 : if (_current_task == "add_heat_source_ic") 60 : { 61 12 : const std::string ic_type = "IntegralPreservingFunctionIC"; 62 12 : InputParameters params = _factory.getValidParams(ic_type); 63 24 : params.set<VariableName>("variable") = _variable; 64 24 : params.set<PostprocessorName>("integral") = "cardinal_heat_source_integral"; 65 12 : params.set<FunctionName>("function") = _function; 66 12 : params.set<Real>("magnitude") = _magnitude; 67 : 68 12 : setObjectBlocks(params, _blocks); 69 : 70 12 : _problem->addInitialCondition(ic_type, "cardinal_heat_source_ic", params); 71 12 : } 72 24 : }