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 * getChanNodeFromDuct(Node *) override { return nullptr; }
43  virtual Node * getDuctNodeFromChannel(Node *) override { return nullptr; }
44  virtual Node * getChannelNodeFromDuct(Node *) override { return nullptr; }
45  virtual const std::vector<Node *> getDuctNodes() const override { return std::vector<Node *>(); }
47 
48  virtual const unsigned int & getNumOfChannels() const override { return _n_channels; }
49  virtual const unsigned int & getNumOfGapsPerLayer() const override { return _n_gaps; }
50  virtual const unsigned int & getNumOfPins() const override { return _n_pins; }
51  virtual bool pinMeshExist() const override { return _pin_mesh_exist; }
52  virtual bool ductMeshExist() const override { return false; }
53  virtual const std::pair<unsigned int, unsigned int> &
54  getGapChannels(unsigned int i_gap) const override
55  {
56  return _gap_to_chan_map[i_gap];
57  }
58  virtual const std::pair<unsigned int, unsigned int> &
59  getGapPins(unsigned int i_gap) const override
60  {
61  return _gap_to_pin_map[i_gap];
62  }
63  virtual const std::vector<unsigned int> & getChannelGaps(unsigned int i_chan) const override
64  {
65  return _chan_to_gap_map[i_chan];
66  }
67  virtual const std::vector<unsigned int> & getPinChannels(unsigned int i_pin) const override
68  {
69  return _pin_to_chan_map[i_pin];
70  }
71  virtual const std::vector<unsigned int> & getChannelPins(unsigned int i_chan) const override
72  {
73  return _chan_to_pin_map[i_chan];
74  }
75  virtual const Real & getPitch() const override { return _pitch; }
76  virtual const Real & getCrossflowSign(unsigned int i_chan, unsigned int i_local) const override
77  {
78  return _sign_id_crossflow_map[i_chan][i_local];
79  }
81  virtual const unsigned int & getNx() const { return _nx; }
83  virtual const unsigned int & getNy() const { return _ny; }
88  const Real & getGap() const { return _gap; }
89 
90  unsigned int getSubchannelIndexFromPoint(const Point & p) const override;
91  virtual unsigned int channelIndex(const Point & point) const override;
92 
93  unsigned int getPinIndexFromPoint(const Point & p) const override;
94  virtual unsigned int pinIndex(const Point & p) const override;
95 
96  virtual EChannelType getSubchannelType(unsigned int index) const override
97  {
98  return _subch_type[index];
99  }
100 
101  virtual Real getGapWidth(unsigned int axial_index, unsigned int gap_index) const override
102  {
103  return _gij_map[axial_index][gap_index];
104  }
105 
106 protected:
108  unsigned int _nx;
110  unsigned int _ny;
112  unsigned int _n_channels;
114  unsigned int _n_gaps;
116  unsigned int _n_pins;
123  std::vector<std::vector<Node *>> _nodes;
125  std::vector<std::vector<Node *>> _pin_nodes;
127  std::vector<std::vector<Node *>> _gapnodes;
129  std::vector<std::pair<unsigned int, unsigned int>> _gap_to_chan_map;
131  std::vector<std::pair<unsigned int, unsigned int>> _gap_to_pin_map;
133  std::vector<std::vector<unsigned int>> _chan_to_gap_map;
135  std::vector<std::vector<unsigned int>> _chan_to_pin_map;
137  std::vector<std::vector<unsigned int>> _pin_to_chan_map;
139  std::vector<std::vector<double>> _sign_id_crossflow_map;
141  std::vector<std::vector<Real>> _gij_map;
143  std::vector<EChannelType> _subch_type;
146 
147 public:
148  static InputParameters validParams();
149 
158  static void generatePinCenters(
159  unsigned int nx, unsigned int ny, Real pitch, Real elev, std::vector<Point> & pin_centers);
160 
164 };
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
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.
Real _gap
The gap, not to be confused with the gap between pins, this refers to the gap next to the duct...
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.
std::vector< std::pair< unsigned int, unsigned int > > _gap_to_chan_map
map relating gap index to subchannel index
const Real & getGap() const
Returns the gap, not to be confused with the gap between pins, this refers to the gap next to the duc...
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 Node * getChanNodeFromDuct(Node *) override
Duct functions not applicable to quad channel.
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.
virtual const unsigned int & getNumOfChannels() const override
Return the number of channels per layer.
std::vector< std::vector< Node * > > _nodes
vector of subchannel nodes
std::vector< std::vector< Node * > > _pin_nodes
vector of fuel pin nodes
virtual const unsigned int & getNumOfGapsPerLayer() const override
Return the number of gaps per layer.
virtual const unsigned int & getNumOfPins() const override
Return the number of pins.
const InputParameters & parameters() const
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.
virtual Node * getDuctNodeFromChannel(Node *) override
Function that gets the duct node from the channel node.
Class to create Pin mesh in the square lattice geometry.