https://mooseframework.inl.gov
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
SCMQuadSubChannelMeshGenerator Class Reference

Class for Subchannel mesh generation in the square lattice geometry. More...

#include <SCMQuadSubChannelMeshGenerator.h>

Inheritance diagram for SCMQuadSubChannelMeshGenerator:
[legend]

Public Types

typedef DataFileName DataFileParameterType
 

Public Member Functions

 SCMQuadSubChannelMeshGenerator (const InputParameters &parameters)
 
std::unique_ptr< MeshBase > generate () override
 
std::unique_ptr< CSG::CSGBasegenerateInternalCSG ()
 
std::unique_ptr< MeshBase > generateInternal ()
 
const std::set< MeshGeneratorName > & getRequestedMeshGenerators () const
 
const std::set< MeshGeneratorName > & getRequestedMeshGeneratorsForSub () const
 
void addParentMeshGenerator (const MeshGenerator &mg, const AddParentChildKey)
 
void addChildMeshGenerator (const MeshGenerator &mg, const AddParentChildKey)
 
const std::set< const MeshGenerator *, Comparator > & getParentMeshGenerators () const
 
const std::set< const MeshGenerator *, Comparator > & getChildMeshGenerators () const
 
const std::set< const MeshGenerator *, Comparator > & getSubMeshGenerators () const
 
bool isParentMeshGenerator (const MeshGeneratorName &name, const bool direct=true) const
 
bool isChildMeshGenerator (const MeshGeneratorName &name, const bool direct=true) const
 
bool isNullMeshName (const MeshGeneratorName &name) const
 
bool hasSaveMesh () const
 
bool hasOutput () const
 
const std::string & getSavedMeshName () const
 
bool hasGenerateData () const
 
bool hasGenerateCSG () const
 
bool isDataOnly () const
 
virtual bool enabled () const
 
std::shared_ptr< MooseObjectgetSharedPtr ()
 
std::shared_ptr< const MooseObjectgetSharedPtr () const
 
bool isKokkosObject () const
 
MooseAppgetMooseApp () const
 
const std::string & type () const
 
const std::string & name () const
 
std::string typeAndName () const
 
MooseObjectParameterName uniqueParameterName (const std::string &parameter_name) const
 
MooseObjectName uniqueName () const
 
const InputParametersparameters () const
 
const hit::Node * getHitNode () const
 
bool hasBase () const
 
const std::string & getBase () const
 
const TgetParam (const std::string &name) const
 
std::vector< std::pair< T1, T2 > > getParam (const std::string &param1, const std::string &param2) const
 
const TqueryParam (const std::string &name) const
 
const TgetRenamedParam (const std::string &old_name, const std::string &new_name) const
 
T getCheckedPointerParam (const std::string &name, const std::string &error_string="") const
 
bool haveParameter (const std::string &name) const
 
bool isParamValid (const std::string &name) const
 
bool isParamSetByUser (const std::string &name) const
 
void connectControllableParams (const std::string &parameter, const std::string &object_type, const std::string &object_name, const std::string &object_parameter) const
 
void paramError (const std::string &param, Args... args) const
 
void paramWarning (const std::string &param, Args... args) const
 
void paramWarning (const std::string &param, Args... args) const
 
void paramInfo (const std::string &param, Args... args) const
 
std::string messagePrefix (const bool hit_prefix=true) const
 
std::string errorPrefix (const std::string &) const
 
void mooseError (Args &&... args) const
 
void mooseDocumentedError (const std::string &repo_name, const unsigned int issue_num, Args &&... args) const
 
void mooseErrorNonPrefixed (Args &&... args) const
 
void mooseWarning (Args &&... args) const
 
void mooseWarning (Args &&... args) const
 
void mooseWarningNonPrefixed (Args &&... args) const
 
void mooseWarningNonPrefixed (Args &&... args) const
 
void mooseDeprecated (Args &&... args) const
 
void mooseDeprecated (Args &&... args) const
 
void mooseDeprecatedNoTrace (Args &&... args) const
 
void mooseInfo (Args &&... args) const
 
void callMooseError (std::string msg, const bool with_prefix, const hit::Node *node=nullptr, const bool show_trace=true) const
 
std::string getDataFileName (const std::string &param) const
 
std::string getDataFileNameByName (const std::string &relative_path) const
 
std::string getDataFilePath (const std::string &relative_path) const
 
const Parallel::Communicator & comm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 

Static Public Member Functions

static InputParameters validParams ()
 
static bool hasGenerateData (const InputParameters &params)
 
static bool hasGenerateCSG (const InputParameters &params)
 
static void callMooseError (MooseApp *const app, const InputParameters &params, std::string msg, const bool with_prefix, const hit::Node *node, const bool show_trace=true)
 
static void setHasGenerateData (InputParameters &params)
 
static void setHasGenerateCSG (InputParameters &params)
 

Public Attributes

 usingCombinedWarningSolutionWarnings
 
const ConsoleStream _console
 

Static Public Attributes

static const std::string data_only_param
 
static const std::string type_param
 
static const std::string name_param
 
static const std::string unique_name_param
 
static const std::string app_param
 
static const std::string moose_base_param
 
static const std::string kokkos_object_param
 
static constexpr auto SYSTEM
 
static constexpr auto NAME
 

Protected Member Functions

virtual void generateData ()
 
virtual std::unique_ptr< CSG::CSGBasegenerateCSG ()
 
TcopyMeshProperty (const std::string &target_data_name, const std::string &source_data_name, const std::string &source_mesh)
 
TcopyMeshProperty (const std::string &source_data_name, const std::string &source_mesh)
 
std::unique_ptr< MeshBase > & getMesh (const std::string &param_name, const bool allow_invalid=false)
 
std::vector< std::unique_ptr< MeshBase > *> getMeshes (const std::string &param_name)
 
std::unique_ptr< MeshBase > & getMeshByName (const MeshGeneratorName &mesh_generator_name)
 
std::vector< std::unique_ptr< MeshBase > *> getMeshesByName (const std::vector< MeshGeneratorName > &mesh_generator_names)
 
std::unique_ptr< CSG::CSGBase > & getCSGBase (const std::string &param_name)
 
