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 
19 {
20 public:
22  QuadSubChannelMesh(const QuadSubChannelMesh & other_mesh);
23  virtual std::unique_ptr<MooseMesh> safeClone() const override;
24  virtual void buildMesh() override;
25 
26  virtual Node * getChannelNode(unsigned int i_chan, unsigned iz) const override
27  {
28  return _nodes[i_chan][iz];
29  }
30 
31  virtual Node * getPinNode(unsigned int i_pin, unsigned iz) const override
32  {
33  return _pin_nodes[i_pin][iz];
34  }
35 
41  virtual Node * getDuctNodeFromChannel(Node *) override { return nullptr; }
43  virtual Node * getChannelNodeFromDuct(Node *) override { return nullptr; }
44  virtual const std::vector<Node *> getDuctNodes() const override { return std::vector<Node *>(); }
46 
47  virtual unsigned int getNumOfChannels() const override
48  {
49  return processor_id() == 0 ? _n_channels : 0;
50  }
51  virtual unsigned int getNumOfGapsPerLayer() const override
52  {
53  return processor_id() == 0 ? _n_gaps : 0;
54  }
55  virtual unsigned int getNumOfPins() const override { return processor_id() == 0 ? _n_pins : 0; }
56  virtual bool pinMeshExist() const override { return _pin_mesh_exist; }
57  virtual bool ductMeshExist() const override { return false; }
58  virtual const std::pair<unsigned int, unsigned int> &
59  getGapChannels(unsigned int i_gap) const override
60  {
61  return _gap_to_chan_map[i_gap];
62  }
63  virtual const std::pair<unsigned int, unsigned int> &
64  getGapPins(unsigned int i_gap) const override
65  {
66  return _gap_to_pin_map[i_gap];
67  }
68  virtual const std::vector<unsigned int> & getChannelGaps(unsigned int i_chan) const override
69  {
70  return _chan_to_gap_map[i_chan];
71  }
72  virtual const std::vector<unsigned int> & getPinChannels(unsigned int i_pin) const override
73  {
74  return _pin_to_chan_map[i_pin];
75  }
76  virtual const std::vector<unsigned int> & getChannelPins(unsigned int i_chan) const override
77  {
78  return _chan_to_pin_map[i_chan];
79  }
80  virtual const Real & getPitch() const override { return _pitch; }
81  virtual const Real & getCrossflowSign(unsigned int i_chan, unsigned int i_local) const override
82  {
83  return _sign_id_crossflow_map[i_chan][i_local];
84  }
86  virtual const unsigned int & getNx() const { return _nx; }
88  virtual const unsigned int & getNy() const { return _ny; }
93  const Real & getSideGap() const { return _side_gap; }
94 
95  unsigned int getSubchannelIndexFromPoint(const Point & p) const override;
96  virtual unsigned int channelIndex(const Point & point) const override;
97 
98  unsigned int getPinIndexFromPoint(const Point & p) const override;
99  virtual unsigned int pinIndex(const Point & p) const override;
100 
101  virtual EChannelType getSubchannelType(unsigned int index) const override
102  {
103  return _subch_type[index];
104  }
105 
106  virtual Real getGapWidth(unsigned int axial_index, unsigned int gap_index) const override
107  {
108  return _gij_map[axial_index][gap_index];
109  }
110 
111 protected:
113  unsigned int _nx;
115  unsigned int _ny;
117  unsigned int _n_channels;
119  unsigned int _n_gaps;
121  unsigned int _n_pins;
129  std::vector<std::vector<Node *>> _nodes;
131  std::vector<std::vector<Node *>> _pin_nodes;
133  std::vector<std::vector<Node *>> _gapnodes;
135  std::vector<std::pair<unsigned int, unsigned int>> _gap_to_chan_map;
137  std::vector<std::pair<unsigned int, unsigned int>> _gap_to_pin_map;
139  std::vector<std::vector<unsigned int>> _chan_to_gap_map;
141  std::vector<std::vector<unsigned int>> _chan_to_pin_map;
143  std::vector<std::vector<unsigned int>> _pin_to_chan_map;
145  std::vector<std::vector<double>> _sign_id_crossflow_map;
147  std::vector<std::vector<Real>> _gij_map;
149  std::vector<EChannelType> _subch_type;
152 
153 public:
154  static InputParameters validParams();
155 
164  static void generatePinCenters(
165  unsigned int nx, unsigned int ny, Real pitch, Real elev, std::vector<Point> & pin_centers);
166 
170 };
virtual 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.
std::vector< std::vector< unsigned int > > _chan_to_gap_map
map relating subchannel index to gap index
Class for Subchannel mesh generation in the square lattice geometry.
std::vector< std::pair< unsigned int, unsigned int > > _gap_to_pin_map
map relating gap index to fuel pin index
virtual Node * getPinNode(unsigned int i_pin, unsigned iz) const override
Get the pin mesh node for a given pin index and elevation index.
virtual const std::vector< Node * > getDuctNodes() const override
Function that return the vector with the maps to the nodes if they exist.
unsigned int _n_gaps
Number of gaps per layer.
std::vector< EChannelType > _subch_type
Subchannel type.
virtual unsigned int pinIndex(const Point &p) const override
virtual 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::vector< unsigned int > > _pin_to_chan_map
map relating fuel pin index to subchannel index
const InputParameters & parameters() const
virtual 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.
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...
virtual std::unique_ptr< MooseMesh > safeClone() const override
bool _pin_mesh_exist
Flag that informs the solver whether there is a Pin Mesh or not.
std::vector< std::vector< unsigned int > > _chan_to_pin_map
map relating subchannel index to fuel pin index
unsigned int _ny
number of subchannels in the y direction
Creates the mesh of subchannels in a quadrilateral lattice.
virtual bool ductMeshExist() const override
Return if Duct Mesh exists or not.
virtual unsigned int channelIndex(const Point &point) const override
virtual Real getGapWidth(unsigned int axial_index, unsigned int gap_index) const override
Return gap width for a given gap index.
virtual 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 _n_pins
Number of pins.
virtual unsigned int getNumOfPins() const override
Return the 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...
std::vector< std::pair< unsigned int, unsigned int > > _gap_to_chan_map
map relating gap index to subchannel index
virtual unsigned int getNumOfGapsPerLayer() const override
Return the number of gaps per layer.
virtual void buildMesh() override
unsigned int getSubchannelIndexFromPoint(const Point &p) const override
Return a subchannel index for a given physical point p
virtual bool pinMeshExist() const override
Return if Pin Mesh exists or not.
static const std::string pitch
virtual unsigned int getNumOfChannels() const override
Return the number of channels per layer.
EChannelType
Enum for describing the center, edge and corner subchannels or gap types.
Quadrilateral subchannel solver.
Real _pitch
Distance between the neighbor fuel pins, pitch.
virtual Node * getChannelNodeFromDuct(Node *) override
Function that gets the channel node from the duct node.
std::vector< std::vector< double > > _sign_id_crossflow_map
Matrix used to give local sign to crossflow quantities.
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
virtual const Real & getPitch() const override
Return the pitch between 2 subchannels.
static InputParameters validParams()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual const unsigned int & getNy() const
Number of subchannels in the -y direction.
virtual Node * getChannelNode(unsigned int i_chan, unsigned iz) const override
Get the subchannel mesh node for a given channel index and elevation index.
QuadSubChannelMesh(const InputParameters &parameters)
std::vector< std::vector< Real > > _gij_map
Vector to store gap size.
virtual const std::vector< unsigned int > & getPinChannels(unsigned int i_pin) const override
Return a vector of channel indices for a given Pin index.
std::vector< std::vector< Node * > > _nodes
vector of subchannel nodes
std::vector< std::vector< Node * > > _pin_nodes
vector of fuel pin nodes
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
virtual const unsigned int & getNx() const
Number of subchannels in the -x direction.
virtual EChannelType getSubchannelType(unsigned int index) const override
Return the type of the subchannel for given subchannel index.
virtual const std::vector< unsigned int > & getChannelPins(unsigned int i_chan) const override
Return a vector of pin indices for a given channel index.
processor_id_type processor_id() const
virtual Node * getDuctNodeFromChannel(Node *) override
Duct functions not applicable to quad channel.
Class to create Pin mesh in the square lattice geometry.