https://mooseframework.inl.gov
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 
12 #include "GeneratedMeshComponent.h"
13 
15 {
16 public:
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 
143 protected:
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;
180  std::vector<unsigned int> _interior_axial_per_radial_section_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 
193  BoundaryName _boundary_name_outer;
195  BoundaryName _boundary_name_inner;
197  BoundaryName _boundary_name_start;
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 
221 
222 private:
223 public:
224  static InputParameters validParams();
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 
237 namespace THM
238 {
239 template <>
240 Component2D::ExternalBoundaryType stringToEnum(const std::string & s);
241 }
bool hasBoundary(const BoundaryName &boundary_name) const
Returns true if this component has the supplied boundary.
Definition: Component2D.C:473
unsigned int _start_bc_id
BC ID of the component (start)
Definition: Component2D.h:176
const BoundaryName & getExternalBoundaryName(const ExternalBoundaryType &boundary_type) const
Gets the name of an external boundary by type.
Definition: Component2D.C:550
Component1DConnection::EEndType stringToEnum(const std::string &s)
unsigned int _inner_bc_id
BC ID of the component (inner)
Definition: Component2D.h:174
std::vector< Real > _volume
Volume of each transverse region.
Definition: Component2D.h:165
virtual void buildMesh() override
Definition: Component2D.C:341
std::vector< BoundaryName > _boundary_names_inner_radial
Boundary names of the inner radial boundary regions of the component.
Definition: Component2D.h:211
std::vector< BoundaryName > _boundary_names_radial_end
Boundary names of the radial regions of the end side of the component.
Definition: Component2D.h:209
std::vector< unsigned int > _interior_axial_per_radial_section_bc_id
BC ID of the interior axial boundaries (per radial section) of the component.
Definition: Component2D.h:180
virtual void check() const override
Check the component integrity.
Definition: Component2D.C:47
BoundaryName _boundary_name_end
Boundary name of the end side of the component.
Definition: Component2D.h:199
BoundaryName _boundary_name_inner
Boundary name of the inner side of the component.
Definition: Component2D.h:195
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.
Definition: Component2D.C:570
ExternalBoundaryType
External boundary type.
Definition: Component2D.h:18
const std::vector< double > y
Real getAxialOffset() const
Gets the axial offset for the mesh.
Definition: Component2D.h:110
unsigned int getNumRegions() const
Gets the number of transverse regions.
Definition: Component2D.h:38
Real _axial_offset
Distance by which to offset the mesh from the component axis.
Definition: Component2D.h:220
static MooseEnum getExternalBoundaryTypeMooseEnum(const std::string &default_value="")
Gets the MooseEnum corresponding to ExternalBoundaryType.
Definition: Component2D.C:21
std::vector< unsigned int > _inner_radial_bc_id
BC ID of the inner radial boundary regions of the component.
Definition: Component2D.h:190
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.
Definition: Component2D.h:205
virtual Real computeRadialBoundaryArea(const Real &length, const Real &y) const =0
Computes the area of a radial boundary.
std::vector< unsigned int > _axial_inner_bc_id
BC ID of the axial regions of the inner boundary of the component.
Definition: Component2D.h:184
Real _total_width
Total width of all transverse regions.
Definition: Component2D.h:163
static const std::map< std::string, ExternalBoundaryType > _external_boundary_type_to_enum
map of external boundary type string to enum
Definition: Component2D.h:234
std::vector< unsigned int > _radial_start_bc_id
BC ID of the radial regions of the start boundary of the component.
Definition: Component2D.h:186
unsigned int _total_elem_number
Total number of transverse elements.
Definition: Component2D.h:169
unsigned int _n_regions
Number of transverse regions.
Definition: Component2D.h:157
void build2DMesh()
Builds a 2D, first-order mesh.
Definition: Component2D.C:65
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. ...
Definition: Component2D.h:217
std::vector< std::string > _names
Names of each transverse region.
Definition: Component2D.h:159
Base class for components that generate their own mesh.
unsigned int _outer_bc_id
BC ID of the component (outer)
Definition: Component2D.h:172
std::vector< unsigned int > _n_part_elems
Number of elements in each transverse region.
Definition: Component2D.h:167
const std::vector< Real > & getVolumes() const
Gets the volumes of the transverse regions.
Definition: Component2D.h:55
std::vector< BoundaryName > _boundary_names_interior_axial_per_radial_section
Boundary names of the interior axial boundaries (per radial section) of the component.
Definition: Component2D.h:201
std::vector< BoundaryName > _boundary_names_radial_start
Boundary names of the radial regions of the start side of the component.
Definition: Component2D.h:207
void build2DMesh2ndOrder()
Builds a 2D, second-order mesh.
Definition: Component2D.C:211
std::vector< BoundaryName > _boundary_names_axial_outer
Boundary names of the axial regions of the outer side of the component.
Definition: Component2D.h:203
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.
Definition: Component2D.C:519
BoundaryName _boundary_name_outer
Boundary name of the outer side of the component.
Definition: Component2D.h:193
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.
Definition: Component2D.C:465
ExternalBoundaryType getExternalBoundaryType(const BoundaryName &boundary_name) const
Gets the external boundary type of the given boundary.
Definition: Component2D.C:496
bool hasBlock(const std::string &name) const
Returns true if there is a transverse region of a given name.
Definition: Component2D.C:59
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.
Definition: Component2D.h:214
std::vector< Real > _width
Width of each transverse region.
Definition: Component2D.h:161
std::vector< unsigned int > _radial_end_bc_id
BC ID of the radial regions of the end boundary of the component.
Definition: Component2D.h:188
static InputParameters validParams()
Definition: Component2D.C:35
unsigned int _end_bc_id
BC ID of the component (end)
Definition: Component2D.h:178
std::vector< unsigned int > _axial_outer_bc_id
BC ID of the axial regions of the outer boundary of the component.
Definition: Component2D.h:182
const Real & getTotalWidth() const
Gets the total width of all transverse regions.
Definition: Component2D.h:33
BoundaryName _boundary_name_start
Boundary name of the start side of the component.
Definition: Component2D.h:197
bool hasExternalBoundary(const BoundaryName &boundary_name) const
Returns true if this component has the supplied external boundary.
Definition: Component2D.C:483
Component2D(const InputParameters &params)
Definition: Component2D.C:41
const std::vector< std::string > & getNames() const
Gets the names of the transverse regions.
Definition: Component2D.h:50