std::unique_ptr< CSG::CSGBase > & getCSGBaseByName (const MeshGeneratorName &mesh_generator_name)
 
std::vector< std::unique_ptr< CSG::CSGBase > *> getCSGBases (const std::string &param_name)
 
std::vector< std::unique_ptr< CSG::CSGBase > *> getCSGBasesByName (const std::vector< MeshGeneratorName > &mesh_generator_names)
 
void declareMeshForSub (const std::string &param_name)
 
void declareMeshesForSub (const std::string &param_name)
 
void declareMeshForSubByName (const MeshGeneratorName &mesh_generator_name)
 
void declareMeshesForSubByName (const std::vector< MeshGeneratorName > &mesh_generator_names)
 
std::unique_ptr< MeshBase > buildMeshBaseObject (unsigned int dim=libMesh::invalid_uint)
 
std::unique_ptr< ReplicatedMesh > buildReplicatedMesh (unsigned int dim=libMesh::invalid_uint)
 
std::unique_ptr< DistributedMesh > buildDistributedMesh (unsigned int dim=libMesh::invalid_uint)
 
void addMeshSubgenerator (const std::string &type, const std::string &name, Ts... extra_input_parameters)
 
void addMeshSubgenerator (const std::string &type, const std::string &name, InputParameters params)
 
void declareNullMeshName (const MeshGeneratorName &name)
 
void flagInvalidSolutionInternal (const InvalidSolutionID invalid_solution_id) const
 
InvalidSolutionID registerInvalidSolutionInternal (const std::string &message, const bool warning) const
 
const TgetMeshProperty (const std::string &data_name, const std::string &prefix)
 
const TgetMeshProperty (const std::string &data_name)
 
bool hasMeshProperty (const std::string &data_name, const std::string &prefix) const
 
bool hasMeshProperty (const std::string &data_name, const std::string &prefix) const
 
bool hasMeshProperty (const std::string &data_name) const
 
bool hasMeshProperty (const std::string &data_name) const
 
std::string meshPropertyName (const std::string &data_name) const
 
TdeclareMeshProperty (const std::string &data_name, Args &&... args)
 
TdeclareMeshProperty (const std::string &data_name, const T &data_value)
 
TdeclareMeshProperty (const std::string &data_name, Args &&... args)
 
TdeclareMeshProperty (const std::string &data_name, const T &data_value)
 
TsetMeshProperty (const std::string &data_name, Args &&... args)
 
TsetMeshProperty (const std::string &data_name, const T &data_value)
 
TsetMeshProperty (const std::string &data_name, Args &&... args)
 
TsetMeshProperty (const std::string &data_name, const T &data_value)
 

Static Protected Member Functions

static std::string meshPropertyName (const std::string &data_name, const std::string &prefix)
 

Protected Attributes

const Real _unheated_length_entry
 unheated length of the fuel Pin at the entry of the assembly More...
 
const Real _heated_length
 heated length of the fuel Pin More...
 
const Real _unheated_length_exit
 unheated length of the fuel Pin at the exit of the assembly More...
 
std::vector< Real_z_grid
 axial location of nodes More...
 
std::vector< std::vector< Real > > _k_grid
 axial form loss coefficient per computational cell More...
 
const std::vector< Real > & _spacer_z
 axial location of the spacers More...
 
const std::vector< Real > & _spacer_k
 form loss coefficient of the spacers More...
 
const std::vector< Real_z_blockage
 axial location of blockage (inlet, outlet) [m] More...
 
const std::vector< unsigned int_index_blockage
 index of subchannels affected by blockage More...
 
const std::vector< Real_reduction_blockage
 area reduction of subchannels affected by blockage More...
 
const std::vector< Real_k_blockage
 form loss coefficient of subchannels affected by blockage More...
 
const Real_kij
 Lateral form loss coefficient. More...
 
const Real _pitch
 Distance between the neighbor fuel pins, pitch. More...
 
const Real _pin_diameter
 fuel Pin diameter More...
 
const unsigned int _n_cells
 number of axial cells More...
 
unsigned int _n_blocks
 number of axial blocks More...
 
const unsigned int _nx
 Number of subchannels in the x direction. More...
 
const unsigned int _ny
 Number of subchannels in the y direction. More...
 
const unsigned int _n_channels
 Total number of subchannels. More...
 
const unsigned int _n_gaps
 Number of gaps per layer. More...
 
const unsigned int _n_pins
 Number of pins. More...
 
const Real _side_gap
 The side gap, not to be confused with the gap between pins, this refers to the gap next to the duct or else the distance between the subchannel centroid to the duct wall. More...
 
const unsigned int _block_id
 block index More...
 
std::vector< std::vector< Node * > > _nodes
 Channel nodes. More...
 
std::vector< std::vector< Node * > > _gapnodes
 gap nodes More...
 
std::vector< std::pair< unsigned int, unsigned int > > _gap_to_chan_map
 
std::vector< std::pair< unsigned int, unsigned int > > _gap_to_pin_map
 
std::vector< std::vector< unsigned int > > _chan_to_gap_map
 
std::vector< std::vector< unsigned int > > _chan_to_pin_map
 
std::vector< std::vector< unsigned int > > _pin_to_chan_map
 
std::vector< std::vector< double > > _sign_id_crossflow_map
 Matrix used to give local sign to crossflow quantities. More...
 
std::vector< std::vector< Real > > _gij_map
 Vector to store gap size. More...
 
std::vector< std::vector< Real > > _subchannel_position
 x,y coordinates of the subchannel centroid More...
 
std::vector< EChannelType_subch_type
 Subchannel type. More...
 
MooseMesh *const _mesh
 
const bool & _enabled
 
MooseApp_app
 
Factory_factory
 
ActionFactory_action_factory
 
const std::string & _type
 
const std::string & _name
 
const InputParameters_pars
 
const Parallel::Communicator & _communicator
 

Detailed Description

Class for Subchannel mesh generation in the square lattice geometry.

Definition at line 20 of file SCMQuadSubChannelMeshGenerator.h.

Constructor & Destructor Documentation

◆ SCMQuadSubChannelMeshGenerator()

SCMQuadSubChannelMeshGenerator::SCMQuadSubChannelMeshGenerator ( const InputParameters parameters)

