https://mooseframework.inl.gov
QuadSubChannelMesh.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 "SubChannelMesh.h"
13 #include "SubChannelEnums.h"
14 
15 #include <map>
16 #include <vector>
17 #include <memory> // for unique_ptr
18 #include <utility> // for std::pair
19 
24 {
25 public:
27  QuadSubChannelMesh(const QuadSubChannelMesh & other_mesh);
28 
29  std::unique_ptr<MooseMesh> safeClone() const override;
30  void buildMesh() override;
31 
36 
37  Real getSubchannelFlowArea(unsigned int i_chan, Real z) const override;
38  Real getSubchannelWettedPerimeter(unsigned int i_chan) const override;
39 
40  Node * getChannelNode(unsigned int i_chan, unsigned int iz) const override
41  {
42  return _nodes[i_chan][iz];
43  }
44 
45  Node * getPinNode(unsigned int i_pin, unsigned int iz) const override
46  {
47  return _pin_nodes[i_pin][iz];
48  }
49 
50  unsigned int getNumOfChannels() const override { return processor_id() == 0 ? _n_channels : 0; }
51  unsigned int getNumOfGapsPerLayer() const override { return processor_id() == 0 ? _n_gaps : 0; }
52  unsigned int getNumOfPins() const override { return processor_id() == 0 ? _n_pins : 0; }
53 
54  const std::pair<unsigned int, unsigned int> & getGapChannels(unsigned int i_gap) const override
55  {
56  return _gap_to_chan_map[i_gap];
57  }
58  const std::pair<unsigned int, unsigned int> & getGapPins(unsigned int i_gap) const override
59  {
60  return _gap_to_pin_map[i_gap];
61  }
62  const std::vector<unsigned int> & getChannelGaps(unsigned int i_chan) const override
63  {
64  return _chan_to_gap_map[i_chan];
65  }
66  const std::vector<unsigned int> & getPinChannels(unsigned int i_pin) const override
67  {
68  return _pin_to_chan_map[i_pin];
69  }
70  const std::vector<unsigned int> & getChannelPins(unsigned int i_chan) const override
71  {
72  return _chan_to_pin_map[i_chan];
73  }
74  const Real & getPitch() const override { return _pitch; }
75  const Real & getCrossflowSign(unsigned int i_chan, unsigned int i_local) const override
76  {
77  return _sign_id_crossflow_map[i_chan][i_local];
78  }
79 
81  const unsigned int & getNx() const { return _nx; }
83  const unsigned int & getNy() const { return _ny; }
84 
89  const Real & getSideGap() const { return _side_gap; }
90 
91  unsigned int getSubchannelIndexFromPoint(const Point & p) const override;
92  unsigned int channelIndex(const Point & point) const override;
93 
94  unsigned int getPinIndexFromPoint(const Point & p) const override;
95  unsigned int pinIndex(const Point & p) const override;
96 
97  EChannelType getSubchannelType(unsigned int index) const override { return _subch_type[index]; }
98 
99  Real getGapWidth(unsigned int axial_index, unsigned int gap_index) const override
100  {
101  return _gij_map[axial_index][gap_index];
102  }
103 
107  void setGapWidth(unsigned int axial_index, unsigned int gap_index, Real gap_width)
108  {
109  _gij_map[axial_index][gap_index] = gap_width;
110  }
111 
112 protected:
114  unsigned int _nx;
116  unsigned int _ny;
118  unsigned int _n_channels;
120  unsigned int _n_gaps;
122  unsigned int _n_pins;
123 
130 
132  std::vector<std::vector<Node *>> _nodes;
134  std::vector<std::vector<Node *>> _pin_nodes;
136  std::vector<std::vector<Node *>> _gapnodes;
137 
139  std::vector<std::pair<unsigned int, unsigned int>> _gap_to_chan_map;
141  std::vector<std::pair<unsigned int, unsigned int>> _gap_to_pin_map;
143  std::vector<std::vector<unsigned int>> _chan_to_gap_map;
145  std::vector<std::vector<unsigned int>> _chan_to_pin_map;
147  std::vector<std::vector<unsigned int>> _pin_to_chan_map;
148 
150  std::vector<std::vector<double>> _sign_id_crossflow_map;
152  std::vector<std::vector<Real>> _gij_map;
154  std::vector<EChannelType> _subch_type;
155 
156 public:
157  static InputParameters validParams();
158 
167  static void generatePinCenters(
168  unsigned int nx, unsigned int ny, Real pitch, Real elev, std::vector<Point> & pin_centers);
169 
171 };
std::vector< std::vector< unsigned int > > _chan_to_gap_map
map relating subchannel index to gap index
std::vector< std::pair< unsigned int, unsigned int > > _gap_to_pin_map
map relating gap index to fuel pin index
EChannelType getSubchannelType(unsigned int index) const override
Return the type of the subchannel for given subchannel index.
Real getSubchannelFlowArea(unsigned int i_chan, Real z) const override
Return undeformed flow area for a subchannel at an axial location, including any blockage reduction...
const unsigned int & getNy() const
Number of subchannels in the -y direction.
const std::vector< unsigned int > & getPinChannels(unsigned int i_pin) const override
Return a vector of channel indices for a given Pin index.
unsigned int _n_gaps
Number of gaps per layer.
std::vector< EChannelType > _subch_type
Subchannel type.
unsigned int pinIndex(const Point &p) const override
Node * getChannelNode(unsigned int i_chan, unsigned int iz) const override
Get the subchannel mesh node for a given channel index and elevation index.
std::vector< std::vector< unsigned int > > _pin_to_chan_map
map relating fuel pin index to subchannel index
const InputParameters & parameters() const
const Real & getSideGap() const
Returns the side gap, not to be confused with the gap between pins, this refers to the gap next to th...
std::unique_ptr< MooseMesh > safeClone() const override
std::vector< std::vector< unsigned int > > _chan_to_pin_map
map relating subchannel index to fuel pin index
void setGapWidth(unsigned int axial_index, unsigned int gap_index, Real gap_width)
Set the gap width for a given axial cell and gap index.
unsigned int _ny
number of subchannels in the y direction
const std::vector< unsigned int > & getChannelPins(unsigned int i_chan) const override
Return a vector of pin indices for a given channel index.
Creates the mesh of subchannels in a quadrilateral lattice.
unsigned int getNumOfGapsPerLayer() const override
Return the number of gaps per layer.
unsigned int channelIndex(const Point &point) const override
unsigned int _n_pins
Number of pins.
Real _side_gap
The side gap, not to be confused with the gap between pins, this refers to the gap next to the duct o...
const std::vector< unsigned int > & getChannelGaps(unsigned int i_chan) const override
Return a vector of gap indices for a given channel index.
std::vector< std::pair< unsigned int, unsigned int > > _gap_to_chan_map
map relating gap index to subchannel index
void buildMesh() override
unsigned int getSubchannelIndexFromPoint(const Point &p) const override
Return a subchannel index for a given physical point p
static const std::string pitch
const Real & getPitch() const override
Return the undeformed pitch between 2 subchannels.
void computeAssemblyHydraulicParameters()
Compute undeformed bundle-average inlet hydraulic quantities from generated mesh geometry.
EChannelType
Enum for describing the center, edge and corner subchannels or gap types.
const std::pair< unsigned int, unsigned int > & getGapPins(unsigned int i_gap) const override
Return a pair of pin indices for a given gap index.
Real _pitch
Distance between the neighbor fuel pins, pitch.
const Real & getCrossflowSign(unsigned int i_chan, unsigned int i_local) const override
Return a sign for the crossflow given a subchannel index and local neighbor index.
Node * getPinNode(unsigned int i_pin, unsigned int iz) const override
Get the pin mesh node for a given pin index and elevation index.
std::vector< std::vector< double > > _sign_id_crossflow_map
Matrix used to give local sign to crossflow quantities.
const unsigned int & getNx() const
Number of subchannels in the -x direction.
static void generatePinCenters(unsigned int nx, unsigned int ny, Real pitch, Real elev, std::vector< Point > &pin_centers)
Generate pin centers.
unsigned int _n_channels
number of subchannels in total
static InputParameters validParams()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
QuadSubChannelMesh(const InputParameters &parameters)
Real getGapWidth(unsigned int axial_index, unsigned int gap_index) const override
Return gap width for a given gap index.
const Real p
std::vector< std::vector< Real > > _gij_map
Vector to store gap size.
Mesh generator that builds a mesh of 1D lines representing subchannels and pins in a quadrilateral as...
std::vector< std::vector< Node * > > _nodes
vector of subchannel nodes
std::vector< std::vector< Node * > > _pin_nodes
vector of fuel pin nodes
const std::pair< unsigned int, unsigned int > & getGapChannels(unsigned int i_gap) const override
Return a pair of subchannel indices for a given gap index.
unsigned int getPinIndexFromPoint(const Point &p) const override
Return a pin index for a given physical point p
std::vector< std::vector< Node * > > _gapnodes
vector of gap (interface between pairs of neighboring subchannels) nodes
Base class for subchannel meshes.
unsigned int _nx
number of subchannels in the x direction
unsigned int getNumOfChannels() const override
Return the number of channels per layer.
Real getSubchannelWettedPerimeter(unsigned int i_chan) const override
Return undeformed wetted perimeter for a subchannel.
processor_id_type processor_id() const
unsigned int getNumOfPins() const override
Return the number of pins.