https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
12
14
17{
19
20 params.addRequiredParam<FunctionName>("heat_transfer_coefficient",
21 "Heat transfer coefficient function [W/(m^2-K)]");
22
24 "Couples boundaries of two 2D heat structures via a heat transfer coefficient");
25
26 return params;
27}
28
33
34void
36{
38
40 logError("The primary and secondary boundaries must be aligned.");
41}
42
43void
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}
registerMooseObject("ThermalHydraulicsApp", HeatStructure2DCoupler)
const std::string name
Definition Setup.h:21
virtual void addMooseObjects()
Definition Component.h:115
void logError(Args &&... args) const
Logs an error.
Definition Component.h:226
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 addBoundaryCondition(const std::string &bc_name, const std::string &name, InputParameters &parameters)
InputParameters getValidParams(const std::string &name) const
static const std::string TEMPERATURE
Couples boundaries of two 2D heat structures.
virtual void check() const override
Check the component integrity.
MeshAlignment _mesh_alignment
Mesh alignment.
const std::vector< std::string > _hs_names
Primary and secondary heat structure names.
static InputParameters validParams()
std::vector< bool > _is_cylindrical
Flag for each heat structure deriving from HeatStructureCylindricalBase.
const std::vector< BoundaryName > _hs_boundaries
Primary and secondary heat structure boundaries.
std::vector< Real > _coupling_area_fractions
Area fractions by which to multiply coupling terms.
Couples boundaries of two 2D heat structures via a heat transfer coefficient.
virtual void check() const override
Check the component integrity.
static InputParameters validParams()
HeatStructure2DCoupler(const InputParameters &parameters)
virtual void addMooseObjects() override
Base class for 2D generated heat structures.
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)
bool meshesAreAligned() const
Returns true if the primary and secondary meshes are aligned.
Builds mapping between two aligned subdomains/boundaries.
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.