Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://mooseframework.inl.gov 3 : //* 4 : //* All rights reserved, see COPYRIGHT for full restrictions 5 : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT 6 : //* 7 : //* Licensed under LGPL 2.1, please see LICENSE for details 8 : //* https://www.gnu.org/licenses/lgpl-2.1.html 9 : 10 : #include "HeatSourceFromPowerDensity.h" 11 : #include "HeatStructureInterface.h" 12 : #include "HeatStructureCylindricalBase.h" 13 : 14 : registerMooseObject("ThermalHydraulicsApp", HeatSourceFromPowerDensity); 15 : 16 : InputParameters 17 60 : HeatSourceFromPowerDensity::validParams() 18 : { 19 60 : InputParameters params = HeatSourceBase::validParams(); 20 120 : params.addRequiredParam<VariableName>("power_density", "Power density variable"); 21 60 : params.addClassDescription("Heat source from power density"); 22 60 : return params; 23 0 : } 24 : 25 30 : HeatSourceFromPowerDensity::HeatSourceFromPowerDensity(const InputParameters & parameters) 26 30 : : HeatSourceBase(parameters), _power_density_name(getParam<VariableName>("power_density")) 27 : { 28 30 : } 29 : 30 : void 31 26 : HeatSourceFromPowerDensity::addMooseObjects() 32 : { 33 : /// The heat structure component we work with 34 26 : const HeatStructureInterface & hs = getComponent<HeatStructureInterface>("hs"); 35 : const HeatStructureCylindricalBase * hs_cyl = 36 26 : dynamic_cast<const HeatStructureCylindricalBase *>(&hs); 37 : const bool is_cylindrical = hs_cyl != nullptr; 38 : 39 : { 40 34 : const std::string class_name = is_cylindrical ? "CoupledForceRZ" : "CoupledForce"; 41 26 : InputParameters pars = _factory.getValidParams(class_name); 42 52 : pars.set<NonlinearVariableName>("variable") = HeatConductionModel::TEMPERATURE; 43 26 : pars.set<std::vector<SubdomainName>>("block") = _subdomain_names; 44 52 : pars.set<std::vector<VariableName>>("v") = std::vector<VariableName>(1, _power_density_name); 45 26 : if (is_cylindrical) 46 : { 47 18 : pars.set<Point>("axis_point") = hs_cyl->getPosition(); 48 18 : pars.set<RealVectorValue>("axis_dir") = hs_cyl->getDirection(); 49 : } 50 52 : std::string mon = genName(name(), "heat_src"); 51 26 : getTHMProblem().addKernel(class_name, mon, pars); 52 26 : } 53 26 : }