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

Mesh generator for hexagonal duct. More...

#include <SCMTriDuctMeshGenerator.h>

Inheritance diagram for SCMTriDuctMeshGenerator:
[legend]

Public Types

typedef DataFileName DataFileParameterType
 

Public Member Functions

 SCMTriDuctMeshGenerator (const InputParameters &parameters)
 
std::unique_ptr< MeshBase > generate () override
 
std::unique_ptr< MeshBase > generateInternal ()
 
const std::set< MeshGeneratorName > & getRequestedMeshGenerators () const
 
const std::set< MeshGeneratorName > & getRequestedMeshGeneratorsForSub () const
 
void addParentMeshGenerator (const MeshGenerator &mg, const AddParentChildKey)
 
void addChildMeshGenerator (const MeshGenerator &mg, const AddParentChildKey)
 
const std::set< const MeshGenerator *, Comparator > & getParentMeshGenerators () const
 
const std::set< const MeshGenerator *, Comparator > & getChildMeshGenerators () const
 
const std::set< const MeshGenerator *, Comparator > & getSubMeshGenerators () const
 
bool isParentMeshGenerator (const MeshGeneratorName &name, const bool direct=true) const
 
bool isChildMeshGenerator (const MeshGeneratorName &name, const bool direct=true) const
 
bool isNullMeshName (const MeshGeneratorName &name) const
 
bool hasSaveMesh () const
 
bool hasOutput () const
 
const std::string & getSavedMeshName () const
 
bool hasGenerateData () const
 
bool isDataOnly () const
 
virtual bool enabled () const
 
std::shared_ptr< MooseObjectgetSharedPtr ()
 
std::shared_ptr< const MooseObjectgetSharedPtr () const
 
MooseAppgetMooseApp () const
 
const std::string & type () const
 
virtual const std::string & name () const
 
std::string typeAndName () const
 
std::string errorPrefix (const std::string &error_type) const
 
void callMooseError (std::string msg, const bool with_prefix) const
 
MooseObjectParameterName uniqueParameterName (const std::string &parameter_name) const
 
const InputParametersparameters () const
 
MooseObjectName uniqueName () const
 
const T & getParam (const std::string &name) const
 
std::vector< std::pair< T1, T2 > > getParam (const std::string &param1, const std::string &param2) const
 
const T * queryParam (const std::string &name) const
 
const T & getRenamedParam (const std::string &old_name, const std::string &new_name) const
 
getCheckedPointerParam (const std::string &name, const std::string &error_string="") const
 
bool isParamValid (const std::string &name) const
 
bool isParamSetByUser (const std::string &nm) const
 
void paramError (const std::string &param, Args... args) const
 
void paramWarning (const std::string &param, Args... args) const
 
void paramInfo (const std::string &param, Args... args) const
 
void connectControllableParams (const std::string &parameter, const std::string &object_type, const std::string &object_name, const std::string &object_parameter) const
 
void mooseError (Args &&... args) const
 
void mooseErrorNonPrefixed (Args &&... args) const
 
void mooseDocumentedError (const std::string &repo_name, const unsigned int issue_num, Args &&... args) const
 
void mooseWarning (Args &&... args) const
 
void mooseWarningNonPrefixed (Args &&... args) const
 
void mooseDeprecated (Args &&... args) const
 
void mooseInfo (Args &&... args) const
 
std::string getDataFileName (const std::string &param) const
 
std::string getDataFileNameByName (const std::string &relative_path) const
 
std::string getDataFilePath (const std::string &relative_path) const
 
const Parallel::Communicator & comm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 

Static Public Member Functions

static InputParameters validParams ()
 
static bool hasGenerateData (const InputParameters &params)
 
static void setHasGenerateData (InputParameters &params)
 

Public Attributes

const ConsoleStream _console
 

Static Public Attributes

static const std::string data_only_param
 
static constexpr auto SYSTEM
 
static constexpr auto NAME
 

Protected Member Functions

size_t ductPointIndex (unsigned int points_per_layer, unsigned int layer, unsigned int point) const
 Returns an index into the vector of point/node positions used/generated by ductPoints. More...
 
