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 "BulkEnergyConservationIC.h" 20 : 21 : registerMooseObject("CardinalApp", BulkEnergyConservationIC); 22 : 23 : InputParameters 24 33 : BulkEnergyConservationIC::validParams() 25 : { 26 33 : InputParameters params = InitialCondition::validParams(); 27 66 : params.addRequiredParam<UserObjectName>( 28 : "layered_integral", 29 : "User object providing the cumulative integral of the heat source in layers " 30 : "in the direction of fluid flow"); 31 66 : params.addRequiredParam<Real>("mass_flowrate", "Mass flowrate of the fluid"); 32 66 : params.addRequiredParam<Real>("cp", "Fluid isobaric specific heat capacity"); 33 66 : params.addRequiredRangeCheckedParam<Real>("inlet_T", "inlet_T >= 0.0", "Inlet temperature"); 34 : 35 66 : params.addRequiredParam<PostprocessorName>( 36 : "integral", "Postprocessor providing the integral of the heat source, for normalization"); 37 66 : params.addRequiredParam<Real>("magnitude", "Magnitude of the heat source"); 38 33 : return params; 39 0 : } 40 : 41 18 : BulkEnergyConservationIC::BulkEnergyConservationIC(const InputParameters & parameters) 42 : : InitialCondition(parameters), 43 18 : _layered_integral(getUserObject<FunctionLayeredIntegral>("layered_integral")), 44 36 : _mdot(getParam<Real>("mass_flowrate")), 45 36 : _cp(getParam<Real>("cp")), 46 36 : _inlet_T(getParam<Real>("inlet_T")), 47 36 : _pp_name(getParam<PostprocessorName>("integral")), 48 18 : _integral(getPostprocessorValue("integral")), 49 54 : _magnitude(getParam<Real>("magnitude")) 50 : { 51 18 : if (std::abs(_mdot * _cp) < libMesh::TOLERANCE) 52 3 : mooseError("Product of mass flowrate and specific heat cannot be zero!"); 53 15 : } 54 : 55 : void 56 12 : BulkEnergyConservationIC::initialSetup() 57 : { 58 12 : const UserObject & pp = _fe_problem.getUserObject<UserObject>(_pp_name); 59 12 : if (!pp.getExecuteOnEnum().contains(EXEC_INITIAL)) 60 0 : paramError("execute_on", 61 0 : "The 'execute_on' parameter for the '" + _pp_name + 62 : "' postprocessor must include 'initial'!"); 63 12 : } 64 : 65 : Real 66 6000 : BulkEnergyConservationIC::value(const Point & p) 67 : { 68 6000 : if (std::abs(_integral) < libMesh::TOLERANCE) 69 0 : mooseError("The volume integral of '" + _pp_name + "' cannot be zero!"); 70 : 71 6000 : Real power = _magnitude * _layered_integral.spatialValue(p) / _integral; 72 6000 : return power / (_mdot * _cp) + _inlet_T; 73 : }