https://mooseframework.inl.gov
SubChannelMesh.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 <vector>
13 #include <utility> // std::pair
14 #include <map>
15 
16 #include "MooseMesh.h"
17 #include "SubChannelEnums.h"
18 
22 class SubChannelMesh : public MooseMesh
23 {
24 public:
26  SubChannelMesh(const SubChannelMesh & other_mesh);
27 
31  virtual const std::vector<Real> & getZGrid() const { return _z_grid; }
32 
36  virtual unsigned int getZIndex(const Point & point) const;
37 
41  virtual const std::vector<std::vector<Real>> & getKGrid() const { return _k_grid; }
42 
46  virtual const std::vector<Real> & getZBlockage() const { return _z_blockage; }
47 
51  virtual const std::vector<unsigned int> & getIndexBlockage() const { return _index_blockage; }
52 
56  virtual const std::vector<Real> & getReductionBlockage() const { return _reduction_blockage; }
57 
61  virtual const Real & getKij() const { return _kij; }
62 
66  virtual unsigned int getNumOfAxialCells() const { return processor_id() == 0 ? _n_cells : 0; }
67 
71  virtual Node * getChannelNode(unsigned int i_chan, unsigned int iz) const = 0;
72 
76  virtual Node * getPinNode(unsigned int i_pin, unsigned int iz) const = 0;
77 
81  Node * getChannelNodeFromDuct(Node * duct_node) const;
82 
86  Node * getDuctNodeFromChannel(Node * channel_node) const;
87 
91  virtual unsigned int getNumOfChannels() const = 0;
92 
96  bool pinMeshExist() const { return _pin_mesh_exist; }
97 
101  bool ductMeshExist() const { return _duct_mesh_exist; }
102 
106  virtual unsigned int getNumOfGapsPerLayer() const = 0;
107 
111  virtual unsigned int getNumOfPins() const = 0;
112 
116  virtual const std::pair<unsigned int, unsigned int> &
117  getGapChannels(unsigned int i_gap) const = 0;
118 
122  virtual const std::pair<unsigned int, unsigned int> & getGapPins(unsigned int i_gap) const = 0;
123 
127  virtual const std::vector<unsigned int> & getChannelGaps(unsigned int i_chan) const = 0;
128 
132  virtual const std::vector<unsigned int> & getPinChannels(unsigned int i_pin) const = 0;
133 
137  virtual const std::vector<unsigned int> & getChannelPins(unsigned int i_chan) const = 0;
138 
142  virtual const Real & getPitch() const { return _pitch; }
143 
147  virtual const Real & getPinDiameter() const { return _pin_diameter; }
148 
153 
158 
163 
168  virtual Real getSubchannelFlowArea(unsigned int i_chan, Real z) const = 0;
169 
173  virtual Real getSubchannelWettedPerimeter(unsigned int i_chan) const = 0;
174 
178  virtual const Real & getCrossflowSign(unsigned int i_chan, unsigned int i_local) const = 0;
179 
183  virtual const Real & getHeatedLengthEntry() const { return _unheated_length_entry; }
184 
188  virtual const Real & getHeatedLength() const { return _heated_length; }
189 
193  virtual const Real & getHeatedLengthExit() const { return _unheated_length_exit; }
194 
198  virtual unsigned int getSubchannelIndexFromPoint(const Point & p) const = 0;
199 
200  virtual unsigned int channelIndex(const Point & point) const = 0;
201 
205  virtual unsigned int getPinIndexFromPoint(const Point & p) const = 0;
206 
207  virtual unsigned int pinIndex(const Point & p) const = 0;
208 
212  virtual EChannelType getSubchannelType(unsigned int index) const = 0;
213 
217  virtual Real getGapWidth(unsigned int axial_index, unsigned int gap_index) const = 0;
218 
223  const std::vector<Node *> & getDuctNodes() const { return _duct_nodes; }
224 
228  void setChannelToDuctMaps(const std::vector<Node *> & duct_nodes);
229 
230  bool _pin_mesh_exist = false;
231  bool _duct_mesh_exist = false;
232 
233 protected:
240 
242  std::vector<Real> _z_grid;
244  std::vector<std::vector<Real>> _k_grid;
245 
248  std::vector<Node *> _duct_nodes;
249 
251  std::map<Node *, Node *> _chan_to_duct_node_map;
252  std::map<Node *, Node *> _duct_node_to_chan_map;
253 
255  std::vector<Real> _spacer_z;
257  std::vector<Real> _spacer_k;
258 
260  std::vector<Real> _z_blockage;
262  std::vector<unsigned int> _index_blockage;
264  std::vector<Real> _reduction_blockage;
265 
278 
280  unsigned int _n_cells;
281 
282 public:
284  std::vector<std::vector<Real>> _subchannel_position;
285 
286  static InputParameters validParams();
287 
291  static void generateZGrid(Real unheated_length_entry,
292  Real heated_length,
293  Real unheated_length_exit,
294  unsigned int n_cells,
295  std::vector<Real> & z_grid);
296 
298 };
virtual unsigned int getSubchannelIndexFromPoint(const Point &p) const =0
Return a subchannel index for a given physical point p
static InputParameters validParams()
virtual unsigned int pinIndex(const Point &p) const =0
virtual unsigned int getNumOfGapsPerLayer() const =0
Return the number of gaps per layer.
virtual const std::pair< unsigned int, unsigned int > & getGapPins(unsigned int i_gap) const =0
Return a pair of pin indices for a given gap index.
virtual const Real & getPinDiameter() const
Return undeformed Pin diameter.
std::vector< Real > _z_grid
axial location of nodes
virtual const std::vector< unsigned int > & getPinChannels(unsigned int i_pin) const =0
Return a vector of channel indices for a given Pin index.
Real getAssemblyWettedPerimeter() const
Return undeformed bundle inlet wetted perimeter.
Node * getDuctNodeFromChannel(Node *channel_node) const
Function that gets the duct node from the channel node.
virtual const std::vector< unsigned int > & getChannelPins(unsigned int i_chan) const =0
Return a vector of pin indices for a given channel index.
virtual const std::vector< Real > & getZGrid() const
Get axial location of layers.
virtual const Real & getPitch() const
Return the undeformed pitch between 2 subchannels.
virtual EChannelType getSubchannelType(unsigned int index) const =0
Return the type of the subchannel for given subchannel index.
const InputParameters & parameters() const
virtual const Real & getKij() const
Return lateral loss coefficient.
std::vector< std::vector< Real > > _k_grid
axial form loss coefficient per computational cell
virtual Node * getPinNode(unsigned int i_pin, unsigned int iz) const =0
Get the pin mesh node for a given pin index and elevation index.
std::map< Node *, Node * > _duct_node_to_chan_map
Real _unheated_length_entry
unheated length of the fuel Pin at the entry of the assembly
virtual unsigned int getNumOfPins() const =0
Return the number of pins.
Real getAssemblyHydraulicDiameter() const
Return undeformed bundle-average hydraulic diameter.
std::vector< std::vector< Real > > _subchannel_position
x,y coordinates of the subchannel centroids
virtual const std::vector< unsigned int > & getChannelGaps(unsigned int i_chan) const =0
Return a vector of gap indices for a given channel index.
std::vector< Node * > _duct_nodes
A list of all mesh nodes that form the (elements of) the duct mesh that surrounds the pins/subchannel...
static void generateZGrid(Real unheated_length_entry, Real heated_length, Real unheated_length_exit, unsigned int n_cells, std::vector< Real > &z_grid)
Generate the spacing in z-direction using heated and unteaded lengths.
const std::vector< Node * > & getDuctNodes() const
Function that returns the vector with the duct nodes.
virtual const Real & getHeatedLength() const
Return heated length.
std::vector< Real > _spacer_k
form loss coefficient of the spacers
virtual unsigned int getNumOfChannels() const =0
Return the number of channels per layer.
Node * getChannelNodeFromDuct(Node *duct_node) const
Function that gets the channel node from the duct node.
Real _assembly_wetted_perimeter
Undeformed bundle inlet wetted perimeter.
Real _unheated_length_exit
unheated length of the fuel Pin at the exit of the assembly
std::vector< Real > _z_blockage
axial location of blockage (inlet, outlet) [m]
Real _pin_diameter
fuel Pin diameter
virtual const std::vector< std::vector< Real > > & getKGrid() const
Get axial cell location and value of loss coefficient.
virtual Node * getChannelNode(unsigned int i_chan, unsigned int iz) const =0
Get the subchannel mesh node for a given channel index and elevation index.
bool pinMeshExist() const
Return if Pin Mesh exists or not.
std::vector< Real > _reduction_blockage
area reduction of subchannels affected by blockage
Real getAssemblyFlowArea() const
Return undeformed bundle inlet flow area.
virtual const std::vector< Real > & getReductionBlockage() const
Get area reduction of blocked subchannels.
EChannelType
Enum for describing the center, edge and corner subchannels or gap types.
bool ductMeshExist() const
Return if Duct Mesh exists or not.
Real _pitch
Distance between the neighbor fuel pins, pitch.
virtual unsigned int getNumOfAxialCells() const
Return the number of axial cells.
std::vector< Real > _spacer_z
axial location of the spacers
Real _assembly_flow_area
Undeformed bundle inlet flow area.
virtual Real getGapWidth(unsigned int axial_index, unsigned int gap_index) const =0
Return gap width for a given gap index.
virtual unsigned int channelIndex(const Point &point) const =0
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual const std::vector< Real > & getZBlockage() const
Get axial location of blockage (in,out) [m].
std::map< Node *, Node * > _chan_to_duct_node_map
Maps between channel nodes and duct nodes.
virtual const Real & getCrossflowSign(unsigned int i_chan, unsigned int i_local) const =0
Return a sign for the crossflow given a subchannel index and local neighbor index.
const Real p
void setChannelToDuctMaps(const std::vector< Node *> &duct_nodes)
Function that sets the channel-to-duct maps.
Mesh generator that builds a mesh of 1D lines representing subchannels and pins in a quadrilateral as...
virtual Real getSubchannelFlowArea(unsigned int i_chan, Real z) const =0
Return undeformed flow area for a subchannel at an axial location, including any blockage reduction...
virtual const std::vector< unsigned int > & getIndexBlockage() const
Get index of blocked subchannels.
Base class for subchannel meshes.
virtual const Real & getHeatedLengthExit() const
Return unheated length at exit.
Real _kij
Lateral form loss coefficient.
unsigned int _n_cells
number of axial cells
processor_id_type processor_id() const
virtual unsigned int getPinIndexFromPoint(const Point &p) const =0
Return a pin index for a given physical point p
virtual Real getSubchannelWettedPerimeter(unsigned int i_chan) const =0
Return undeformed wetted perimeter for a subchannel.
virtual unsigned int getZIndex(const Point &point) const
Get axial index of point.
Real _heated_length
heated length of the fuel Pin
SubChannelMesh(const InputParameters &parameters)
Real _assembly_hydraulic_diameter
Undeformed bundle-average hydraulic diameter.
virtual const Real & getHeatedLengthEntry() const
Return unheated length at entry.
std::vector< unsigned int > _index_blockage
index of subchannels affected by blockage
virtual const std::pair< unsigned int, unsigned int > & getGapChannels(unsigned int i_gap) const =0
Return a pair of subchannel indices for a given gap index.