void ductCorners (std::vector< Point > &corners, Real flat_to_flat, const Point &center) const
 calculate the x-y coordinates of the corner points for the duct cross section. More...
 
void ductXsec (std::vector< Point > &xsec, const std::vector< Point > &corners, unsigned int nrings, Real pitch, Real flat_to_flat) const
 calcultes the points around the duct cross section boundary (perpendicular to z axis) using assembly parameters. More...
 
void ductPoints (std::vector< Point > &points, const std::vector< Point > &xsec, const std::vector< Real > &z_layers) const
 Calculates all the point/node positions that will be used to form elements making the duct. More...
 
void ductElems (std::vector< std::vector< size_t >> &elem_point_indices, unsigned int n_layers, unsigned int points_per_layer) const
 Calculates the groups of points/nodes that comprise each element in the duct mesh. More...
 
void buildDuct (std::unique_ptr< MeshBase > &mesh, std::vector< Node *> &duct_nodes, const std::vector< Point > &points, const std::vector< std::vector< size_t >> &elem_point_indices, SubdomainID block) const
 buildDuct generates and adds mesh node and element objects to the given mesh corresponding to the given points (from ductPoints) and elem_point_indices that identify node point groups forming elements (from ductElems) More...
 
virtual void generateData ()
 
T & copyMeshProperty (const std::string &target_data_name, const std::string &source_data_name, const std::string &source_mesh)
 
T & copyMeshProperty (const std::string &source_data_name, const std::string &source_mesh)
 
std::unique_ptr< MeshBase > & getMesh (const std::string &param_name, const bool allow_invalid=false)
 
std::vector< std::unique_ptr< MeshBase > *> getMeshes (const std::string &param_name)
 
std::unique_ptr< MeshBase > & getMeshByName (const MeshGeneratorName &mesh_generator_name)
 
std::vector< std::unique_ptr< MeshBase > *> getMeshesByName (const std::vector< MeshGeneratorName > &mesh_generator_names)
 
void declareMeshForSub (const std::string &param_name)
 
void declareMeshesForSub (const std::string &param_name)
 
void declareMeshForSubByName (const MeshGeneratorName &mesh_generator_name)
 
void declareMeshesForSubByName (const std::vector< MeshGeneratorName > &mesh_generator_names)
 
std::unique_ptr< MeshBase > buildMeshBaseObject (unsigned int dim=libMesh::invalid_uint)
 
std::unique_ptr< ReplicatedMesh > buildReplicatedMesh (unsigned int dim=libMesh::invalid_uint)
 
std::unique_ptr< DistributedMesh > buildDistributedMesh (unsigned int dim=libMesh::invalid_uint)
 
void addMeshSubgenerator (const std::string &type, const std::string &name, Ts... extra_input_parameters)
 
void addMeshSubgenerator (const std::string &type, const std::string &name, InputParameters params)
 
void declareNullMeshName (const MeshGeneratorName &name)
 
const T & getMeshProperty (const std::string &data_name, const std::string &prefix)
 
const T & getMeshProperty (const std::string &data_name)
 
bool hasMeshProperty (const std::string &data_name, const std::string &prefix) const
 
bool hasMeshProperty (const std::string &data_name, const std::string &prefix) const
 
bool hasMeshProperty (const std::string &data_name) const
 
bool hasMeshProperty (const std::string &data_name) const
 
std::string meshPropertyName (const std::string &data_name) const
 
T & declareMeshProperty (const std::string &data_name, Args &&... args)
 
T & declareMeshProperty (const std::string &data_name, const T &data_value)
 
T & declareMeshProperty (const std::string &data_name, Args &&... args)
 
T & declareMeshProperty (const std::string &data_name, const T &data_value)
 
T & setMeshProperty (const std::string &data_name, Args &&... args)
 
T & setMeshProperty (const std::string &data_name, const T &data_value)
 
T & setMeshProperty (const std::string &data_name, Args &&... args)
 
T & setMeshProperty (const std::string &data_name, const T &data_value)
 

Static Protected Member Functions

static std::string meshPropertyName (const std::string &data_name, const std::string &prefix)
 

Protected Attributes

