https://mooseframework.inl.gov
HSBoundaryHeatFlux.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 
10 #include "HSBoundaryHeatFlux.h"
11 #include "HeatConductionModel.h"
12 #include "HeatStructureInterface.h"
14 
15 registerMooseObject("ThermalHydraulicsApp", HSBoundaryHeatFlux);
16 
19 {
21 
22  params.addRequiredParam<FunctionName>("q", "Heat flux [W/m^2]");
23  params.addParam<FunctionName>("scale", 1.0, "Function by which to scale the boundary condition");
24  params.addParam<bool>(
25  "scale_heat_rate_pp",
26  true,
27  "If true, the scaling function is applied to the heat rate post-processor.");
28 
29  params.addClassDescription("Applies a specified heat flux to a heat structure boundary");
30 
31  return params;
32 }
33 
35  : HSBoundary(params),
36 
37  _q_fn_name(getParam<FunctionName>("q"))
38 {
39 }
40 
41 void
43 {
44  const HeatStructureInterface & hs = getComponent<HeatStructureInterface>("hs");
45  const HeatStructureCylindricalBase * hs_cyl =
46  dynamic_cast<const HeatStructureCylindricalBase *>(&hs);
47  const bool is_cylindrical = hs_cyl != nullptr;
48 
49  {
50  const std::string class_name = is_cylindrical ? "ADHSHeatFluxRZBC" : "ADHSHeatFluxBC";
51  InputParameters pars = _factory.getValidParams(class_name);
52  pars.set<NonlinearVariableName>("variable") = HeatConductionModel::TEMPERATURE;
53  pars.set<std::vector<BoundaryName>>("boundary") = _boundary;
54  pars.set<FunctionName>("function") = _q_fn_name;
55  if (is_cylindrical)
56  {
57  pars.set<Point>("axis_point") = hs_cyl->getPosition();
58  pars.set<RealVectorValue>("axis_dir") = hs_cyl->getDirection();
59  }
60  pars.set<FunctionName>("scale") = getParam<FunctionName>("scale");
61 
62  getTHMProblem().addBoundaryCondition(class_name, genName(name(), "bc"), pars);
63  }
64 
65  // Create integral PP for cylindrical heat structures
66  if (is_cylindrical)
67  {
68  const std::string class_name = "HeatRateHeatFluxRZ";
69  InputParameters pars = _factory.getValidParams(class_name);
70  pars.set<std::vector<BoundaryName>>("boundary") = _boundary;
71  pars.set<FunctionName>("function") = _q_fn_name;
72  pars.set<Point>("axis_point") = hs_cyl->getPosition();
73  pars.set<RealVectorValue>("axis_dir") = hs_cyl->getDirection();
74  if (getParam<bool>("scale_heat_rate_pp"))
75  pars.set<FunctionName>("scale") = getParam<FunctionName>("scale");
76  pars.set<ExecFlagEnum>("execute_on") = {EXEC_INITIAL, EXEC_TIMESTEP_END};
77  getTHMProblem().addPostprocessor(class_name, genSafeName(name(), "integral"), pars);
78  }
79 }
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.
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
const FunctionName & _q_fn_name
Heat flux function name.
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
Applies a specified heat flux to a heat structure boundary.
const ExecFlagType EXEC_TIMESTEP_END
std::string genSafeName(const std::string &prefix, const std::string &middle, const std::string &suffix="") const
Build a name from strings that is safe to use in input files (i.e.
HSBoundaryHeatFlux(const InputParameters &params)
static InputParameters validParams()
void addRequiredParam(const std::string &name, const std::string &doc_string)
virtual void addBoundaryCondition(const std::string &bc_name, const std::string &name, InputParameters &parameters)
virtual void addPostprocessor(const std::string &pp_name, const std::string &name, InputParameters &parameters)
const std::string & name() const
Base class for cylindrical heat structure components.
const std::vector< BoundaryName > & _boundary
Boundary names for which the boundary component applies.
Definition: HSBoundary.h:56
static const std::string TEMPERATURE
registerMooseObject("ThermalHydraulicsApp", HSBoundaryHeatFlux)
Interface class for heat structure components.
virtual void addMooseObjects() override
static InputParameters validParams()
Definition: HSBoundary.C:15
Factory & _factory
The Factory associated with the MooseApp.
Definition: Component.h:497
void addClassDescription(const std::string &doc_string)
Base class for heat structure boundary components.
Definition: HSBoundary.h:18
const ExecFlagType EXEC_INITIAL