https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Component2D.h
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#pragma once
11
13
16public:
19 {
20 INNER = 0,
21 OUTER = 1,
22 START = 2,
23 END = 3
24 };
25
26 Component2D(const InputParameters & params);
27
28 virtual void buildMesh() override;
29
33 const Real & getTotalWidth() const { return _total_width; }
34
38 unsigned int getNumRegions() const { return _n_regions; }
39
45 bool hasBlock(const std::string & name) const;
46
50 const std::vector<std::string> & getNames() const { return _names; }
51
55 const std::vector<Real> & getVolumes() const { return _volume; }
56
60 bool isBoundaryInVector(const BoundaryName & boundary_name,
61 const std::vector<BoundaryName> & boundary_name_vector) const;
62
68 bool hasBoundary(const BoundaryName & boundary_name) const;
69
75 bool hasExternalBoundary(const BoundaryName & boundary_name) const;
76
85 const std::vector<std::tuple<dof_id_type, unsigned short int>> &
86 getBoundaryInfo(const BoundaryName & boundary_name) const;
87
94 const std::vector<std::tuple<dof_id_type, unsigned short int>> &
95 getBoundaryInfo(const ExternalBoundaryType & boundary_type) const;
96
105 ExternalBoundaryType getExternalBoundaryType(const BoundaryName & boundary_name) const;
106
110 Real getAxialOffset() const { return _axial_offset; }
111
117 const BoundaryName & getExternalBoundaryName(const ExternalBoundaryType & boundary_type) const;
118
122 const Real & getBoundaryArea(const BoundaryName & boundary_name) const;
123
131 virtual Real computeRadialBoundaryArea(const Real & length, const Real & y) const = 0;
132
141 virtual Real computeAxialBoundaryArea(const Real & y_min, const Real & y_max) const = 0;
142
143protected:
144 virtual void check() const override;
145
149 void build2DMesh();
150
154 void build2DMesh2ndOrder();
155
157 unsigned int _n_regions;
159 std::vector<std::string> _names;
161 std::vector<Real> _width;
165 std::vector<Real> _volume;
167 std::vector<unsigned int> _n_part_elems;
169 unsigned int _total_elem_number;
170
172 unsigned int _outer_bc_id;
174 unsigned int _inner_bc_id;
176 unsigned int _start_bc_id;
178 unsigned int _end_bc_id;
182 std::vector<unsigned int> _axial_outer_bc_id;
184 std::vector<unsigned int> _axial_inner_bc_id;
186 std::vector<unsigned int> _radial_start_bc_id;
188 std::vector<unsigned int> _radial_end_bc_id;
190 std::vector<unsigned int> _inner_radial_bc_id;
191
199 BoundaryName _boundary_name_end;
203 std::vector<BoundaryName> _boundary_names_axial_outer;
205 std::vector<BoundaryName> _boundary_names_axial_inner;
207 std::vector<BoundaryName> _boundary_names_radial_start;
209 std::vector<BoundaryName> _boundary_names_radial_end;
211 std::vector<BoundaryName> _boundary_names_inner_radial;
212
214 std::map<BoundaryName, Real> _boundary_name_to_area;
215
217 std::map<BoundaryName, std::vector<std::tuple<dof_id_type, unsigned short int>>> _boundary_info;
218
220 mutable Real _axial_offset;
221
222private:
223public:
225
231 static MooseEnum getExternalBoundaryTypeMooseEnum(const std::string & default_value = "");
232
234 static const std::map<std::string, ExternalBoundaryType> _external_boundary_type_to_enum;
235};
236
237namespace THM
238{
239template <>
241}
const std::vector< double > y
const std::string name
Definition Setup.h:21
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.
std::vector< Real > _width
Width of each transverse region.
std::vector< BoundaryName > _boundary_names_interior_axial_per_radial_section
Boundary names of the interior axial boundaries (per radial section) of the component.
std::vector< BoundaryName > _boundary_names_axial_inner
Boundary names of the axial regions of the inner side of the component.
Real _total_width
Total width of all transverse regions.
unsigned int _n_regions
Number of transverse regions.
Real getAxialOffset() const
Gets the axial offset for the mesh.
unsigned int _end_bc_id
BC ID of the component (end)
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.
bool hasBoundary(const BoundaryName &boundary_name) const
Returns true if this component has the supplied boundary.
std::map< BoundaryName, Real > _boundary_name_to_area
Map of boundary name to boundary area.
std::vector< unsigned int > _inner_radial_bc_id
BC ID of the inner radial boundary regions of the component.
std::vector< unsigned int > _radial_end_bc_id
BC ID of the radial regions of the end boundary of the component.
std::vector< BoundaryName > _boundary_names_axial_outer
Boundary names of the axial regions of the outer side of the component.
BoundaryName _boundary_name_inner
Boundary name of the inner side of the component.
unsigned int _total_elem_number
Total number of transverse elements.
BoundaryName _boundary_name_outer
Boundary name of the outer side of the component.
unsigned int _outer_bc_id
BC ID of the component (outer)
const Real & getBoundaryArea(const BoundaryName &boundary_name) const
Gets the area for a boundary.
bool hasBlock(const std::string &name) const
Returns true if there is a transverse region of a given name.
Definition Component2D.C:59
ExternalBoundaryType
External boundary type.
Definition Component2D.h:19
std::vector< unsigned int > _radial_start_bc_id
BC ID of the radial regions of the start boundary of the component.
static InputParameters validParams()
Definition Component2D.C:35
std::vector< Real > _volume
Volume of each transverse region.
std::vector< BoundaryName > _boundary_names_inner_radial
Boundary names of the inner radial boundary regions of the component.
const Real & getTotalWidth() const
Gets the total width of all transverse regions.
Definition Component2D.h:33
unsigned int _inner_bc_id
BC ID of the component (inner)
unsigned int _start_bc_id
BC ID of the component (start)
virtual Real computeAxialBoundaryArea(const Real &y_min, const Real &y_max) const =0
Computes the area of an axial boundary.
const std::vector< std::string > & getNames() const
Gets the names of the transverse regions.
Definition Component2D.h:50
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.
Definition Component2D.C:47
static MooseEnum getExternalBoundaryTypeMooseEnum(const std::string &default_value="")
Gets the MooseEnum corresponding to ExternalBoundaryType.
Definition Component2D.C:21
std::vector< unsigned int > _axial_outer_bc_id
BC ID of the axial regions of the outer boundary of the component.
virtual void buildMesh() override
const BoundaryName & getExternalBoundaryName(const ExternalBoundaryType &boundary_type) const
Gets the name of an external boundary by type.
std::vector< std::string > _names
Names of each transverse region.
BoundaryName _boundary_name_end
Boundary name of the end side of the component.
std::vector< unsigned int > _n_part_elems
Number of elements in each transverse region.
ExternalBoundaryType getExternalBoundaryType(const BoundaryName &boundary_name) const
Gets the external boundary type of the given boundary.
std::vector< BoundaryName > _boundary_names_radial_end
Boundary names of the radial regions of the end 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.
void build2DMesh()
Builds a 2D, first-order mesh.
Definition Component2D.C:65
virtual Real computeRadialBoundaryArea(const Real &length, const Real &y) const =0
Computes the area of a radial boundary.
Real _axial_offset
Distance by which to offset the mesh from the component axis.
std::vector< unsigned int > _axial_inner_bc_id
BC ID of the axial regions of the inner boundary of the component.
bool hasExternalBoundary(const BoundaryName &boundary_name) const
Returns true if this component has the supplied external boundary.
std::vector< BoundaryName > _boundary_names_radial_start
Boundary names of the radial regions of the start side of the component.
static const std::map< std::string, ExternalBoundaryType > _external_boundary_type_to_enum
map of external boundary type string to enum
Definition Component2D.h:15
const std::vector< Real > & getVolumes() const
Gets the volumes of the transverse regions.
Definition Component2D.h:55
unsigned int getNumRegions() const
Gets the number of transverse regions.
Definition Component2D.h:38
void build2DMesh2ndOrder()
Builds a 2D, second-order mesh.
BoundaryName _boundary_name_start
Boundary name of the start side of the component.
Base class for components that generate their own mesh.
Component1DConnection::EEndType stringToEnum(const std::string &s)