std::unique_ptr< MeshBase > & _input
 Mesh that comes from another generator. More...
 
const unsigned int _n_cells
 number of axial cells More...
 
std::vector< Real_z_grid
 axial location of nodes More...
 
const Real _unheated_length_entry
 unheated length of the fuel Pin at the entry of the assembly More...
 
const Real _heated_length
 heated length of the fuel Pin More...
 
const Real _unheated_length_exit
 unheated length of the fuel Pin at the exit of the assembly More...
 
const unsigned int _block_id
 block index More...
 
const Real _pitch
 Distance between the neighbor fuel pins, pitch. More...
 
const unsigned int _n_rings
 number of rings of fuel pins More...
 
const Real _flat_to_flat
 the distance between flat surfaces of the duct facing each other More...
 
MooseMesh *const _mesh
 
const bool & _enabled
 
MooseApp_app
 
const std::string _type
 
const std::string _name
 
const InputParameters_pars
 
Factory_factory
 
ActionFactory_action_factory
 
const Parallel::Communicator & _communicator
 

Detailed Description

Mesh generator for hexagonal duct.

Definition at line 17 of file SCMTriDuctMeshGenerator.h.

Constructor & Destructor Documentation

◆ SCMTriDuctMeshGenerator()

SCMTriDuctMeshGenerator::SCMTriDuctMeshGenerator ( const InputParameters parameters)

Definition at line 41 of file SCMTriDuctMeshGenerator.C.

42  : MeshGenerator(params),
43  _input(getMesh("input")),
44  _n_cells(getParam<unsigned int>("n_cells")),
45  _unheated_length_entry(getParam<Real>("unheated_length_entry")),
46  _heated_length(getParam<Real>("heated_length")),
47  _unheated_length_exit(getParam<Real>("unheated_length_exit")),
48  _block_id(getParam<unsigned int>("block_id")),
49  _pitch(getParam<Real>("pitch")),
50  _n_rings(getParam<unsigned int>("nrings")),
51  _flat_to_flat(getParam<Real>("flat_to_flat"))
52 {
55 }
const Real _unheated_length_entry
unheated length of the fuel Pin at the entry of the assembly
MeshGenerator(const InputParameters &parameters)
const Real _flat_to_flat
the distance between flat surfaces of the duct facing each other
const Real _unheated_length_exit
unheated length of the fuel Pin at the exit of the assembly
static void generateZGrid(Real unheated_length_entry, Real heated_length, Real unheated_length_exit, unsigned int n_cells, std::vector< Real > &z_grid)
Generate the spacing in z-direction using heated and unteaded lengths.
const unsigned int _n_cells
number of axial cells
const unsigned int _block_id
block index
std::unique_ptr< MeshBase > & getMesh(const std::string &param_name, const bool allow_invalid=false)
std::unique_ptr< MeshBase > & _input
Mesh that comes from another generator.
const Real _pitch
Distance between the neighbor fuel pins, pitch.
const unsigned int _n_rings
number of rings of fuel pins
std::vector< Real > _z_grid
axial location of nodes
const Real _heated_length
heated length of the fuel Pin

Member Function Documentation

◆ buildDuct()

void SCMTriDuctMeshGenerator::buildDuct ( std::unique_ptr< MeshBase > &  mesh,
std::vector< Node *> &  duct_nodes,
const std::vector< Point > &  points,
const std::vector< std::vector< size_t >> &  elem_point_indices,
SubdomainID  block 
) const
protected

buildDuct generates and adds mesh node and element objects to the given mesh corresponding to the given points (from ductPoints) and elem_point_indices that identify node point groups forming elements (from ductElems)

Definition at line 169 of file SCMTriDuctMeshGenerator.C.

Referenced by generate().

174 {
175  for (size_t i = 0; i < points.size(); i++)
176  duct_nodes.push_back(mesh->add_point(points[i]));
177 
178  for (auto & elem_indices : elem_point_indices)
179  {
180  auto elem = mesh->add_elem(new Quad4());
181  elem->subdomain_id() = block;
182  for (size_t i = 0; i < elem_indices.size(); i++)
183  elem->set_node(i, duct_nodes[elem_indices[i]]);
184  }
185 }
MeshBase & mesh

