14 const std::map<std::string, Component2D::ExternalBoundaryType>
16 {
"OUTER", ExternalBoundaryType::OUTER},
17 {
"START", ExternalBoundaryType::START},
18 {
"END", ExternalBoundaryType::END}};
30 return stringToEnum<Component2D::ExternalBoundaryType>(
51 if (
getParam<std::vector<std::string>>(
"axial_region_names").size())
52 checkEqualSize<std::string, Real>(
"axial_region_names",
"length");
54 logError(
"If there is more than 1 axial region, then the parameter 'axial_region_names' must " 68 std::vector<std::vector<unsigned int>> node_ids(
72 for (
unsigned int i = 0; i < n_axial_positions; i++)
77 node_ids[i][0] = nd->id();
88 node_ids[i][l] = nd->id();
93 auto & boundary_info =
mesh().
getMesh().get_boundary_info();
97 for (
unsigned int i_section = 0; i_section <
_n_sections; i_section++)
100 unsigned int i_section_end = 0;
101 for (
unsigned int ii_section = 0; ii_section <= i_section; ++ii_section)
102 i_section_end +=
_n_elems[ii_section];
105 for (
unsigned int i_local = 0; i_local <
_n_elems[i_section]; i_local++)
108 for (
unsigned int j_section = 0; j_section <
_n_regions; j_section++)
109 for (
unsigned int j_local = 0; j_local <
_n_part_elems[j_section]; j_local++)
112 node_ids[i][
j + 1], node_ids[i][
j], node_ids[i + 1][
j], node_ids[i + 1][
j + 1]);
120 std::tuple<dof_id_type, unsigned short int>(elem->id(), 0));
126 std::tuple<dof_id_type, unsigned short int>(elem->id(), 2));
136 std::tuple<dof_id_type, unsigned short int>(elem->id(), 0));
142 std::tuple<dof_id_type, unsigned short int>(elem->id(), 2));
148 i_section !=
_n_sections - 1 && i == i_section_end)
150 const unsigned int k = i_section *
_n_regions + j_section;
153 std::tuple<dof_id_type, unsigned short int>(elem->id(), 2));
161 std::tuple<dof_id_type, unsigned short int>(elem->id(), 1));
167 std::tuple<dof_id_type, unsigned short int>(elem->id(), 3));
177 std::tuple<dof_id_type, unsigned short int>(elem->id(), 1));
183 std::tuple<dof_id_type, unsigned short int>(elem->id(), 3));
190 unsigned int j_section_begin = 0;
191 for (
unsigned int jj_section = 0; jj_section < j_section; ++jj_section)
194 if (
j == j_section_begin)
198 std::tuple<dof_id_type, unsigned short int>(elem->id(), 1));
214 std::vector<std::vector<unsigned int>> node_ids(
218 for (
unsigned int i = 0; i < n_axial_positions; i++)
223 node_ids[i][0] = nd->id();
234 node_ids[i][l] = nd->id();
239 auto & boundary_info =
mesh().
getMesh().get_boundary_info();
243 for (
unsigned int i_section = 0; i_section <
_n_sections; i_section++)
244 for (
unsigned int i_local = 0; i_local <
_n_elems[i_section]; i_local++)
247 for (
unsigned int j_section = 0; j_section <
_n_regions; j_section++)
248 for (
unsigned int j_local = 0; j_local <
_n_part_elems[j_section]; j_local++)
251 node_ids[2 * i][2 * (
j + 1)],
252 node_ids[2 * (i + 1)][2 * (
j + 1)],
253 node_ids[2 * (i + 1)][2 *
j],
254 node_ids[2 * i][(2 *
j) + 1],
255 node_ids[(2 * i) + 1][2 * (
j + 1)],
256 node_ids[2 * (i + 1)][(2 *
j) + 1],
257 node_ids[(2 * i) + 1][(2 *
j)],
258 node_ids[(2 * i) + 1][(2 *
j) + 1]);
265 std::tuple<dof_id_type, unsigned short int>(elem->id(), 0));
271 std::tuple<dof_id_type, unsigned short int>(elem->id(), 2));
279 std::tuple<dof_id_type, unsigned short int>(elem->id(), 0));
285 std::tuple<dof_id_type, unsigned short int>(elem->id(), 2));
293 std::tuple<dof_id_type, unsigned short int>(elem->id(), 3));
299 std::tuple<dof_id_type, unsigned short int>(elem->id(), 1));
308 std::tuple<dof_id_type, unsigned short int>(elem->id(), 1));
314 std::tuple<dof_id_type, unsigned short int>(elem->id(), 3));
321 unsigned int j_section_begin = 0;
322 for (
unsigned int jj_section = 0; jj_section < j_section; ++jj_section)
325 if (
j == j_section_begin)
329 std::tuple<dof_id_type, unsigned short int>(elem->id(), 1));
368 const BoundaryName boundary_name_axial_inner =
370 const BoundaryName boundary_name_axial_outer =
390 for (
unsigned int i = 0; i <
_names.size(); i++)
396 const BoundaryName boundary_name_radial_start =
genName(
name(),
_names[i],
"start");
402 if (i !=
_names.size() - 1)
418 for (
unsigned int j = 0;
j <
_names.size();
j++)
423 const BoundaryName boundary_name_interior_axial_per_radial_section =
426 boundary_name_interior_axial_per_radial_section);
440 auto & binfo =
mesh().
getMesh().get_boundary_info();
452 for (
unsigned int i = 0; i <
_names.size(); i++)
456 if (i !=
_names.size() - 1)
466 const std::vector<BoundaryName> & boundary_name_vector)
const 468 return std::find(boundary_name_vector.begin(), boundary_name_vector.end(), boundary_name) !=
469 boundary_name_vector.end();
513 mooseError(
name(),
": The boundary '", boundary_name,
"' is an interior boundary.");
515 mooseError(
name(),
": The boundary '", boundary_name,
"' does not exist on this component.");
518 const std::vector<std::tuple<dof_id_type, unsigned short int>> &
526 mooseError(
name(),
": The boundary '", boundary_name,
"' does not exist on this component.");
529 const std::vector<std::tuple<dof_id_type, unsigned short int>> &
534 switch (boundary_type)
554 switch (boundary_type)
577 mooseError(
name(),
": The boundary '", boundary_name,
"' does not exist on this component.");
bool hasBoundary(const BoundaryName &boundary_name) const
Returns true if this component has the supplied boundary.
unsigned int _start_bc_id
BC ID of the component (start)
const BoundaryName & getExternalBoundaryName(const ExternalBoundaryType &boundary_type) const
Gets the name of an external boundary by type.
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.
Component1DConnection::EEndType stringToEnum(const std::string &s)
unsigned int _inner_bc_id
BC ID of the component (inner)
Real _length
Total axial length.
virtual void buildMesh() override
std::vector< BoundaryName > _boundary_names_inner_radial
Boundary names of the inner radial boundary regions of the component.
std::vector< BoundaryName > _boundary_names_radial_end
Boundary names of the radial regions of the end side of the component.
std::vector< unsigned int > _interior_axial_per_radial_section_bc_id
BC ID of the interior axial boundaries (per radial section) of the component.
virtual void check() const override
Check the component integrity.
BoundaryName _boundary_name_end
Boundary name of the end side of the component.
BoundaryName _boundary_name_inner
Boundary name of the inner side of the component.
virtual Real computeAxialBoundaryArea(const Real &y_min, const Real &y_max) const =0
Computes the area of an axial boundary.
const Real & getBoundaryArea(const BoundaryName &boundary_name) const
Gets the area for a boundary.
std::vector< Real > _lengths
Length of each axial section.
static InputParameters validParams()
ExternalBoundaryType
External boundary type.
Real _axial_offset
Distance by which to offset the mesh from the component axis.
virtual void setSubdomainInfo(SubdomainID subdomain_id, const std::string &subdomain_name, const Moose::CoordinateSystemType &coord_system=Moose::COORD_XYZ)
Sets the next subdomain ID, name, and coordinate system.
static MooseEnum getExternalBoundaryTypeMooseEnum(const std::string &default_value="")
Gets the MooseEnum corresponding to ExternalBoundaryType.
std::vector< unsigned int > _inner_radial_bc_id
BC ID of the inner radial boundary regions of the component.
Node * addNode(const Point &pt)
virtual const std::string & name() const
std::vector< BoundaryName > _boundary_names_axial_inner
Boundary names of the axial regions of the inner side of the component.
void logError(Args &&... args) const
Logs an error.
virtual Real computeRadialBoundaryArea(const Real &length, const Real &y) const =0
Computes the area of a radial boundary.
virtual void check() const override
Check the component integrity.
std::vector< unsigned int > _axial_inner_bc_id
BC ID of the axial regions of the inner boundary of the component.
static const std::map< std::string, ExternalBoundaryType > _external_boundary_type_to_enum
map of external boundary type string to enum
std::vector< unsigned int > _radial_start_bc_id
BC ID of the radial regions of the start boundary of the component.
unsigned int _total_elem_number
Total number of transverse elements.
unsigned int _n_regions
Number of transverse regions.
void build2DMesh()
Builds a 2D, first-order mesh.
std::map< BoundaryName, std::vector< std::tuple< dof_id_type, unsigned short int > > > _boundary_info
Map of boundary name to list of tuples of element and side IDs for that boundary. ...
std::vector< std::string > _names
Names of each transverse region.
Base class for components that generate their own mesh.
unsigned int _outer_bc_id
BC ID of the component (outer)
std::vector< unsigned int > _n_part_elems
Number of elements in each transverse region.
const T & getParam(const std::string &name) const
std::vector< BoundaryName > _boundary_names_interior_axial_per_radial_section
Boundary names of the interior axial boundaries (per radial section) of the component.
const unsigned int _n_sections
Number of axial sections.
std::vector< BoundaryName > _boundary_names_radial_start
Boundary names of the radial regions of the start side of the component.
void build2DMesh2ndOrder()
Builds a 2D, second-order mesh.
std::vector< BoundaryName > _boundary_names_axial_outer
Boundary names of the axial regions of the outer side of the component.
const std::vector< std::tuple< dof_id_type, unsigned short int > > & getBoundaryInfo(const BoundaryName &boundary_name) const
Gets boundary info associated with the component boundary.
BoundaryName _boundary_name_outer
Boundary name of the outer side of the component.
bool isBoundaryInVector(const BoundaryName &boundary_name, const std::vector< BoundaryName > &boundary_name_vector) const
Returns true if the supplied boundary is in the given vector.
THMMesh & mesh()
Non-const reference to THM mesh, which can only be called before the end of mesh setup.
const std::vector< unsigned int > & _n_elems
Number of elements in each axial section.
const unsigned int _n_elem
Total number of axial elements.
ExternalBoundaryType getExternalBoundaryType(const BoundaryName &boundary_name) const
Gets the external boundary type of the given boundary.
Elem * addElementQuad4(dof_id_type node0, dof_id_type node1, dof_id_type node2, dof_id_type node3)
bool hasBlock(const std::string &name) const
Returns true if there is a transverse region of a given name.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
std::map< BoundaryName, Real > _boundary_name_to_area
Map of boundary name to boundary area.
std::vector< Real > _width
Width of each transverse region.
void checkSetupStatus(const EComponentSetupStatus &status) const
Throws an error if the supplied setup status of this component has not been reached.
virtual BoundaryID getNextBoundaryId()
Gets the next nodeset or sideset ID.
std::vector< SubdomainID > _subdomain_ids
List of subdomain IDs this components owns.
std::vector< unsigned int > _radial_end_bc_id
BC ID of the radial regions of the end boundary of the component.
static InputParameters validParams()
void mooseError(Args &&... args) const
unsigned int _end_bc_id
BC ID of the component (end)
std::vector< unsigned int > _axial_outer_bc_id
BC ID of the axial regions of the outer boundary of the component.
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
const Real & getTotalWidth() const
Gets the total width of all transverse regions.
BoundaryName _boundary_name_start
Boundary name of the start side of the component.
bool hasExternalBoundary(const BoundaryName &boundary_name) const
Returns true if this component has the supplied external boundary.
std::vector< Real > _node_locations
Node locations along the main axis.
static const std::string k
Component2D(const InputParameters ¶ms)
virtual bool usingSecondOrderMesh() const =0
Check if second order mesh is being used by this geometrical component.
const std::vector< std::string > & _axial_region_names
Axial region names.
Elem * addElementQuad9(dof_id_type node0, dof_id_type node1, dof_id_type node2, dof_id_type node3, dof_id_type node4, dof_id_type node5, dof_id_type node6, dof_id_type node7, dof_id_type node8)