https://mooseframework.inl.gov
HeatStructure2DCoupler.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 "HeatStructure2DCoupler.h"
12 
13 registerMooseObject("ThermalHydraulicsApp", HeatStructure2DCoupler);
14 
17 {
19 
20  params.addRequiredParam<FunctionName>("heat_transfer_coefficient",
21  "Heat transfer coefficient function [W/(m^2-K)]");
22 
23  params.addClassDescription(
24  "Couples boundaries of two 2D heat structures via a heat transfer coefficient");
25 
26  return params;
27 }
28 
30  : HeatStructure2DCouplerBase(parameters)
31 {
32 }
33 
34 void
36 {
38 
40  logError("The primary and secondary boundaries must be aligned.");
41 }
42 
43 void
45 {
47 
48  for (unsigned int i = 0; i < 2; i++)
49  {
50  const HeatStructureBase & hs = getComponentByName<HeatStructureBase>(_hs_names[i]);
51 
52  const std::string class_name =
53  _is_cylindrical[i] ? "HeatStructure2DCouplerRZBC" : "HeatStructure2DCouplerBC";
54  InputParameters params = _factory.getValidParams(class_name);
55  params.set<NonlinearVariableName>("variable") = HeatConductionModel::TEMPERATURE;
56  params.set<std::string>("coupled_variable") = HeatConductionModel::TEMPERATURE;
57  params.set<std::vector<BoundaryName>>("boundary") = {_hs_boundaries[i]};
58  params.set<MeshAlignment *>("_mesh_alignment") = &_mesh_alignment;
59  params.set<FunctionName>("heat_transfer_coefficient") =
60  getParam<FunctionName>("heat_transfer_coefficient");
61  params.set<Real>("coupling_area_fraction") = _coupling_area_fractions[i];
62  if (_is_cylindrical[i])
63  {
64  params.set<Point>("axis_point") = hs.getPosition();
65  params.set<RealVectorValue>("axis_dir") = hs.getDirection();
66  }
67  getTHMProblem().addBoundaryCondition(class_name, genName(name(), class_name, i), params);
68  }
69 }
static InputParameters validParams()
static InputParameters validParams()
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 std::vector< BoundaryName > _hs_boundaries
Primary and secondary heat structure boundaries.
THMProblem & getTHMProblem() const
Gets the THM problem.
Definition: Component.C:135
T & set(const std::string &name, bool quiet_mode=false)
virtual RealVectorValue getDirection() const
InputParameters getValidParams(const std::string &name) const
Builds mapping between two aligned subdomains/boundaries.
Definition: MeshAlignment.h:24
Couples boundaries of two 2D heat structures via a heat transfer coefficient.
virtual void addMooseObjects() override
virtual const std::string & name() const
void addRequiredParam(const std::string &name, const std::string &doc_string)
bool meshesAreAligned() const
Returns true if the primary and secondary meshes are aligned.
virtual void addBoundaryCondition(const std::string &bc_name, const std::string &name, InputParameters &parameters)
void logError(Args &&... args) const
Logs an error.
Definition: Component.h:215
std::vector< bool > _is_cylindrical
Flag for each heat structure deriving from HeatStructureCylindricalBase.
HeatStructure2DCoupler(const InputParameters &parameters)
static const std::string TEMPERATURE
std::vector< Real > _coupling_area_fractions
Area fractions by which to multiply coupling terms.
MeshAlignment _mesh_alignment
Mesh alignment.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Factory & _factory
The Factory associated with the MooseApp.
Definition: Component.h:446
Base class for 2D generated heat structures.
void addClassDescription(const std::string &doc_string)
virtual void addMooseObjects()
Definition: Component.h:114
registerMooseObject("ThermalHydraulicsApp", HeatStructure2DCoupler)
const std::vector< std::string > _hs_names
Primary and secondary heat structure names.
virtual void check() const override
Check the component integrity.
Couples boundaries of two 2D heat structures.
virtual void check() const override
Check the component integrity.