◆ ductCorners()

void SCMTriDuctMeshGenerator::ductCorners ( std::vector< Point > &  corners,
Real  flat_to_flat,
const Point &  center 
) const
protected

calculate the x-y coordinates of the corner points for the duct cross section.

Definition at line 88 of file SCMTriDuctMeshGenerator.C.

Referenced by generate().

91 {
92  corners.resize(TriSubChannelMesh::N_CORNERS);
93  Real r_corner = flat_to_flat / 2. / std::cos(libMesh::pi / 6.);
94  for (size_t i = 0; i < TriSubChannelMesh::N_CORNERS; i++)
95  {
96  Real theta = i * libMesh::pi / 3.;
97  Point corner = {r_corner * std::cos(theta), r_corner * std::sin(theta)};
98  corners[i] = center + corner;
99  }
100 }
static const unsigned int N_CORNERS
number of corners in the duct x-sec
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static const std::string center
Definition: NS.h:28
const Real pi

◆ ductElems()

void SCMTriDuctMeshGenerator::ductElems ( std::vector< std::vector< size_t >> &  elem_point_indices,
unsigned int  n_layers,
unsigned int  points_per_layer 
) const
protected

Calculates the groups of points/nodes that comprise each element in the duct mesh.

The groups are identified by indices into the points vector returned by ductPoints. n_layers is the number of z-axis layers the duct has (i.e. the number of z x-secs lining up with nodes. And points_per_layer is the number of nodes/points in each of those x-secs.

Definition at line 147 of file SCMTriDuctMeshGenerator.C.

Referenced by generate().

150 {
151  elem_point_indices.clear();
152  for (unsigned int i = 0; i < n_layers - 1; i++)
153  {
154  unsigned int bottom = i;
155  unsigned int top = i + 1;
156  for (unsigned int j = 0; j < points_per_layer; j++)
157  {
158  unsigned int left = j;
159  unsigned int right = (j + 1) % points_per_layer;
160  elem_point_indices.push_back({ductPointIndex(points_per_layer, bottom, left),
161  ductPointIndex(points_per_layer, bottom, right),
162  ductPointIndex(points_per_layer, top, right),
163  ductPointIndex(points_per_layer, top, left)});
164  }
165  }
166 }
size_t ductPointIndex(unsigned int points_per_layer, unsigned int layer, unsigned int point) const
Returns an index into the vector of point/node positions used/generated by ductPoints.
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")

◆ ductPointIndex()

size_t SCMTriDuctMeshGenerator::ductPointIndex ( unsigned int  points_per_layer,
unsigned int  layer,
unsigned int  point 
) const
protected

Returns an index into the vector of point/node positions used/generated by ductPoints.

This is used for mapping a xsec point index and a z-axis layer index to its corresponding point vector index.

Definition at line 128 of file SCMTriDuctMeshGenerator.C.

Referenced by ductElems(), and ductPoints().

131 {
132  return layer * points_per_layer + point;
133 }

◆ ductPoints()

void SCMTriDuctMeshGenerator::ductPoints ( std::vector< Point > &  points,
const std::vector< Point > &  xsec,
const std::vector< Real > &  z_layers 
) const
protected

Calculates all the point/node positions that will be used to form elements making the duct.

Definition at line 136 of file SCMTriDuctMeshGenerator.C.

Referenced by generate().

139 {
140  points.resize(xsec.size() * z_layers.size());
141  for (size_t i = 0; i < z_layers.size(); i++)
142  for (size_t j = 0; j < xsec.size(); j++)
143  points[ductPointIndex(xsec.size(), i, j)] = Point(xsec[j](0), xsec[j](1), z_layers[i]);
144 }
size_t ductPointIndex(unsigned int points_per_layer, unsigned int layer, unsigned int point) const
Returns an index into the vector of point/node positions used/generated by ductPoints.
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")

◆ ductXsec()

void SCMTriDuctMeshGenerator::ductXsec ( std::vector< Point > &  xsec,
const std::vector< Point > &  corners,
unsigned int  nrings,
Real  pitch,
Real  flat_to_flat 
) const
protected

calcultes the points around the duct cross section boundary (perpendicular to z axis) using assembly parameters.

xsec will contain the points that

Definition at line 103 of file SCMTriDuctMeshGenerator.C.

Referenced by generate().

108 {
109  xsec.clear();
110 
111  Real r_corner = flat_to_flat / 2. / std::cos(libMesh::pi / 6.);
112  Real start_offset = (r_corner - (nrings - 2) * pitch) * std::sin(libMesh::pi / 6.);
113  Real side_length = (corners[0] - corners[1]).norm();
114 
115  for (size_t i = 0; i < corners.size(); i++)
116  {
117  auto left = corners[i];
118  auto right = corners[(i + 1) % corners.size()];
119  xsec.push_back(left);
120  auto direc = (right - left).unit();
121  for (Real offset_from_corner = start_offset; offset_from_corner < side_length;
122  offset_from_corner += pitch)
123  xsec.push_back(left + direc * offset_from_corner);
124  }
125 }
static const std::string pitch
auto norm(const T &a) -> decltype(std::abs(a))
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const Real pi

◆ generate()

std::unique_ptr< MeshBase > SCMTriDuctMeshGenerator::generate ( )
overridevirtual

Implements MeshGenerator.

Definition at line 58 of file SCMTriDuctMeshGenerator.C.

59 {
60  std::unique_ptr<MeshBase> mesh_base = std::move(_input);
61  if (!mesh_base)
62  mooseError("SCMTriDuctMeshGenerator has to be connected to a sub channel mesh generator.");
63 
64  mesh_base->set_mesh_dimension(3);
65 
66  std::vector<Point> corners;
67  ductCorners(corners, _flat_to_flat, Point(0, 0, 0));
68  std::vector<Point> xsec;
69  ductXsec(xsec, corners, _n_rings, _pitch, _flat_to_flat);
70  std::vector<Point> points;
71  ductPoints(points, xsec, _z_grid);
72  std::vector<std::vector<size_t>> elem_point_indices;
73  ductElems(elem_point_indices, _z_grid.size(), xsec.size());
74  std::vector<Node *> duct_nodes;
75  buildDuct(mesh_base, duct_nodes, points, elem_point_indices, _block_id);
76  mesh_base->subdomain_name(_block_id) = name();
77 
78  mesh_base->prepare_for_use();
79 
80  auto & sch_mesh = static_cast<TriSubChannelMesh &>(*_mesh);
81  sch_mesh.setChannelToDuctMaps(duct_nodes);
82  sch_mesh._duct_mesh_exist = true;
83 
84  return mesh_base;
85 }
void ductElems(std::vector< std::vector< size_t >> &elem_point_indices, unsigned int n_layers, unsigned int points_per_layer) const
Calculates the groups of points/nodes that comprise each element in the duct mesh.
void setChannelToDuctMaps(const std::vector< Node *> &duct_nodes)
Function that gets the channel node from the duct node.
virtual const std::string & name() const
const Real _flat_to_flat
the distance between flat surfaces of the duct facing each other
const unsigned int _block_id
block index
std::unique_ptr< MeshBase > & _input
Mesh that comes from another generator.
void buildDuct(std::unique_ptr< MeshBase > &mesh, std::vector< Node *> &duct_nodes, const std::vector< Point > &points, const std::vector< std::vector< size_t >> &elem_point_indices, SubdomainID block) const
buildDuct generates and adds mesh node and element objects to the given mesh corresponding to the giv...
const Real _pitch
Distance between the neighbor fuel pins, pitch.
Mesh class for triangular, edge and corner subchannels for hexagonal lattice fuel assemblies...
const unsigned int _n_rings
number of rings of fuel pins
void ductPoints(std::vector< Point > &points, const std::vector< Point > &xsec, const std::vector< Real > &z_layers) const
Calculates all the point/node positions that will be used to form elements making the duct...
void ductCorners(std::vector< Point > &corners, Real flat_to_flat, const Point &center) const
calculate the x-y coordinates of the corner points for the duct cross section.
std::vector< Real > _z_grid
axial location of nodes
void mooseError(Args &&... args) const
void ductXsec(std::vector< Point > &xsec, const std::vector< Point > &corners, unsigned int nrings, Real pitch, Real flat_to_flat) const
calcultes the points around the duct cross section boundary (perpendicular to z axis) using assembly ...

◆ validParams()

InputParameters SCMTriDuctMeshGenerator::validParams ( )
static

Definition at line 23 of file SCMTriDuctMeshGenerator.C.

24 {
26  params.addClassDescription(
27  "Creates a mesh of 1D duct cells around a triangular lattice subassembly");
28  params.addRequiredParam<MeshGeneratorName>("input", "The corresponding subchannel mesh");
29  params.addParam<unsigned int>("block_id", 2, "Domain Index");
30  params.addRequiredParam<unsigned int>("n_cells", "The number of cells in the axial direction");
31  params.addParam<Real>("unheated_length_entry", 0.0, "Unheated length at entry [m]");
32  params.addRequiredParam<Real>("heated_length", "Heated length [m]");
33  params.addParam<Real>("unheated_length_exit", 0.0, "Unheated length at exit [m]");
34  params.addRequiredParam<Real>("pitch", "Pitch [m]");
35  params.addRequiredParam<unsigned int>("nrings", "Number of fuel Pin rings per assembly [-]");
36  params.addRequiredParam<Real>("flat_to_flat",
37  "Flat to flat distance for the hexagonal assembly [m]");
38  return params;
39 }
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addRequiredParam(const std::string &name, const std::string &doc_string)
static InputParameters validParams()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void addClassDescription(const std::string &doc_string)

Member Data Documentation

◆ _block_id

const unsigned int SCMTriDuctMeshGenerator::_block_id
protected

block index

Definition at line 91 of file SCMTriDuctMeshGenerator.h.

Referenced by generate().

◆ _flat_to_flat

const Real SCMTriDuctMeshGenerator::_flat_to_flat
protected

the distance between flat surfaces of the duct facing each other

Definition at line 97 of file SCMTriDuctMeshGenerator.h.

Referenced by generate().

◆ _heated_length

const Real SCMTriDuctMeshGenerator::_heated_length
protected

heated length of the fuel Pin

Definition at line 87 of file SCMTriDuctMeshGenerator.h.

Referenced by SCMTriDuctMeshGenerator().

◆ _input

std::unique_ptr<MeshBase>& SCMTriDuctMeshGenerator::_input
protected

Mesh that comes from another generator.

Definition at line 79 of file SCMTriDuctMeshGenerator.h.

Referenced by generate().

◆ _n_cells

const unsigned int SCMTriDuctMeshGenerator::_n_cells
protected

number of axial cells

Definition at line 81 of file SCMTriDuctMeshGenerator.h.

Referenced by SCMTriDuctMeshGenerator().

◆ _n_rings

const unsigned int SCMTriDuctMeshGenerator::_n_rings
protected

number of rings of fuel pins

Definition at line 95 of file SCMTriDuctMeshGenerator.h.

Referenced by generate().

◆ _pitch

const Real SCMTriDuctMeshGenerator::_pitch
protected

Distance between the neighbor fuel pins, pitch.

Definition at line 93 of file SCMTriDuctMeshGenerator.h.

Referenced by generate().

◆ _unheated_length_entry

const Real SCMTriDuctMeshGenerator::_unheated_length_entry
protected

unheated length of the fuel Pin at the entry of the assembly

Definition at line 85 of file SCMTriDuctMeshGenerator.h.

Referenced by SCMTriDuctMeshGenerator().

◆ _unheated_length_exit

const Real SCMTriDuctMeshGenerator::_unheated_length_exit
protected

unheated length of the fuel Pin at the exit of the assembly

Definition at line 89 of file SCMTriDuctMeshGenerator.h.

Referenced by SCMTriDuctMeshGenerator().

◆ _z_grid

std::vector<Real> SCMTriDuctMeshGenerator::_z_grid
protected

axial location of nodes

Definition at line 83 of file SCMTriDuctMeshGenerator.h.

Referenced by generate(), and SCMTriDuctMeshGenerator().


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