Definition at line 59 of file SCMQuadSubChannelMeshGenerator.C.

60  : MeshGenerator(params),
61  _unheated_length_entry(getParam<Real>("unheated_length_entry")),
62  _heated_length(getParam<Real>("heated_length")),
63  _unheated_length_exit(getParam<Real>("unheated_length_exit")),
64  _spacer_z(getParam<std::vector<Real>>("spacer_z")),
65  _spacer_k(getParam<std::vector<Real>>("spacer_k")),
66  _z_blockage(getParam<std::vector<Real>>("z_blockage")),
67  _index_blockage(getParam<std::vector<unsigned int>>("index_blockage")),
68  _reduction_blockage(getParam<std::vector<Real>>("reduction_blockage")),
69  _k_blockage(getParam<std::vector<Real>>("k_blockage")),
70  _kij(getParam<Real>("Kij")),
71  _pitch(getParam<Real>("pitch")),
72  _pin_diameter(getParam<Real>("pin_diameter")),
73  _n_cells(getParam<unsigned int>("n_cells")),
74  _nx(getParam<unsigned int>("nx")),
75  _ny(getParam<unsigned int>("ny")),
76  _n_channels(_nx * _ny),
77  _n_gaps((_nx - 1) * _ny + (_ny - 1) * _nx),
78  _n_pins((_nx - 1) * (_ny - 1)),
79  _side_gap(getParam<Real>("side_gap")),
80  _block_id(getParam<unsigned int>("block_id"))
81 {
82  if (_spacer_z.size() != _spacer_k.size())
83  mooseError(name(), ": Size of vector spacer_z should be equal to size of vector spacer_k");
84 
85  if (_spacer_z.size() &&
87  mooseError(name(), ": Location of spacers should be less than the total bundle length");
88 
89  if (_z_blockage.size() != 2)
90  mooseError(name(), ": Size of vector z_blockage must be 2");
91 
92  if (*max_element(_index_blockage.begin(), _index_blockage.end()) > (_n_channels - 1))
93  mooseError(name(),
94  ": The index of the blocked subchannel cannot be more than the max index of the "
95  "subchannels");
96 
97  if (*max_element(_reduction_blockage.begin(), _reduction_blockage.end()) > 1)
98  mooseError(name(), ": The area reduction of the blocked subchannels cannot be more than 1");
99 
100  if ((_index_blockage.size() > _nx * _ny) || (_reduction_blockage.size() > _nx * _ny) ||
101  (_k_blockage.size() > _nx * _ny))
102  mooseError(name(),
103  ": Size of vectors: index_blockage, reduction_blockage, k_blockage, cannot be more "
104  "than the total number of subchannels");
105 
106  if ((_index_blockage.size() != _reduction_blockage.size()) ||
107  (_index_blockage.size() != _k_blockage.size()) ||
108  (_reduction_blockage.size() != _k_blockage.size()))
109  mooseError(name(),
110  ": Size of vectors: index_blockage, reduction_blockage, k_blockage, must be equal "
111  "to eachother");
112 
113  if (_nx < 2 && _ny < 2)
114  mooseError(name(),
115  ": The number of subchannels cannot be less than 2 in both directions (x and y). "
116  "Smallest assembly allowed is either 2X1 or 1X2. ");
117 
120 
121  // Defining the total length from 3 axial sections
123 
124  // Defining the position of the spacer grid in the numerical solution array
125  std::vector<int> spacer_cell;
126  for (const auto & elem : _spacer_z)
127  spacer_cell.emplace_back(std::round(elem * _n_cells / L));
128 
129  // Defining the arrays for axial resistances
130  std::vector<Real> kgrid;
131  kgrid.resize(_n_cells + 1, 0.0);
132  _k_grid.resize(_n_channels, std::vector<Real>(_n_cells + 1));
133 
134  // Summing the spacer resistance to the 1D grid resistance array
135  for (unsigned int index = 0; index < spacer_cell.size(); index++)
136  kgrid[spacer_cell[index]] += _spacer_k[index];
137 
138  // Creating the 2D grid resistance array
139  for (unsigned int i = 0; i < _n_channels; i++)
140  _k_grid[i] = kgrid;
141 
142  // Add blockage resistance to the 2D grid resistane array
143  Real dz = L / _n_cells;
144  for (unsigned int i = 0; i < _n_cells + 1; i++)
145  {
146  if ((dz * i >= _z_blockage.front() && dz * i <= _z_blockage.back()))
147  {
148  unsigned int index(0);
149  for (const auto & i_ch : _index_blockage)
150  {
151  _k_grid[i_ch][i] += _k_blockage[index];
152  index++;
153  }
154  }
155  }
156 
157  // Defining the size of the maps
158  _gap_to_chan_map.resize(_n_gaps);
159  _gap_to_pin_map.resize(_n_gaps);
160  _gapnodes.resize(_n_gaps);
163  _pin_to_chan_map.resize(_n_pins);
165  _gij_map.resize(_n_cells + 1);
167 
168  for (unsigned int i = 0; i < _n_channels; i++)
169  {
170  _subchannel_position[i].reserve(3);
171  for (unsigned int j = 0; j < 3; j++)
172  {
173  _subchannel_position.at(i).push_back(0.0);
174  }
175  }
176 
177  for (unsigned int iz = 0; iz < _n_cells + 1; iz++)
178  {
179  _gij_map[iz].reserve(_n_gaps);
180  }
181 
182  // Defining the signs for positive and negative flows
183  Real positive_flow = 1.0;
184  Real negative_flow = -1.0;
185 
186  // Defining the subchannel types
187  _subch_type.resize(_n_channels);
188  for (unsigned int iy = 0; iy < _ny; iy++)
189  {
190  for (unsigned int ix = 0; ix < _nx; ix++)
191  {
192  unsigned int i_ch = _nx * iy + ix;
193  bool is_corner = (ix == 0 && iy == 0) || (ix == _nx - 1 && iy == 0) ||
194  (ix == 0 && iy == _ny - 1) || (ix == _nx - 1 && iy == _ny - 1);
195  bool is_edge = (ix == 0 || iy == 0 || ix == _nx - 1 || iy == _ny - 1);
196 
197  if (_n_channels == 2)
198  {
200  }
201  else if (_n_channels == 4)
202  {
204  }
205  else
206  {
207  if (is_corner)
209  else if (is_edge)
211  else
213  }
214  }
215  }
216 
217  // Index the east-west gaps.
218  unsigned int i_gap = 0;
219  for (unsigned int iy = 0; iy < _ny; iy++)
220  {
221  for (unsigned int ix = 0; ix < _nx - 1; ix++)
222  {
223  unsigned int i_ch = _nx * iy + ix;
224  unsigned int j_ch = _nx * iy + (ix + 1);
225  _gap_to_chan_map[i_gap] = {i_ch, j_ch};
226  _chan_to_gap_map[i_ch].push_back(i_gap);
227  _chan_to_gap_map[j_ch].push_back(i_gap);
228  _sign_id_crossflow_map[i_ch].push_back(positive_flow);
229  _sign_id_crossflow_map[j_ch].push_back(negative_flow);
230 
231  // make a gap size map
232  if (iy == 0 || iy == _ny - 1)
233  _gij_map[0].push_back((_pitch - _pin_diameter) / 2 + _side_gap);
234  else
235  _gij_map[0].push_back(_pitch - _pin_diameter);
236  ++i_gap;
237  }
238  }
239 
240  // Index the north-south gaps.
241  for (unsigned int iy = 0; iy < _ny - 1; iy++)
242  {
243  for (unsigned int ix = 0; ix < _nx; ix++)
244  {
245  unsigned int i_ch = _nx * iy + ix;
246  unsigned int j_ch = _nx * (iy + 1) + ix;
247  _gap_to_chan_map[i_gap] = {i_ch, j_ch};
248  _chan_to_gap_map[i_ch].push_back(i_gap);
249  _chan_to_gap_map[j_ch].push_back(i_gap);
250  _sign_id_crossflow_map[i_ch].push_back(positive_flow);
251  _sign_id_crossflow_map[j_ch].push_back(negative_flow);
252 
253  // make a gap size map
254  if (ix == 0 || ix == _nx - 1)
255  _gij_map[0].push_back((_pitch - _pin_diameter) / 2 + _side_gap);
256  else
257  _gij_map[0].push_back(_pitch - _pin_diameter);
258  ++i_gap;
259  }
260  }
261 
262  for (unsigned int iz = 1; iz < _n_cells + 1; iz++)
263  {
264  _gij_map[iz] = _gij_map[0];
265  }
266 
267  // Make pin to channel map
268  for (unsigned int iy = 0; iy < _ny - 1; iy++)
269  {
270  for (unsigned int ix = 0; ix < _nx - 1; ix++)
271  {
272  unsigned int i_pin = (_nx - 1) * iy + ix;
273  unsigned int i_chan_1 = _nx * iy + ix;
274  unsigned int i_chan_2 = _nx * (iy + 1) + ix;
275  unsigned int i_chan_3 = _nx * (iy + 1) + (ix + 1);
276  unsigned int i_chan_4 = _nx * iy + (ix + 1);
277  _pin_to_chan_map[i_pin].push_back(i_chan_1);
278  _pin_to_chan_map[i_pin].push_back(i_chan_2);
279  _pin_to_chan_map[i_pin].push_back(i_chan_3);
280  _pin_to_chan_map[i_pin].push_back(i_chan_4);
281  }
282  }
283 
284  // Make channel to pin map
285  for (unsigned int iy = 0; iy < _ny; iy++) // row
286  {
287  for (unsigned int ix = 0; ix < _nx; ix++) // column
288  {
289  unsigned int i_ch = _nx * iy + ix;
290  // Corners contact 1/4 of one pin
291  if (iy == 0 && ix == 0)
292  {
293  _chan_to_pin_map[i_ch].push_back((_nx - 1) * iy + ix);
294  }
295  else if (iy == _ny - 1 && ix == 0)
296  {
297  _chan_to_pin_map[i_ch].push_back((_nx - 1) * (iy - 1) + ix);
298  }
299  else if (iy == 0 && ix == _nx - 1)
300  {
301  _chan_to_pin_map[i_ch].push_back((_nx - 1) * iy + ix - 1);
302  }
303  else if (iy == _ny - 1 && ix == _nx - 1)
304  {
305  _chan_to_pin_map[i_ch].push_back((_nx - 1) * (iy - 1) + ix - 1);
306  }
307  // Sides contact 1/4 of two pins
308  else if (iy == 0)
309  {
310  _chan_to_pin_map[i_ch].push_back((_nx - 1) * iy + ix);
311  _chan_to_pin_map[i_ch].push_back((_nx - 1) * iy + ix - 1);
312  }
313  else if (iy == _ny - 1)
314  {
315  _chan_to_pin_map[i_ch].push_back((_nx - 1) * (iy - 1) + ix);
316  _chan_to_pin_map[i_ch].push_back((_nx - 1) * (iy - 1) + ix - 1);
317  }
318  else if (ix == 0)
319  {
320  _chan_to_pin_map[i_ch].push_back((_nx - 1) * iy + ix);
321  _chan_to_pin_map[i_ch].push_back((_nx - 1) * (iy - 1) + ix);
322  }
323  else if (ix == _nx - 1)
324  {
325  _chan_to_pin_map[i_ch].push_back((_nx - 1) * iy + ix - 1);
326  _chan_to_pin_map[i_ch].push_back((_nx - 1) * (iy - 1) + ix - 1);
327  }
328  // interior contacts 1/4 of 4 pins
329  else
330  {
331  _chan_to_pin_map[i_ch].push_back((_nx - 1) * iy + ix);
332  _chan_to_pin_map[i_ch].push_back((_nx - 1) * iy + ix - 1);
333  _chan_to_pin_map[i_ch].push_back((_nx - 1) * (iy - 1) + ix);
334  _chan_to_pin_map[i_ch].push_back((_nx - 1) * (iy - 1) + ix - 1);
335  }
336 
337  // set the subchannel positions
338  Real offset_x = (_nx - 1) * _pitch / 2.0;
339  Real offset_y = (_ny - 1) * _pitch / 2.0;
340  _subchannel_position[i_ch][0] = _pitch * ix - offset_x;
341  _subchannel_position[i_ch][1] = _pitch * iy - offset_y;
342  }
343  }
344 
345  // Make gap to pin map
346  for (unsigned int i_gap = 0; i_gap < _n_gaps; i_gap++)
347  {
348  auto i_ch = _gap_to_chan_map[i_gap].first;
349  auto j_ch = _gap_to_chan_map[i_gap].second;
350  auto i_pins = _chan_to_pin_map[i_ch];
351  auto j_pins = _chan_to_pin_map[j_ch];
352  _gap_to_pin_map[i_gap] = {10000, 10000}; // Initialize with default values
353 
354  for (unsigned int i : i_pins)
355  {
356  for (unsigned int j : j_pins)
357  {
358  if (i == j)
359  {
360  if (_gap_to_pin_map[i_gap].first == 10000)
361  {
362  _gap_to_pin_map[i_gap].first = i;
363  _gap_to_pin_map[i_gap].second = i;
364  }
365  else
366  {
367  _gap_to_pin_map[i_gap].second = i;
368  }
369  }
370  }
371  }
372  }
373 
374  // Reduce reserved memory in the channel-to-gap map.
375  for (auto & gap : _chan_to_gap_map)
376  gap.shrink_to_fit();
377 
378  // Reduce reserved memory in the channel-to-pin map.
379  for (auto & pin : _chan_to_pin_map)
380  pin.shrink_to_fit();
381 
382  // Reduce reserved memory in the pin-to-channel map.
383  for (auto & pin : _pin_to_chan_map)
384  pin.shrink_to_fit();
385 }
const unsigned int _n_gaps
Number of gaps per layer.
const T & getParam(const std::string &name) const
const std::vector< Real > & _spacer_k
form loss coefficient of the spacers
const Real _pitch
Distance between the neighbor fuel pins, pitch.
std::vector< std::pair< unsigned int, unsigned int > > _gap_to_chan_map
const std::vector< unsigned int > _index_blockage
index of subchannels affected by blockage
const std::vector< Real > _z_blockage
axial location of blockage (inlet, outlet) [m]
const 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::vector< unsigned int > > _chan_to_pin_map
MeshGenerator(const InputParameters &parameters)
const unsigned int _n_cells
number of axial cells
const unsigned int _ny
Number of subchannels in the y direction.
std::vector< std::vector< Real > > _subchannel_position
x,y coordinates of the subchannel centroid
const unsigned int _n_channels
Total number of subchannels.
const Real _unheated_length_entry
unheated length of the fuel Pin at the entry of the assembly
const std::vector< Real > _k_blockage
form loss coefficient of subchannels affected by blockage
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::string & name() const
const unsigned int _nx
Number of subchannels in the x direction.
const std::vector< Real > _reduction_blockage
area reduction of subchannels affected by blockage
std::vector< EChannelType > _subch_type
Subchannel type.
std::vector< std::vector< Real > > _gij_map
Vector to store gap size.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
std::vector< std::vector< Node * > > _gapnodes
gap nodes
const Real _pin_diameter
fuel Pin diameter
std::vector< std::vector< unsigned int > > _chan_to_gap_map
const Real _unheated_length_exit
unheated length of the fuel Pin at the exit of the assembly
const std::vector< Real > & _spacer_z
axial location of the spacers
void mooseError(Args &&... args) const
std::vector< std::vector< unsigned int > > _pin_to_chan_map
std::vector< std::vector< double > > _sign_id_crossflow_map
Matrix used to give local sign to crossflow quantities.
const unsigned int _block_id
block index
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
const Real & _kij
Lateral form loss coefficient.
std::vector< std::vector< Real > > _k_grid
axial form loss coefficient per computational cell
std::vector< std::pair< unsigned int, unsigned int > > _gap_to_pin_map
const Real _heated_length
heated length of the fuel Pin
std::vector< Real > _z_grid
axial location of nodes
const unsigned int _n_pins
Number of pins.

Member Function Documentation

◆ generate()

std::unique_ptr< MeshBase > SCMQuadSubChannelMeshGenerator::generate ( )
overridevirtual

Implements MeshGenerator.

Definition at line 388 of file SCMQuadSubChannelMeshGenerator.C.

389 {
390  auto mesh_base = buildMeshBaseObject();
391  BoundaryInfo & boundary_info = mesh_base->get_boundary_info();
392  mesh_base->set_spatial_dimension(3);
393  mesh_base->reserve_elem(_n_cells * _ny * _nx);
394  mesh_base->reserve_nodes((_n_cells + 1) * _ny * _nx);
395  _nodes.resize(_nx * _ny);
396  // Add the points in the shape of a rectilinear grid. The grid is regular
397  // on the xy-plane with a spacing of `pitch` between points. The grid along
398  // z is irregular to account for Pin spacers. Store pointers in the _nodes
399  // array so we can keep track of which points are in which channels.
400  Real offset_x = (_nx - 1) * _pitch / 2.0;
401  Real offset_y = (_ny - 1) * _pitch / 2.0;
402  unsigned int node_id = 0;
403  for (unsigned int iy = 0; iy < _ny; iy++)
404  {
405  for (unsigned int ix = 0; ix < _nx; ix++)
406  {
407  int i_ch = _nx * iy + ix;
408  _nodes[i_ch].reserve(_n_cells);
409  for (unsigned int iz = 0; iz < _n_cells + 1; iz++)
410  {
411  _nodes[i_ch].push_back(mesh_base->add_point(
412  Point(_pitch * ix - offset_x, _pitch * iy - offset_y, _z_grid[iz]), node_id++));
413  }
414  }
415  }
416 
417  // Add the elements which in this case are 2-node edges that link each
418  // subchannel's nodes vertically.
419  unsigned int elem_id = 0;
420  for (unsigned int iy = 0; iy < _ny; iy++)
421  {
422  for (unsigned int ix = 0; ix < _nx; ix++)
423  {
424  for (unsigned int iz = 0; iz < _n_cells; iz++)
425  {
426  Elem * elem = new Edge2;
427  elem->subdomain_id() = _block_id;
428  elem->set_id(elem_id++);
429  elem = mesh_base->add_elem(elem);
430  const int indx1 = ((_n_cells + 1) * _nx) * iy + (_n_cells + 1) * ix + iz;
431  const int indx2 = ((_n_cells + 1) * _nx) * iy + (_n_cells + 1) * ix + (iz + 1);
432  elem->set_node(0, mesh_base->node_ptr(indx1));
433  elem->set_node(1, mesh_base->node_ptr(indx2));
434 
435  if (iz == 0)
436  boundary_info.add_side(elem, 0, 0);
437  if (iz == _n_cells - 1)
438  boundary_info.add_side(elem, 1, 1);
439  }
440  }
441  }
442 
443  boundary_info.sideset_name(0) = "inlet";
444  boundary_info.sideset_name(1) = "outlet";
445  boundary_info.nodeset_name(0) = "inlet";
446  boundary_info.nodeset_name(1) = "outlet";
447  mesh_base->subdomain_name(_block_id) = name();
448  mesh_base->prepare_for_use();
449 
450  // move the meta data into QuadSubChannelMesh
451  auto & sch_mesh = static_cast<QuadSubChannelMesh &>(*_mesh);
453  sch_mesh._heated_length = _heated_length;
454  sch_mesh._unheated_length_exit = _unheated_length_exit;
455  sch_mesh._z_grid = _z_grid;
456  sch_mesh._k_grid = _k_grid;
457  sch_mesh._spacer_z = _spacer_z;
458  sch_mesh._spacer_k = _spacer_k;
459  sch_mesh._z_blockage = _z_blockage;
460  sch_mesh._index_blockage = _index_blockage;
461  sch_mesh._reduction_blockage = _reduction_blockage;
462  sch_mesh._kij = _kij;
463  sch_mesh._pitch = _pitch;
464  sch_mesh._pin_diameter = _pin_diameter;
465  sch_mesh._n_cells = _n_cells;
466  sch_mesh._nx = _nx;
467  sch_mesh._ny = _ny;
468  sch_mesh._n_channels = _n_channels;
469  sch_mesh._n_gaps = _n_gaps;
470  sch_mesh._n_pins = _n_pins;
471  sch_mesh._side_gap = _side_gap;
472  sch_mesh._nodes = _nodes;
473  sch_mesh._gapnodes = _gapnodes;
474  sch_mesh._gap_to_chan_map = _gap_to_chan_map;
475  sch_mesh._gap_to_pin_map = _gap_to_pin_map;
476  sch_mesh._chan_to_gap_map = _chan_to_gap_map;
477  sch_mesh._chan_to_pin_map = _chan_to_pin_map;
478  sch_mesh._pin_to_chan_map = _pin_to_chan_map;
479  sch_mesh._sign_id_crossflow_map = _sign_id_crossflow_map;
480  sch_mesh._gij_map = _gij_map;
481  sch_mesh._subchannel_position = _subchannel_position;
482  sch_mesh._subch_type = _subch_type;
483  sch_mesh.computeAssemblyHydraulicParameters();
484 
485  return mesh_base;
486 }
const unsigned int _n_gaps
Number of gaps per layer.
const std::vector< Real > & _spacer_k
form loss coefficient of the spacers
const Real _pitch
Distance between the neighbor fuel pins, pitch.
std::vector< std::pair< unsigned int, unsigned int > > _gap_to_chan_map
const std::vector< unsigned int > _index_blockage
index of subchannels affected by blockage
const std::vector< Real > _z_blockage
axial location of blockage (inlet, outlet) [m]
Real _unheated_length_entry
unheated length of the fuel Pin at the entry of the assembly
const 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::vector< unsigned int > > _chan_to_pin_map
Creates the mesh of subchannels in a quadrilateral lattice.
const unsigned int _n_cells
number of axial cells
const unsigned int _ny
Number of subchannels in the y direction.
std::vector< std::vector< Real > > _subchannel_position
x,y coordinates of the subchannel centroid
const unsigned int _n_channels
Total number of subchannels.
const Real _unheated_length_entry
unheated length of the fuel Pin at the entry of the assembly
const std::string & name() const
std::vector< std::vector< Node * > > _nodes
Channel nodes.
const unsigned int _nx
Number of subchannels in the x direction.
const std::vector< Real > _reduction_blockage
area reduction of subchannels affected by blockage
std::vector< EChannelType > _subch_type
Subchannel type.
std::vector< std::vector< Real > > _gij_map
Vector to store gap size.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
std::vector< std::vector< Node * > > _gapnodes
gap nodes
const Real _pin_diameter
fuel Pin diameter
std::vector< std::vector< unsigned int > > _chan_to_gap_map
const Real _unheated_length_exit
unheated length of the fuel Pin at the exit of the assembly
const std::vector< Real > & _spacer_z
axial location of the spacers
std::vector< std::vector< unsigned int > > _pin_to_chan_map
std::vector< std::vector< double > > _sign_id_crossflow_map
Matrix used to give local sign to crossflow quantities.
const unsigned int _block_id
block index
const Real & _kij
Lateral form loss coefficient.
std::vector< std::vector< Real > > _k_grid
axial form loss coefficient per computational cell
std::unique_ptr< MeshBase > buildMeshBaseObject(unsigned int dim=libMesh::invalid_uint)
std::vector< std::pair< unsigned int, unsigned int > > _gap_to_pin_map
const Real _heated_length
heated length of the fuel Pin
std::vector< Real > _z_grid
axial location of nodes
const unsigned int _n_pins
Number of pins.

◆ validParams()

InputParameters SCMQuadSubChannelMeshGenerator::validParams ( )
static

Definition at line 18 of file SCMQuadSubChannelMeshGenerator.C.

19 {
21  params.addClassDescription("Creates a mesh of 1D subchannels in a square lattice arrangement");
22  params.addRequiredParam<Real>("pitch", "Pitch [m]");
23  params.addRequiredParam<Real>("pin_diameter", "Rod diameter [m]");
24  params.addParam<Real>("unheated_length_entry", 0.0, "Unheated length at entry [m]");
25  params.addRequiredParam<Real>("heated_length", "Heated length [m]");
26  params.addParam<Real>("unheated_length_exit", 0.0, "Unheated length at exit [m]");
27  params.addParam<std::vector<Real>>(
28  "spacer_z", {}, "Axial location of spacers/vanes/mixing_vanes [m]");
29  params.addParam<std::vector<Real>>(
30  "spacer_k", {}, "K-loss coefficient of spacers/vanes/mixing_vanes [-]");
31  params.addParam<std::vector<Real>>("z_blockage",
32  std::vector<Real>({0.0, 0.0}),
33  "axial location of blockage (inlet, outlet) [m]");
34  params.addParam<std::vector<unsigned int>>("index_blockage",
35  std::vector<unsigned int>({0}),
36  "index of subchannels affected by blockage");
37  params.addParam<std::vector<Real>>(
38  "reduction_blockage",
39  std::vector<Real>({1.0}),
40  "Area reduction of subchannels affected by blockage (number to muliply the area)");
41  params.addParam<std::vector<Real>>("k_blockage",
42  std::vector<Real>({0.0}),
43  "Form loss coefficient of subchannels affected by blockage");
44 
45  params.addParam<Real>("Kij", 0.5, "Lateral form loss coefficient [-]");
46  params.addRequiredParam<unsigned int>("n_cells", "The number of cells in the axial direction");
47  params.addRequiredParam<unsigned int>("nx", "Number of channels in the x direction [-]");
48  params.addRequiredParam<unsigned int>("ny", "Number of channels in the y direction [-]");
49  params.addRequiredParam<Real>(
50  "gap",
51  "The side gap, not to be confused with the gap between pins, this refers to the gap "
52  "next to the duct or else the distance between the subchannel centroid to the duct wall."
53  "distance(edge pin center, duct wall) = pitch / 2 + side_gap [m]");
54  params.deprecateParam("gap", "side_gap", "08/06/2026");
55  params.addParam<unsigned int>("block_id", 0, "Domain Index");
56  return params;
57 }
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addRequiredParam(const std::string &name, const std::string &doc_string)
static InputParameters validParams()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void addClassDescription(const std::string &doc_string)

Member Data Documentation

◆ _block_id

const unsigned int SCMQuadSubChannelMeshGenerator::_block_id
protected

block index

Definition at line 76 of file SCMQuadSubChannelMeshGenerator.h.

Referenced by generate().

◆ _chan_to_gap_map

std::vector<std::vector<unsigned int> > SCMQuadSubChannelMeshGenerator::_chan_to_gap_map
protected

Definition at line 83 of file SCMQuadSubChannelMeshGenerator.h.

Referenced by generate(), and SCMQuadSubChannelMeshGenerator().

◆ _chan_to_pin_map

std::vector<std::vector<unsigned int> > SCMQuadSubChannelMeshGenerator::_chan_to_pin_map
protected

Definition at line 84 of file SCMQuadSubChannelMeshGenerator.h.

Referenced by generate(), and SCMQuadSubChannelMeshGenerator().

◆ _gap_to_chan_map

std::vector<std::pair<unsigned int, unsigned int> > SCMQuadSubChannelMeshGenerator::_gap_to_chan_map
protected

Definition at line 81 of file SCMQuadSubChannelMeshGenerator.h.

Referenced by generate(), and SCMQuadSubChannelMeshGenerator().

◆ _gap_to_pin_map

std::vector<std::pair<unsigned int, unsigned int> > SCMQuadSubChannelMeshGenerator::_gap_to_pin_map
protected

Definition at line 82 of file SCMQuadSubChannelMeshGenerator.h.

Referenced by generate(), and SCMQuadSubChannelMeshGenerator().

◆ _gapnodes

std::vector<std::vector<Node *> > SCMQuadSubChannelMeshGenerator::_gapnodes
protected

gap nodes

Definition at line 80 of file SCMQuadSubChannelMeshGenerator.h.

Referenced by generate(), and SCMQuadSubChannelMeshGenerator().

◆ _gij_map

std::vector<std::vector<Real> > SCMQuadSubChannelMeshGenerator::_gij_map
protected

Vector to store gap size.

Definition at line 89 of file SCMQuadSubChannelMeshGenerator.h.

Referenced by generate(), and SCMQuadSubChannelMeshGenerator().

◆ _heated_length

const Real SCMQuadSubChannelMeshGenerator::_heated_length
protected

heated length of the fuel Pin

Definition at line 30 of file SCMQuadSubChannelMeshGenerator.h.

Referenced by generate(), and SCMQuadSubChannelMeshGenerator().

◆ _index_blockage

const std::vector<unsigned int> SCMQuadSubChannelMeshGenerator::_index_blockage
protected

index of subchannels affected by blockage

Definition at line 44 of file SCMQuadSubChannelMeshGenerator.h.

Referenced by generate(), and SCMQuadSubChannelMeshGenerator().

◆ _k_blockage

const std::vector<Real> SCMQuadSubChannelMeshGenerator::_k_blockage
protected

form loss coefficient of subchannels affected by blockage

Definition at line 48 of file SCMQuadSubChannelMeshGenerator.h.

Referenced by SCMQuadSubChannelMeshGenerator().

◆ _k_grid

std::vector<std::vector<Real> > SCMQuadSubChannelMeshGenerator::_k_grid
protected

axial form loss coefficient per computational cell

Definition at line 36 of file SCMQuadSubChannelMeshGenerator.h.

Referenced by generate(), and SCMQuadSubChannelMeshGenerator().

◆ _kij

const Real& SCMQuadSubChannelMeshGenerator::_kij
protected

Lateral form loss coefficient.

Definition at line 50 of file SCMQuadSubChannelMeshGenerator.h.

Referenced by generate().

◆ _n_blocks

unsigned int SCMQuadSubChannelMeshGenerator::_n_blocks
protected

number of axial blocks

Definition at line 58 of file SCMQuadSubChannelMeshGenerator.h.

◆ _n_cells

const unsigned int SCMQuadSubChannelMeshGenerator::_n_cells
protected

number of axial cells

Definition at line 56 of file SCMQuadSubChannelMeshGenerator.h.

Referenced by generate(), and SCMQuadSubChannelMeshGenerator().

◆ _n_channels

const unsigned int SCMQuadSubChannelMeshGenerator::_n_channels
protected

Total number of subchannels.

Definition at line 64 of file SCMQuadSubChannelMeshGenerator.h.

Referenced by generate(), and SCMQuadSubChannelMeshGenerator().

◆ _n_gaps

const unsigned int SCMQuadSubChannelMeshGenerator::_n_gaps
protected

Number of gaps per layer.

Definition at line 66 of file SCMQuadSubChannelMeshGenerator.h.

Referenced by generate(), and SCMQuadSubChannelMeshGenerator().

◆ _n_pins

const unsigned int SCMQuadSubChannelMeshGenerator::_n_pins
protected

Number of pins.

Definition at line 68 of file SCMQuadSubChannelMeshGenerator.h.

Referenced by generate(), and SCMQuadSubChannelMeshGenerator().

◆ _nodes

std::vector<std::vector<Node *> > SCMQuadSubChannelMeshGenerator::_nodes
protected

Channel nodes.

Definition at line 78 of file SCMQuadSubChannelMeshGenerator.h.

Referenced by generate().

◆ _nx

const unsigned int SCMQuadSubChannelMeshGenerator::_nx
protected

Number of subchannels in the x direction.

Definition at line 60 of file SCMQuadSubChannelMeshGenerator.h.

Referenced by generate(), and SCMQuadSubChannelMeshGenerator().

◆ _ny

const unsigned int SCMQuadSubChannelMeshGenerator::_ny
protected

Number of subchannels in the y direction.

Definition at line 62 of file SCMQuadSubChannelMeshGenerator.h.

Referenced by generate(), and SCMQuadSubChannelMeshGenerator().

◆ _pin_diameter

const Real SCMQuadSubChannelMeshGenerator::_pin_diameter
protected

fuel Pin diameter

Definition at line 54 of file SCMQuadSubChannelMeshGenerator.h.

Referenced by generate(), and SCMQuadSubChannelMeshGenerator().

◆ _pin_to_chan_map

std::vector<std::vector<unsigned int> > SCMQuadSubChannelMeshGenerator::_pin_to_chan_map
protected

Definition at line 85 of file SCMQuadSubChannelMeshGenerator.h.

Referenced by generate(), and SCMQuadSubChannelMeshGenerator().

◆ _pitch

const Real SCMQuadSubChannelMeshGenerator::_pitch
protected

Distance between the neighbor fuel pins, pitch.

Definition at line 52 of file SCMQuadSubChannelMeshGenerator.h.

Referenced by generate(), and SCMQuadSubChannelMeshGenerator().

◆ _reduction_blockage

const std::vector<Real> SCMQuadSubChannelMeshGenerator::_reduction_blockage
protected

area reduction of subchannels affected by blockage

Definition at line 46 of file SCMQuadSubChannelMeshGenerator.h.

Referenced by generate(), and SCMQuadSubChannelMeshGenerator().

◆ _side_gap

const Real SCMQuadSubChannelMeshGenerator::_side_gap
protected

The side gap, not to be confused with the gap between pins, this refers to the gap next to the duct or else the distance between the subchannel centroid to the duct wall.

distance(edge pin center, duct wall) = pitch / 2 + side_gap [m].

Definition at line 74 of file SCMQuadSubChannelMeshGenerator.h.

Referenced by generate(), and SCMQuadSubChannelMeshGenerator().

◆ _sign_id_crossflow_map

std::vector<std::vector<double> > SCMQuadSubChannelMeshGenerator::_sign_id_crossflow_map
protected

Matrix used to give local sign to crossflow quantities.

Definition at line 87 of file SCMQuadSubChannelMeshGenerator.h.

Referenced by generate(), and SCMQuadSubChannelMeshGenerator().

◆ _spacer_k

const std::vector<Real>& SCMQuadSubChannelMeshGenerator::_spacer_k
protected

form loss coefficient of the spacers

Definition at line 40 of file SCMQuadSubChannelMeshGenerator.h.

Referenced by generate(), and SCMQuadSubChannelMeshGenerator().

◆ _spacer_z

const std::vector<Real>& SCMQuadSubChannelMeshGenerator::_spacer_z
protected

axial location of the spacers

Definition at line 38 of file SCMQuadSubChannelMeshGenerator.h.

Referenced by generate(), and SCMQuadSubChannelMeshGenerator().

◆ _subch_type

std::vector<EChannelType> SCMQuadSubChannelMeshGenerator::_subch_type
protected

Subchannel type.

Definition at line 93 of file SCMQuadSubChannelMeshGenerator.h.

Referenced by generate(), and SCMQuadSubChannelMeshGenerator().

◆ _subchannel_position

std::vector<std::vector<Real> > SCMQuadSubChannelMeshGenerator::_subchannel_position
protected

x,y coordinates of the subchannel centroid

Definition at line 91 of file SCMQuadSubChannelMeshGenerator.h.

Referenced by generate(), and SCMQuadSubChannelMeshGenerator().

◆ _unheated_length_entry

const Real SCMQuadSubChannelMeshGenerator::_unheated_length_entry
protected

unheated length of the fuel Pin at the entry of the assembly

Definition at line 28 of file SCMQuadSubChannelMeshGenerator.h.

Referenced by generate(), and SCMQuadSubChannelMeshGenerator().

◆ _unheated_length_exit

const Real SCMQuadSubChannelMeshGenerator::_unheated_length_exit
protected

unheated length of the fuel Pin at the exit of the assembly

Definition at line 32 of file SCMQuadSubChannelMeshGenerator.h.

Referenced by generate(), and SCMQuadSubChannelMeshGenerator().

◆ _z_blockage

const std::vector<Real> SCMQuadSubChannelMeshGenerator::_z_blockage
protected

axial location of blockage (inlet, outlet) [m]

Definition at line 42 of file SCMQuadSubChannelMeshGenerator.h.

Referenced by generate(), and SCMQuadSubChannelMeshGenerator().

◆ _z_grid

std::vector<Real> SCMQuadSubChannelMeshGenerator::_z_grid
protected

axial location of nodes

Definition at line 34 of file SCMQuadSubChannelMeshGenerator.h.

Referenced by generate(), and SCMQuadSubChannelMeshGenerator().


The documentation for this class was generated from the following files: