https://mooseframework.inl.gov
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
HSBoundaryInterface Class Reference

Interface class for coupling to a heat structure boundary. More...

#include <HSBoundaryInterface.h>

Inheritance diagram for HSBoundaryInterface:
[legend]

Public Member Functions

 HSBoundaryInterface (Component *component)
 
void check (const Component *const component) const
 

Static Public Member Functions

static InputParameters validParams ()
 

Protected Member Functions

bool HSBoundaryIsValid (const Component *const component) const
 Returns true if the specified heat structure boundary is valid. More...
 
const BoundaryName & getHSBoundaryName (const Component *const component) const
 Gets the boundary name corresponding to the heat structure and side. More...
 
Component2D::ExternalBoundaryType getHSExternalBoundaryType (const Component *const component) const
 Gets the external boundary type for the coupled heat structure boundary. More...
 

Protected Attributes

const std::string & _hs_name
 Heat structure name. More...
 
Component2D::ExternalBoundaryType _hs_side
 Heat structure side. More...
 
bool _hs_side_valid
 True if the heat structure side enum is valid. More...
 

Detailed Description

Interface class for coupling to a heat structure boundary.

Definition at line 21 of file HSBoundaryInterface.h.

Constructor & Destructor Documentation

◆ HSBoundaryInterface()

HSBoundaryInterface::HSBoundaryInterface ( Component component)

Definition at line 27 of file HSBoundaryInterface.C.

28  : _hs_name(component->getParam<std::string>("hs")),
29  _hs_side(component->getEnumParam<Component2D::ExternalBoundaryType>("hs_side", false)),
30  _hs_side_valid(static_cast<int>(_hs_side) >= 0)
31 {
32  component->addDependency(_hs_name);
33 
34  component->checkMutuallyExclusiveParameters({"hs_side", "hs_boundary"});
35 }
Component2D::ExternalBoundaryType _hs_side
Heat structure side.
static const std::string component
Definition: NS.h:153
ExternalBoundaryType
External boundary type.
Definition: Component2D.h:18
bool _hs_side_valid
True if the heat structure side enum is valid.
const std::string & _hs_name
Heat structure name.

Member Function Documentation

◆ check()

void HSBoundaryInterface::check ( const Component *const  component) const

Definition at line 38 of file HSBoundaryInterface.C.

Referenced by HeatTransferFromHeatStructure1Phase::check().

39 {
40  component->checkComponentOfTypeExistsByName<HeatStructureBase>(_hs_name);
41 
42  if (component->hasComponentByName<HeatStructureBase>(_hs_name))
43  {
44  const auto & hs = component->getComponentByName<HeatStructureBase>(_hs_name);
45 
46  BoundaryName hs_boundary;
48  if (component->isParamValid("hs_side"))
49  {
50  if (_hs_side_valid)
51  {
52  hs_boundary = hs.getExternalBoundaryName(_hs_side);
53  hs_side = _hs_side;
54  }
55  else
56  {
57  component->logError("The parameter 'hs_side' was given an invalid value.");
58  return;
59  }
60  }
61  else
62  {
63  hs_boundary = component->getParam<BoundaryName>("hs_boundary");
64  hs_side = hs.getExternalBoundaryType(hs_boundary);
65  }
66 
67  if (!hs.hasBoundary(hs_boundary))
68  component->logError("The heat structure boundary '", hs_boundary, "' does not exist.");
69 
70  const Real & P_hs = hs.getUnitPerimeter(hs_side);
71  if (MooseUtils::absoluteFuzzyEqual(P_hs, 0.))
72  {
73  if (component->isParamValid("hs_side"))
74  component->logError("'hs_side' parameter is set to '",
75  component->getParam<MooseEnum>("hs_side"),
76  "', but this side of the heat structure '",
77  _hs_name,
78  "' has radius of zero.");
79  else
80  component->logError("The specified boundary '",
81  hs_boundary,
82  "' of the heat structure '",
83  _hs_name,
84  "' has a radius of zero.");
85  }
86  if (std::isnan(P_hs))
87  component->logError("The specified boundary '",
88  hs_boundary,
89  "' of the heat structure '",
90  _hs_name,
91  "' is either START and END boundary, which may not be used.");
92  }
93 }
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)
Component2D::ExternalBoundaryType _hs_side
Heat structure side.
static const std::string component
Definition: NS.h:153
ExternalBoundaryType
External boundary type.
Definition: Component2D.h:18
bool _hs_side_valid
True if the heat structure side enum is valid.
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.

◆ getHSBoundaryName()

const BoundaryName & HSBoundaryInterface::getHSBoundaryName ( const Component *const  component) const
protected

Gets the boundary name corresponding to the heat structure and side.

