https://mooseframework.inl.gov
HeatSourceFromPowerDensity.C
Go to the documentation of this file.
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 
11 #include "HeatStructureInterface.h"
13 
14 registerMooseObject("ThermalHydraulicsApp", HeatSourceFromPowerDensity);
15 
18 {
20  params.addRequiredParam<VariableName>("power_density", "Power density variable");
21  params.addClassDescription("Heat source from power density");
22  return params;
23 }
24 
26  : HeatSourceBase(parameters), _power_density_name(getParam<VariableName>("power_density"))
27 {
28 }
29 
30 void
32 {
34  const HeatStructureInterface & hs = getComponent<HeatStructureInterface>("hs");
35  const HeatStructureCylindricalBase * hs_cyl =
36  dynamic_cast<const HeatStructureCylindricalBase *>(&hs);
37  const bool is_cylindrical = hs_cyl != nullptr;
38 
39  {
40  const std::string class_name = is_cylindrical ? "CoupledForceRZ" : "CoupledForce";
41  InputParameters pars = _factory.getValidParams(class_name);
42  pars.set<NonlinearVariableName>("variable") = HeatConductionModel::TEMPERATURE;
43  pars.set<std::vector<SubdomainName>>("block") = _subdomain_names;
44  pars.set<std::vector<VariableName>>("v") = std::vector<VariableName>(1, _power_density_name);
45  if (is_cylindrical)
46  {
47  pars.set<Point>("axis_point") = hs_cyl->getPosition();
48  pars.set<RealVectorValue>("axis_dir") = hs_cyl->getDirection();
49  }
50  std::string mon = genName(name(), "heat_src");
51  getTHMProblem().addKernel(class_name, mon, pars);
52  }
53 }
std::string genName(const std::string &prefix, unsigned int id, const std::string &suffix="") const
Build a name from a prefix, number and possible suffix.
const VariableName _power_density_name
The name of the power density variable (typically an aux variable)
THMProblem & getTHMProblem() const
Gets the THM problem.
Definition: Component.C:135
T & set(const std::string &name, bool quiet_mode=false)
InputParameters getValidParams(const std::string &name) const
virtual void addKernel(const std::string &kernel_name, const std::string &name, InputParameters &parameters)
virtual const std::string & name() const
static InputParameters validParams()
virtual void addMooseObjects() override
void addRequiredParam(const std::string &name, const std::string &doc_string)
HeatSourceFromPowerDensity(const InputParameters &parameters)
static InputParameters validParams()
Base class for cylindrical heat structure components.
static const std::string TEMPERATURE
Interface class for heat structure components.
Base class for heat source components.
Factory & _factory
The Factory associated with the MooseApp.
Definition: Component.h:446
Heat source from power density.
void addClassDescription(const std::string &doc_string)
std::vector< SubdomainName > _subdomain_names
Names of the heat structure subdomains corresponding to the given regions.
registerMooseObject("ThermalHydraulicsApp", HeatSourceFromPowerDensity)