https://mooseframework.inl.gov
TriSubChannelMesh.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 
18 {
19 public:
21  TriSubChannelMesh(const TriSubChannelMesh & other_mesh);
22  virtual std::unique_ptr<MooseMesh> safeClone() const override;
23  virtual void buildMesh() override;
24 
25  virtual const unsigned int & getNumOfPins() const override { return _npins; }
26 
27  virtual Node * getPinNode(unsigned int i_pin, unsigned iz) const override
28  {
29  return _pin_nodes[i_pin][iz];
30  }
31 
32  virtual bool pinMeshExist() const override { return _pin_mesh_exist; }
33  virtual bool ductMeshExist() const override { return _duct_mesh_exist; }
34 
38  virtual const Real & getDuctToPinGap() const { return _duct_to_pin_gap; }
39 
43  virtual const unsigned int & getNumOfRings() const { return _n_rings; }
44 
48  virtual const unsigned int & getPinIndex(const unsigned int channel_idx,
49  const unsigned int neighbor_idx)
50  {
51  return _chan_to_pin_map[channel_idx][neighbor_idx];
52  }
53 
57  virtual const Real & getWireDiameter() const { return _dwire; }
58 
62  virtual const Real & getFlatToFlat() const { return _flat_to_flat; }
63 
67  virtual const Real & getWireLeadLength() const { return _hwire; }
68 
69  virtual Node * getChannelNode(unsigned int i_chan, unsigned iz) const override
70  {
71  return _nodes[i_chan][iz];
72  }
73  virtual const unsigned int & getNumOfChannels() const override { return _n_channels; }
74  virtual const unsigned int & getNumOfGapsPerLayer() const override { return _n_gaps; }
75  virtual const std::pair<unsigned int, unsigned int> &
76  getGapChannels(unsigned int i_gap) const override
77  {
78  return _gap_to_chan_map[i_gap];
79  }
80  virtual const std::pair<unsigned int, unsigned int> &
81  getGapPins(unsigned int i_gap) const override
82  {
83  return _gap_to_pin_map[i_gap];
84  }
85  virtual const std::vector<unsigned int> & getChannelGaps(unsigned int i_chan) const override
86  {
87  return _chan_to_gap_map[i_chan];
88  }
89  virtual const Real & getCrossflowSign(unsigned int i_chan, unsigned int i_local) const override
90  {
91  return _sign_id_crossflow_map[i_chan][i_local];
92  }
93 
94  virtual unsigned int getSubchannelIndexFromPoint(const Point & p) const override;
95  virtual unsigned int channelIndex(const Point & point) const override;
96 
97  virtual EChannelType getSubchannelType(unsigned int index) const override
98  {
99  return _subch_type[index];
100  }
101 
102  virtual Real getGapWidth(unsigned int axial_index, unsigned int gap_index) const override
103  {
104  return _gij_map[axial_index][gap_index];
105  }
106 
107  virtual const std::pair<unsigned int, unsigned int> & getSweepFlowGaps(unsigned int i_chan) const
108  {
109  return _gap_pairs_sf[i_chan];
110  }
111 
112  virtual const std::pair<unsigned int, unsigned int> & getSweepFlowChans(unsigned int i_chan) const
113  {
114  return _chan_pairs_sf[i_chan];
115  }
116 
117  virtual const std::vector<unsigned int> & getPinChannels(unsigned int i_pin) const override
118  {
119  return _pin_to_chan_map[i_pin];
120  }
121 
122  virtual const std::vector<unsigned int> & getChannelPins(unsigned int i_chan) const override
123  {
124  return _chan_to_pin_map[i_chan];
125  }
126 
127  virtual unsigned int getPinIndexFromPoint(const Point & p) const override;
128  virtual unsigned int pinIndex(const Point & p) const override;
129 
133  void setChannelToDuctMaps(const std::vector<Node *> & duct_nodes);
134 
135  virtual Node * getChanNodeFromDuct(Node * duct_node) override
136  {
137  return _duct_node_to_chan_map[duct_node];
138  }
139 
143  virtual Node * getDuctNodeFromChannel(Node * channel_node) override
144  {
145  return _chan_to_duct_node_map[channel_node];
146  }
147 
151  virtual Node * getChannelNodeFromDuct(Node * channel_node) override
152  {
153  return _duct_node_to_chan_map[channel_node];
154  }
155 
159  virtual const std::vector<Node *> getDuctNodes() const override { return _duct_nodes; }
160 
161 protected:
163  unsigned int _n_rings;
165  unsigned int _n_channels;
175  std::vector<std::vector<Node *>> _nodes;
177  std::vector<std::vector<Node *>> _pin_nodes;
178 
181  std::vector<Node *> _duct_nodes;
184  std::map<Node *, Node *> _chan_to_duct_node_map;
187  std::map<Node *, Node *> _duct_node_to_chan_map;
188 
190  std::vector<std::pair<unsigned int, unsigned int>> _gap_to_chan_map;
192  std::vector<std::pair<unsigned int, unsigned int>> _gap_to_pin_map;
194  std::vector<std::vector<unsigned int>> _chan_to_gap_map;
199  std::vector<std::vector<Real>> _sign_id_crossflow_map;
201  std::vector<std::vector<Real>> _gij_map;
203  std::vector<Point> _pin_position;
205  std::vector<std::vector<Real>> _pins_in_rings;
207  std::vector<std::vector<unsigned int>> _chan_to_pin_map;
209  unsigned int _npins;
211  unsigned int _n_gaps;
213  std::vector<EChannelType> _subch_type;
215  std::vector<EChannelType> _gap_type;
217  std::vector<std::pair<unsigned int, unsigned int>> _gap_pairs_sf;
219  std::vector<std::pair<unsigned int, unsigned int>> _chan_pairs_sf;
221  std::vector<std::vector<unsigned int>> _pin_to_chan_map;
226 
227 public:
228  static InputParameters validParams();
229 
236  static void
237  rodPositions(std::vector<Point> & positions, unsigned int nrings, Real pitch, Point center);
238 
244 
246  static const unsigned int N_CORNERS = 6;
247 };
virtual bool pinMeshExist() const override
Return if Pin Mesh exists or not.
std::vector< EChannelType > _subch_type
subchannel type
std::vector< Node * > _duct_nodes
A list of all mesh nodes that form the (elements of) the hexagonal duct mesh that surrounds the pins/...
virtual EChannelType getSubchannelType(unsigned int index) const override
Return the type of the subchannel for given subchannel index.
virtual std::unique_ptr< MooseMesh > safeClone() const override
virtual const Real & getDuctToPinGap() const
Return the the gap thickness between the duct and peripheral fuel pins.
std::vector< std::vector< Real > > _sign_id_crossflow_map
Defines the global cross-flow direction -1 or 1 for each subchannel and for all gaps that are belongi...
std::vector< std::vector< unsigned int > > _pin_to_chan_map
TODO: channel indices corresponding to a given pin index.
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.
virtual Node * getChannelNode(unsigned int i_chan, unsigned iz) const override
Get the subchannel mesh node for a given channel index and elevation index.
virtual unsigned int getSubchannelIndexFromPoint(const Point &p) const override
Return a subchannel index for a given physical point p
std::vector< std::pair< unsigned int, unsigned int > > _gap_to_chan_map
stores the channel pairs for each gap
TriSubChannelMesh(const InputParameters &parameters)
std::vector< std::vector< unsigned int > > _chan_to_pin_map
stores the fuel pins belonging to each subchannel
Real _dwire
wire diameter
virtual Node * getPinNode(unsigned int i_pin, unsigned iz) const override
Get the pin mesh node for a given pin index and elevation index.
void setChannelToDuctMaps(const std::vector< Node *> &duct_nodes)
Function that gets the channel node from the duct node.
virtual const std::vector< unsigned int > & getChannelGaps(unsigned int i_chan) const override
Return a vector of gap indices for a given channel index.
virtual const unsigned int & getNumOfChannels() const override
Return the number of channels per layer.
Real _hwire
wire lead length
static const unsigned int N_CORNERS
number of corners in the duct x-sec
Real _duct_to_pin_gap
the gap thickness between the duct and peripheral fuel pins
virtual const unsigned int & getNumOfRings() const
Return the number of rings.
virtual void buildMesh() override
virtual Node * getChanNodeFromDuct(Node *duct_node) override
Function that gets the channel node from the duct node.
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.
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.
std::vector< std::pair< unsigned int, unsigned int > > _gap_to_pin_map
stores the fuel pins belonging to each gap
virtual Node * getChannelNodeFromDuct(Node *channel_node) override
Function that gets the channel node from the duct node.
unsigned int _n_rings
number of rings of fuel pins
bool _pin_mesh_exist
Flag that informs the solver whether there is a Pin Mesh or not.
Triangular subchannel solver.
Mesh class for triangular, edge and corner subchannels for hexagonal lattice fuel assemblies...
virtual unsigned int channelIndex(const Point &point) const override
virtual const unsigned int & getNumOfGapsPerLayer() const override
Return the number of gaps per layer.
static const std::string pitch
Real _flat_to_flat
the distance between flat surfaces of the duct facing each other
std::vector< std::vector< unsigned int > > _chan_to_gap_map
stores the gaps that forms each subchannel
unsigned int _npins
number of fuel pins
std::vector< std::vector< Real > > _gij_map
gap size
virtual const std::pair< unsigned int, unsigned int > & getSweepFlowGaps(unsigned int i_chan) const
virtual unsigned int getPinIndexFromPoint(const Point &p) const override
Return a pin index for a given physical point p
std::vector< std::vector< Real > > _pins_in_rings
fuel pins that are belonging to each ring
virtual const std::vector< unsigned int > & getPinChannels(unsigned int i_pin) const override
Return a vector of channel indices for a given Pin index.
EChannelType
Enum for describing the center, edge and corner subchannels or gap types.
Mesh class for triangular, edge and corner subchannels for hexagonal lattice fuel assemblies...
static void rodPositions(std::vector< Point > &positions, unsigned int nrings, Real pitch, Point center)
Calculates and stores the pin positions/centers for a hexagonal assembly containing the given number ...
virtual const Real & getFlatToFlat() const
Return flat to flat [m].
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 > & getSweepFlowChans(unsigned int i_chan) const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
std::vector< std::vector< Node * > > _nodes
nodes
virtual bool ductMeshExist() const override
Return if Duct Mesh exists or not.
std::vector< EChannelType > _gap_type
gap type
virtual Node * getDuctNodeFromChannel(Node *channel_node) override
Function that gets the duct node from the channel node.
Class to create Pin mesh in the square lattice geometry.
virtual const unsigned int & getNumOfPins() const override
Return the number of pins.
virtual unsigned int pinIndex(const Point &p) const override
std::vector< std::vector< Node * > > _pin_nodes
pin nodes
virtual const Real & getWireLeadLength() const
Return the wire lead length.
const InputParameters & parameters() const
Base class for subchannel meshes.
std::vector< Point > _pin_position
x,y coordinates of the fuel pins
bool _duct_mesh_exist
Flag that informs the solver whether there is a Duct Mesh or not.
std::vector< std::pair< unsigned int, unsigned int > > _gap_pairs_sf
sweeping flow model gap pairs per channel to specify directional edge flow
virtual const std::vector< Node * > getDuctNodes() const override
Function that return the vector with the maps to the nodes.
virtual const std::vector< unsigned int > & getChannelPins(unsigned int i_chan) const override
Return a vector of pin indices for a given channel index.
std::map< Node *, Node * > _chan_to_duct_node_map
A map for providing the closest/corresponding duct node associated with each subchannel node...
unsigned int _n_channels
number of subchannels
static InputParameters validParams()
Mesh generator for fuel pins in a triangular lattice.
static const std::string center
Definition: NS.h:28
std::map< Node *, Node * > _duct_node_to_chan_map
A map for providing the closest/corresponding subchannel node associated with each duct node...
std::vector< std::pair< unsigned int, unsigned int > > _chan_pairs_sf
sweeping flow model channel pairs to specify directional edge flow
unsigned int _n_gaps
number of gaps
virtual const unsigned int & getPinIndex(const unsigned int channel_idx, const unsigned int neighbor_idx)
Return Pin index given subchannel index and local neighbor index.
Mesh generator for hexagonal duct.
virtual const Real & getWireDiameter() const
Return wire diameter.