https://mooseframework.inl.gov
HSBoundaryInterface.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 "HSBoundaryInterface.h"
11 #include "Component.h"
12 #include "THMMesh.h"
13 
16 {
18 
19  params.addRequiredParam<std::string>("hs", "Heat structure name");
21  "hs_side", Component2D::getExternalBoundaryTypeMooseEnum(), "Heat structure side");
22 
23  return params;
24 }
25 
27  : _hs_name(component->getParam<std::string>("hs")),
28  _hs_side_enum(component->getParam<MooseEnum>("hs_side")),
29  _hs_side(component->getEnumParam<Component2D::ExternalBoundaryType>("hs_side")),
30  _hs_side_valid(static_cast<int>(_hs_side) >= 0)
31 {
32  component->addDependency(_hs_name);
33 }
34 
35 void
37 {
38  component->checkComponentOfTypeExistsByName<HeatStructureBase>(_hs_name);
39 
40  if (component->hasComponentByName<HeatStructureBase>(_hs_name))
41  {
42  const HeatStructureBase & hs = component->getComponentByName<HeatStructureBase>(_hs_name);
43 
44  if (_hs_side_valid)
45  {
46  const Real & P_hs = hs.getUnitPerimeter(_hs_side);
47  if (MooseUtils::absoluteFuzzyEqual(P_hs, 0.))
48  component->logError("'hs_side' parameter is set to '",
50  "', but this side of the heat structure '",
51  _hs_name,
52  "' has radius of zero.");
53 
54  if (std::isnan(P_hs))
55  component->logError("Invalid side '",
57  "'. This side does not have unit perimeter. You probably want to use "
58  "'INNER' or 'OUTER' side instead.");
59  }
60  }
61 }
62 
63 const BoundaryName &
65 {
66  const HeatStructureBase & hs = component->getComponentByName<HeatStructureBase>(_hs_name);
68 }
const BoundaryName & getExternalBoundaryName(const ExternalBoundaryType &boundary_type) const
Gets the name of an external boundary by type.
Definition: Component2D.C:550
bool absoluteFuzzyEqual(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
const Component2D::ExternalBoundaryType _hs_side
Heat structure side.
static const std::string component
Definition: NS.h:153
static MooseEnum getExternalBoundaryTypeMooseEnum(const std::string &default_value="")
Gets the MooseEnum corresponding to ExternalBoundaryType.
Definition: Component2D.C:21
const BoundaryName & getHSBoundaryName(const Component *const component) const
Gets the boundary name corresponding to the heat structure and side.
void addRequiredParam(const std::string &name, const std::string &doc_string)
InputParameters emptyInputParameters()
HSBoundaryInterface(Component *component)
void check(const Component *const component) const
virtual Real getUnitPerimeter(const ExternalBoundaryType &side) const =0
Gets the perimeter of one unit of this heat structure on the specified side.
Base class for THM components.
Definition: Component.h:27
const bool _hs_side_valid
True if valid heat structure side was provided.
const std::string & _hs_name
Heat structure name.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Base class for 2D generated heat structures.
const MooseEnum & _hs_side_enum
Heat structure side enum.
static InputParameters validParams()
void ErrorVector unsigned int