https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
13
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
30void
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}
registerMooseObject("ThermalHydraulicsApp", HeatSourceFromPowerDensity)
const std::string name
Definition Setup.h:21
THMProblem & getTHMProblem() const
Gets the THM problem.
Definition Component.C:135
Factory & _factory
The Factory associated with the MooseApp.
Definition Component.h:497
virtual RealVectorValue getDirection() const
virtual void addKernel(const std::string &kernel_name, const std::string &name, InputParameters &parameters)
InputParameters getValidParams(const std::string &name) const
static const std::string TEMPERATURE
Base class for heat source components.
std::vector< SubdomainName > _subdomain_names
Names of the heat structure subdomains corresponding to the given regions.
static InputParameters validParams()
Heat source from power density.
static InputParameters validParams()
const VariableName _power_density_name
The name of the power density variable (typically an aux variable)
virtual void addMooseObjects() override
HeatSourceFromPowerDensity(const InputParameters &parameters)
Base class for cylindrical heat structure components.
Interface class for heat structure components.
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
T & set(const std::string &name, bool quiet_mode=false)
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.