https://mooseframework.inl.gov
Loading...
Searching...
No Matches
HSBoundary.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 "HSBoundary.h"
11#include "HeatStructureBase.h"
12#include "MooseUtils.h"
13
16{
18
19 params.addRequiredParam<std::vector<BoundaryName>>(
20 "boundary", "List of boundary names for which this component applies");
21 params.addRequiredParam<std::string>("hs", "Heat structure name");
22
23 return params;
24}
25
27 : BoundaryBase(params),
28
29 _boundary(getParam<std::vector<BoundaryName>>("boundary")),
30 _hs_name(getParam<std::string>("hs"))
31{
32}
33
34void
36{
37 checkComponentOfTypeExistsByName<HeatStructureInterface>(_hs_name);
38
39 if (hasComponentByName<HeatStructureBase>(_hs_name))
40 {
41 const HeatStructureBase & hs = getComponentByName<HeatStructureBase>(_hs_name);
42
43 // Check that no perimeter is zero; if so, there is not physically a boundary
44 for (unsigned int i = 0; i < _boundary.size(); i++)
45 {
47 {
48 auto hs_side = hs.getExternalBoundaryType(_boundary[i]);
51 {
52 if (MooseUtils::absoluteFuzzyEqual(hs.getUnitPerimeter(hs_side), 0))
53 logError("The heat structure side of the heat structure '",
55 "' corresponding to the boundary name '",
56 _boundary[i],
57 "' has a zero perimeter. This can be caused by applying the boundary on the "
58 "axis of symmetry of a cylindrical heat structure.");
59 }
60 }
61 }
62 }
63}
64
65bool
67{
68 const auto & comp2d = getComponentByName<Component2D>(_hs_name);
69 for (const auto & boundary : _boundary)
70 if (!comp2d.hasExternalBoundary(boundary))
71 return false;
72 return true;
73}
74
75void
77{
79 logError("The boundaries given in 'boundary' must all be external.");
80}
81
82bool
84{
85 if (!_boundary.empty())
86 {
87 const auto & comp2d = getComponentByName<Component2D>(_hs_name);
88 const auto common_boundary_type = comp2d.getExternalBoundaryType(_boundary[0]);
89 for (unsigned int i = 1; i < _boundary.size(); i++)
90 {
91 const auto boundary_type = comp2d.getExternalBoundaryType(_boundary[i]);
92 if (boundary_type != common_boundary_type)
93 return false;
94 }
95 return true;
96 }
97 mooseError("No boundaries were supplied in 'boundary'.");
98}
99
102{
104 {
105 const auto & comp2d = getComponentByName<Component2D>(_hs_name);
106 return comp2d.getExternalBoundaryType(_boundary[0]);
107 }
108 else
110 "The boundaries supplied in 'boundary' do not have a common external boundary type.");
111}
Base class for components of a boundary type.
static InputParameters validParams()
ExternalBoundaryType
External boundary type.
Definition Component2D.h:19
ExternalBoundaryType getExternalBoundaryType(const BoundaryName &boundary_name) const
Gets the external boundary type of the given boundary.
bool hasExternalBoundary(const BoundaryName &boundary_name) const
Returns true if this component has the supplied external boundary.
void logError(Args &&... args) const
Logs an error.
Definition Component.h:226
bool hasCommonComponent2DExternalBoundaryType() const
Returns true if all of the boundaries have the same external boundary type.
Definition HSBoundary.C:83
const std::vector< BoundaryName > & _boundary
Boundary names for which the boundary component applies.
Definition HSBoundary.h:56
HSBoundary(const InputParameters &params)
Definition HSBoundary.C:26
bool allComponent2DBoundariesAreExternal() const
Returns true if all of the boundaries are external.
Definition HSBoundary.C:66
void checkAllComponent2DBoundariesAreExternal() const
Logs an error if any boundary is not external.
Definition HSBoundary.C:76
static InputParameters validParams()
Definition HSBoundary.C:15
const std::string & _hs_name
Heat structure name.
Definition HSBoundary.h:59
Component2D::ExternalBoundaryType getCommonComponent2DExternalBoundaryType() const
Gets the common external boundary type.
Definition HSBoundary.C:101
virtual void check() const override
Check the component integrity.
Definition HSBoundary.C:35
Base class for 2D generated heat structures.
virtual Real getUnitPerimeter(const ExternalBoundaryType &side) const =0
Gets the perimeter of one unit of this heat structure on the specified side.
void addRequiredParam(const std::string &name, const std::string &doc_string)
void mooseError(Args &&... args) const