Parameters
[in]componentComponent pointer

Definition at line 96 of file HSBoundaryInterface.C.

Referenced by HeatTransferFromHeatStructure1Phase::addMooseObjects(), and HeatTransferFromHeatStructure1Phase::setupMesh().

97 {
98  if (component->isParamValid("hs_side"))
99  {
100  const auto & hs = component->getComponentByName<HeatStructureBase>(_hs_name);
102  }
103  else
104  return component->getParam<BoundaryName>("hs_boundary");
105 }
const BoundaryName & getExternalBoundaryName(const ExternalBoundaryType &boundary_type) const
Gets the name of an external boundary by type.
Definition: Component2D.C:550
Component2D::ExternalBoundaryType _hs_side
Heat structure side.
static const std::string component
Definition: NS.h:153
const std::string & _hs_name
Heat structure name.
Base class for 2D generated heat structures.

◆ getHSExternalBoundaryType()

Component2D::ExternalBoundaryType HSBoundaryInterface::getHSExternalBoundaryType ( const Component *const  component) const
protected

Gets the external boundary type for the coupled heat structure boundary.

Parameters
[in]componentComponent pointer

Definition at line 108 of file HSBoundaryInterface.C.

Referenced by HeatTransferFromHeatStructure1Phase::addMooseObjects().

109 {
110  if (component->isParamValid("hs_side"))
111  return _hs_side;
112  else
113  {
114  const auto & hs = component->getComponentByName<HeatStructureBase>(_hs_name);
115  const auto hs_boundary = component->getParam<BoundaryName>("hs_boundary");
116  return hs.getExternalBoundaryType(hs_boundary);
117  }
118 }
Component2D::ExternalBoundaryType _hs_side
Heat structure side.
static const std::string component
Definition: NS.h:153
const std::string & _hs_name
Heat structure name.
Base class for 2D generated heat structures.

◆ HSBoundaryIsValid()

bool HSBoundaryInterface::HSBoundaryIsValid ( const Component *const  component) const
protected

Returns true if the specified heat structure boundary is valid.

Definition at line 121 of file HSBoundaryInterface.C.

Referenced by HeatTransferFromHeatStructure1Phase::setupMesh().

122 {
123  const auto & hs = component->getComponentByName<HeatStructureBase>(_hs_name);
124 
125  BoundaryName hs_boundary;
126  if (component->isParamValid("hs_side"))
127  {
128  if (_hs_side_valid)
129  hs_boundary = hs.getExternalBoundaryName(_hs_side);
130  else
131  return false;
132  }
133  else
134  hs_boundary = component->getParam<BoundaryName>("hs_boundary");
135 
136  return hs.hasBoundary(hs_boundary);
137 }
const BoundaryName & getExternalBoundaryName(const ExternalBoundaryType &boundary_type) const
Gets the name of an external boundary by type.
Definition: Component2D.C:550
Component2D::ExternalBoundaryType _hs_side
Heat structure side.
static const std::string component
Definition: NS.h:153
bool _hs_side_valid
True if the heat structure side enum is valid.
const std::string & _hs_name
Heat structure name.
Base class for 2D generated heat structures.

◆ validParams()

InputParameters HSBoundaryInterface::validParams ( )
static

Definition at line 15 of file HSBoundaryInterface.C.

Referenced by HeatTransferFromHeatStructure1Phase::validParams().

16 {
18 
19  params.addRequiredParam<std::string>("hs", "Heat structure name");
20  params.addParam<MooseEnum>(
21  "hs_side", Component2D::getExternalBoundaryTypeMooseEnum(), "Heat structure side");
22  params.addParam<BoundaryName>("hs_boundary", "Name of the coupled heat structure boundary.");
23 
24  return params;
25 }
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
static MooseEnum getExternalBoundaryTypeMooseEnum(const std::string &default_value="")
Gets the MooseEnum corresponding to ExternalBoundaryType.
Definition: Component2D.C:21
void addRequiredParam(const std::string &name, const std::string &doc_string)
InputParameters emptyInputParameters()

Member Data Documentation

◆ _hs_name

const std::string& HSBoundaryInterface::_hs_name
protected

◆ _hs_side

Component2D::ExternalBoundaryType HSBoundaryInterface::_hs_side
protected

Heat structure side.

Definition at line 54 of file HSBoundaryInterface.h.

Referenced by check(), getHSBoundaryName(), getHSExternalBoundaryType(), and HSBoundaryIsValid().

◆ _hs_side_valid

bool HSBoundaryInterface::_hs_side_valid
protected

True if the heat structure side enum is valid.

Definition at line 56 of file HSBoundaryInterface.h.

Referenced by check(), and HSBoundaryIsValid().


The documentation for this class was generated from the following files: