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 
14 #include <map>
15 #include <vector>
16 #include <memory> // std::unique_ptr
17 #include <utility> // std::pair
18 
23 {
24 public:
26  TriSubChannelMesh(const TriSubChannelMesh & other_mesh);
27 
28  std::unique_ptr<MooseMesh> safeClone() const override;
29  void buildMesh() override;
30 
35 
36  Real getSubchannelFlowArea(unsigned int i_chan, Real z) const override;
37  Real getSubchannelWettedPerimeter(unsigned int i_chan) const override;
38 
39  unsigned int getNumOfPins() const override { return processor_id() == 0 ? _npins : 0; }
40 
41  Node * getPinNode(unsigned int i_pin, unsigned int iz) const override
42  {
43  return _pin_nodes[i_pin][iz];
44  }
45 
49  const Real & getDuctToPinGap() const { return _duct_to_pin_gap; }
50 
54  const unsigned int & getNumOfRings() const { return _n_rings; }
55 
59  const unsigned int & getPinIndex(const unsigned int channel_idx, const unsigned int neighbor_idx)
60  {
61  return _chan_to_pin_map[channel_idx][neighbor_idx];
62  }
63 
67  const Real & getWireDiameter() const { return _dwire; }
68 
72  const Real & getFlatToFlat() const { return _flat_to_flat; }
73 
77  const Real & getWireLeadLength() const { return _hwire; }
78 
79  Node * getChannelNode(unsigned int i_chan, unsigned int iz) const override
80  {
81  return _nodes[i_chan][iz];
82  }
83 
84  unsigned int getNumOfChannels() const override { return processor_id() == 0 ? _n_channels : 0; }
85 
86  unsigned int getNumOfGapsPerLayer() const override { return processor_id() == 0 ? _n_gaps : 0; }
87 
88  const std::pair<unsigned int, unsigned int> & getGapChannels(unsigned int i_gap) const override
89  {
90  return _gap_to_chan_map[i_gap];
91  }
92 
93  const std::pair<unsigned int, unsigned int> & getGapPins(unsigned int i_gap) const override
94  {
95  return _gap_to_pin_map[i_gap];
96  }
97 
98  const std::vector<unsigned int> & getChannelGaps(unsigned int i_chan) const override
99  {
100  return _chan_to_gap_map[i_chan];
101  }
102 
103  const Real & getCrossflowSign(unsigned int i_chan, unsigned int i_local) const override
104  {
105  return _sign_id_crossflow_map[i_chan][i_local];
106  }
107 
108  unsigned int getSubchannelIndexFromPoint(const Point & p) const override;
109  unsigned int channelIndex(const Point & point) const override;
110 
111  EChannelType getSubchannelType(unsigned int index) const override { return _subch_type[index]; }
112 
113  Real getGapWidth(unsigned int axial_index, unsigned int gap_index) const override
114  {
115  return _gij_map[axial_index][gap_index];
116  }
117 
121  void setGapWidth(unsigned int axial_index, unsigned int gap_index, Real gap_width)
122  {
123  _gij_map[axial_index][gap_index] = gap_width;
124  }
125 
126  const std::pair<unsigned int, unsigned int> & getSweepFlowGaps(unsigned int i_chan) const
127  {
128  return _gap_pairs_sf[i_chan];
129  }
130 
131  const std::pair<unsigned int, unsigned int> & getSweepFlowChans(unsigned int i_chan) const
132  {
133  return _chan_pairs_sf[i_chan];
134  }
135 
136  const std::vector<unsigned int> & getPinChannels(unsigned int i_pin) const override
137  {
138  return _pin_to_chan_map[i_pin];
139  }
140 
141  const std::vector<unsigned int> & getChannelPins(unsigned int i_chan) const override
142  {
143  return _chan_to_pin_map[i_chan];
144  }
145 
146  unsigned int getPinIndexFromPoint(const Point & p) const override;
147  unsigned int pinIndex(const Point & p) const override;
148 
149 protected:
151  unsigned int _n_rings;
153  unsigned int _n_channels;
162 
164  std::vector<std::vector<Node *>> _nodes;
166  std::vector<std::vector<Node *>> _pin_nodes;
167 
169  std::vector<std::pair<unsigned int, unsigned int>> _gap_to_chan_map;
171  std::vector<std::pair<unsigned int, unsigned int>> _gap_to_pin_map;
173  std::vector<std::vector<unsigned int>> _chan_to_gap_map;
174 
179  std::vector<std::vector<Real>> _sign_id_crossflow_map;
180 
182  std::vector<std::vector<Real>> _gij_map;
183 
185  std::vector<Point> _pin_position;
186 
188  std::vector<std::vector<Real>> _pins_in_rings;
189 
191  std::vector<std::vector<unsigned int>> _chan_to_pin_map;
192 
194  unsigned int _npins;
196  unsigned int _n_gaps;
197 
199  std::vector<EChannelType> _subch_type;
201  std::vector<EChannelType> _gap_type;
202 
204  std::vector<std::pair<unsigned int, unsigned int>> _gap_pairs_sf;
206  std::vector<std::pair<unsigned int, unsigned int>> _chan_pairs_sf;
207 
209  std::vector<std::vector<unsigned int>> _pin_to_chan_map;
210 
211 public:
212  static InputParameters validParams();
213 
220  static void
221  pinPositions(std::vector<Point> & positions, unsigned int nrings, Real pitch, Point center);
222 
226 
228  static const unsigned int N_CORNERS = 6;
229 };
std::vector< EChannelType > _subch_type
subchannel type
const Real & getWireDiameter() const
Return wire diameter.
Real getSubchannelWettedPerimeter(unsigned int i_chan) const override
Return undeformed wetted perimeter for a subchannel.
std::unique_ptr< MooseMesh > safeClone() const override
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.
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< 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
channel indices corresponding to a given pin index
const InputParameters & parameters() const
static void pinPositions(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 ...
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 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)
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 > > _chan_to_pin_map
stores the fuel pins belonging to each subchannel
Real _dwire
wire diameter
void computeAssemblyHydraulicParameters()
Compute undeformed bundle-average inlet hydraulic quantities from generated mesh geometry.
Real _hwire
wire lead length
static const unsigned int N_CORNERS
number of corners in the duct x-sec
Node * getChannelNode(unsigned int i_chan, unsigned int iz) const override
Get the subchannel mesh node for a given channel index and elevation index.
const std::pair< unsigned int, unsigned int > & getSweepFlowGaps(unsigned int i_chan) const
Real _duct_to_pin_gap
the gap thickness between the duct and peripheral fuel pins
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 unsigned int & getNumOfRings() const
Return the number of fuel-pin rings, counting the center pin as the first ring.
const Real & getDuctToPinGap() const
Return the the gap thickness between the duct and peripheral fuel pins.
void buildMesh() override
std::vector< std::pair< unsigned int, unsigned int > > _gap_to_pin_map
stores the fuel pins belonging to each gap
unsigned int _n_rings
number of fuel-pin rings, counting the center pin as the first ring
unsigned int getNumOfGapsPerLayer() const override
Return the number of gaps per layer.
unsigned int channelIndex(const Point &point) const override
static const std::string pitch
unsigned int getNumOfChannels() const override
Return the number of channels per layer.
Real _flat_to_flat
the distance between flat surfaces of the duct facing each other
const std::vector< unsigned int > & getChannelPins(unsigned int i_chan) const override
Return a vector of pin indices for a given channel index.
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
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
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...
const Real & getFlatToFlat() const
Return flat to flat [m].
const unsigned int & getPinIndex(const unsigned int channel_idx, const unsigned int neighbor_idx)
Return Pin index given subchannel index and local neighbor index.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
std::vector< std::vector< Node * > > _nodes
nodes
std::vector< EChannelType > _gap_type
gap type
const Real p
Real getGapWidth(unsigned int axial_index, unsigned int gap_index) const override
Return gap width for a given gap 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.
unsigned int pinIndex(const Point &p) const override
std::vector< std::vector< Node * > > _pin_nodes
pin nodes
Mesh generator that builds a mesh of 1D lines representing subchannels and pins in a triangular assem...
Base class for subchannel meshes.
const std::pair< unsigned int, unsigned int > & getSweepFlowChans(unsigned int i_chan) const
std::vector< Point > _pin_position
x,y coordinates of the fuel pins
Mesh generator that builds a 3D mesh representing triangular subchannels and pins.
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.
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...
EChannelType getSubchannelType(unsigned int index) const override
Return the type of the subchannel for given subchannel index.
std::vector< std::pair< unsigned int, unsigned int > > _gap_pairs_sf
sweeping flow model gap pairs per channel to specify directional edge flow
processor_id_type processor_id() const
unsigned int getNumOfPins() const override
Return the number of pins.
const Real & getWireLeadLength() const
Return the wire lead length.
unsigned int _n_channels
number of subchannels
static InputParameters validParams()
static const std::string center
Definition: NS.h:29
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
Mesh generator for hexagonal duct.