Skip to content

Commit 1363e1b

Browse files
authored
Merge pull request #32289 from kyriv1980/quadDuct
Create square duct mesh #31406
2 parents 0214521 + 6818049 commit 1363e1b

21 files changed

Lines changed: 675 additions & 277 deletions
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# SCMQuadDuctMeshGenerator
2+
3+
!syntax description /Mesh/SCMQuadDuctMeshGenerator
4+
5+
## Overview
6+
7+
!! Intentional comment to provide extra spacing
8+
9+
This mesh generator creates the mesh (with Quad4 elements) where the variables associated with the duct live.
10+
11+
The subdomain name used for the duct will match the name of this mesh generator.
12+
13+
!syntax parameters /Mesh/SCMQuadDuctMeshGenerator
14+
15+
!syntax inputs /Mesh/SCMQuadDuctMeshGenerator
16+
17+
!syntax children /Mesh/SCMQuadDuctMeshGenerator

modules/subchannel/doc/content/source/meshgenerators/SCMTriDuctMeshGenerator.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66

77
!! Intentional comment to provide extra spacing
88

9-
This mesh generator creates the mesh were the variables associated with the duct live.
9+
This mesh generator creates the mesh (with Quad4 elements) where the variables associated with the duct live.
10+
11+
The subdomain name used for the duct will match the name of this mesh generator.
1012

1113
## Example Input File Syntax
1214

modules/subchannel/include/mesh/QuadSubChannelMesh.h

Lines changed: 32 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
#include "SubChannelMesh.h"
1313
#include "SubChannelEnums.h"
1414

15+
#include <map>
16+
#include <vector>
17+
#include <memory> // for unique_ptr
18+
#include <utility> // for std::pair
19+
1520
/**
1621
* Creates the mesh of subchannels in a quadrilateral lattice.
1722
*/
@@ -20,90 +25,70 @@ class QuadSubChannelMesh : public SubChannelMesh
2025
public:
2126
QuadSubChannelMesh(const InputParameters & parameters);
2227
QuadSubChannelMesh(const QuadSubChannelMesh & other_mesh);
23-
virtual std::unique_ptr<MooseMesh> safeClone() const override;
24-
virtual void buildMesh() override;
2528

26-
virtual Node * getChannelNode(unsigned int i_chan, unsigned iz) const override
29+
std::unique_ptr<MooseMesh> safeClone() const override;
30+
void buildMesh() override;
31+
32+
Node * getChannelNode(unsigned int i_chan, unsigned int iz) const override
2733
{
2834
return _nodes[i_chan][iz];
2935
}
3036

31-
virtual Node * getPinNode(unsigned int i_pin, unsigned iz) const override
37+
Node * getPinNode(unsigned int i_pin, unsigned int iz) const override
3238
{
3339
return _pin_nodes[i_pin][iz];
3440
}
3541

36-
/**
37-
* Duct functions not applicable to quad channel
38-
*
39-
* Over-writing to avoid abstract template definition in this class
40-
*/
41-
///@{
42-
virtual Node * getDuctNodeFromChannel(Node *) override { return nullptr; }
43-
virtual Node * getChannelNodeFromDuct(Node *) override { return nullptr; }
44-
virtual const std::vector<Node *> getDuctNodes() const override { return std::vector<Node *>(); }
45-
///@}
42+
unsigned int getNumOfChannels() const override { return processor_id() == 0 ? _n_channels : 0; }
43+
unsigned int getNumOfGapsPerLayer() const override { return processor_id() == 0 ? _n_gaps : 0; }
44+
unsigned int getNumOfPins() const override { return processor_id() == 0 ? _n_pins : 0; }
4645

47-
virtual unsigned int getNumOfChannels() const override
48-
{
49-
return processor_id() == 0 ? _n_channels : 0;
50-
}
51-
virtual unsigned int getNumOfGapsPerLayer() const override
52-
{
53-
return processor_id() == 0 ? _n_gaps : 0;
54-
}
55-
virtual unsigned int getNumOfPins() const override { return processor_id() == 0 ? _n_pins : 0; }
56-
virtual bool pinMeshExist() const override { return _pin_mesh_exist; }
57-
virtual bool ductMeshExist() const override { return false; }
58-
virtual const std::pair<unsigned int, unsigned int> &
59-
getGapChannels(unsigned int i_gap) const override
46+
const std::pair<unsigned int, unsigned int> & getGapChannels(unsigned int i_gap) const override
6047
{
6148
return _gap_to_chan_map[i_gap];
6249
}
63-
virtual const std::pair<unsigned int, unsigned int> &
64-
getGapPins(unsigned int i_gap) const override
50+
const std::pair<unsigned int, unsigned int> & getGapPins(unsigned int i_gap) const override
6551
{
6652
return _gap_to_pin_map[i_gap];
6753
}
68-
virtual const std::vector<unsigned int> & getChannelGaps(unsigned int i_chan) const override
54+
const std::vector<unsigned int> & getChannelGaps(unsigned int i_chan) const override
6955
{
7056
return _chan_to_gap_map[i_chan];
7157
}
72-
virtual const std::vector<unsigned int> & getPinChannels(unsigned int i_pin) const override
58+
const std::vector<unsigned int> & getPinChannels(unsigned int i_pin) const override
7359
{
7460
return _pin_to_chan_map[i_pin];
7561
}
76-
virtual const std::vector<unsigned int> & getChannelPins(unsigned int i_chan) const override
62+
const std::vector<unsigned int> & getChannelPins(unsigned int i_chan) const override
7763
{
7864
return _chan_to_pin_map[i_chan];
7965
}
80-
virtual const Real & getPitch() const override { return _pitch; }
81-
virtual const Real & getCrossflowSign(unsigned int i_chan, unsigned int i_local) const override
66+
const Real & getPitch() const override { return _pitch; }
67+
const Real & getCrossflowSign(unsigned int i_chan, unsigned int i_local) const override
8268
{
8369
return _sign_id_crossflow_map[i_chan][i_local];
8470
}
71+
8572
/// Number of subchannels in the -x direction
86-
virtual const unsigned int & getNx() const { return _nx; }
73+
const unsigned int & getNx() const { return _nx; }
8774
/// Number of subchannels in the -y direction
88-
virtual const unsigned int & getNy() const { return _ny; }
75+
const unsigned int & getNy() const { return _ny; }
76+
8977
/**
9078
* Returns the side gap, not to be confused with the gap between pins, this refers to the gap
9179
* next to the duct. Edge Pitch W = (pitch/2 - pin_diameter/2 + gap) [m]
9280
*/
9381
const Real & getSideGap() const { return _side_gap; }
9482

9583
unsigned int getSubchannelIndexFromPoint(const Point & p) const override;
96-
virtual unsigned int channelIndex(const Point & point) const override;
84+
unsigned int channelIndex(const Point & point) const override;
9785

9886
unsigned int getPinIndexFromPoint(const Point & p) const override;
99-
virtual unsigned int pinIndex(const Point & p) const override;
87+
unsigned int pinIndex(const Point & p) const override;
10088

101-
virtual EChannelType getSubchannelType(unsigned int index) const override
102-
{
103-
return _subch_type[index];
104-
}
89+
EChannelType getSubchannelType(unsigned int index) const override { return _subch_type[index]; }
10590

106-
virtual Real getGapWidth(unsigned int axial_index, unsigned int gap_index) const override
91+
Real getGapWidth(unsigned int axial_index, unsigned int gap_index) const override
10792
{
10893
return _gij_map[axial_index][gap_index];
10994
}
@@ -119,18 +104,21 @@ class QuadSubChannelMesh : public SubChannelMesh
119104
unsigned int _n_gaps;
120105
/// Number of pins
121106
unsigned int _n_pins;
107+
122108
/**
123109
* The side gap, not to be confused with the gap between pins, this refers to the gap
124110
* next to the duct or else the distance between the subchannel centroid to the duct wall.
125111
* Edge Pitch W = (pitch/2 - pin_diameter/2 + gap) [m]
126112
*/
127113
Real _side_gap;
114+
128115
/// vector of subchannel nodes
129116
std::vector<std::vector<Node *>> _nodes;
130117
/// vector of fuel pin nodes
131118
std::vector<std::vector<Node *>> _pin_nodes;
132119
/// vector of gap (interface between pairs of neighboring subchannels) nodes
133120
std::vector<std::vector<Node *>> _gapnodes;
121+
134122
/// map relating gap index to subchannel index
135123
std::vector<std::pair<unsigned int, unsigned int>> _gap_to_chan_map;
136124
/// map relating gap index to fuel pin index
@@ -141,14 +129,13 @@ class QuadSubChannelMesh : public SubChannelMesh
141129
std::vector<std::vector<unsigned int>> _chan_to_pin_map;
142130
/// map relating fuel pin index to subchannel index
143131
std::vector<std::vector<unsigned int>> _pin_to_chan_map;
132+
144133
/// Matrix used to give local sign to crossflow quantities
145134
std::vector<std::vector<double>> _sign_id_crossflow_map;
146135
/// Vector to store gap size
147136
std::vector<std::vector<Real>> _gij_map;
148137
/// Subchannel type
149138
std::vector<EChannelType> _subch_type;
150-
/// Flag that informs the solver whether there is a Pin Mesh or not
151-
bool _pin_mesh_exist;
152139

153140
public:
154141
static InputParameters validParams();

modules/subchannel/include/mesh/SubChannelMesh.h

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
#pragma once
1111

1212
#include <vector>
13+
#include <utility> // std::pair
14+
#include <map>
15+
1316
#include "MooseMesh.h"
1417
#include "SubChannelEnums.h"
1518

@@ -65,22 +68,22 @@ class SubChannelMesh : public MooseMesh
6568
/**
6669
* Get the subchannel mesh node for a given channel index and elevation index
6770
*/
68-
virtual Node * getChannelNode(unsigned int i_chan, unsigned iz) const = 0;
71+
virtual Node * getChannelNode(unsigned int i_chan, unsigned int iz) const = 0;
6972

7073
/**
7174
* Get the pin mesh node for a given pin index and elevation index
7275
*/
73-
virtual Node * getPinNode(unsigned int i_pin, unsigned iz) const = 0;
76+
virtual Node * getPinNode(unsigned int i_pin, unsigned int iz) const = 0;
7477

7578
/**
7679
* Function that gets the channel node from the duct node
7780
*/
78-
virtual Node * getChannelNodeFromDuct(Node * channel_node) = 0;
81+
Node * getChannelNodeFromDuct(Node * duct_node) const;
7982

8083
/**
8184
* Function that gets the duct node from the channel node
8285
*/
83-
virtual Node * getDuctNodeFromChannel(Node * channel_node) = 0;
86+
Node * getDuctNodeFromChannel(Node * channel_node) const;
8487

8588
/**
8689
* Return the number of channels per layer
@@ -90,12 +93,12 @@ class SubChannelMesh : public MooseMesh
9093
/**
9194
* Return if Pin Mesh exists or not
9295
*/
93-
virtual bool pinMeshExist() const = 0;
96+
bool pinMeshExist() const { return _pin_mesh_exist; }
9497

9598
/**
9699
* Return if Duct Mesh exists or not
97100
*/
98-
virtual bool ductMeshExist() const = 0;
101+
bool ductMeshExist() const { return _duct_mesh_exist; }
99102

100103
/**
101104
* Return the number of gaps per layer
@@ -188,9 +191,18 @@ class SubChannelMesh : public MooseMesh
188191
virtual Real getGapWidth(unsigned int axial_index, unsigned int gap_index) const = 0;
189192

190193
/**
191-
* Function that return the vector with the maps to the nodes if they exist
194+
* Function that returns the vector with the duct nodes
195+
*
196+
*/
197+
const std::vector<Node *> & getDuctNodes() const { return _duct_nodes; }
198+
199+
/**
200+
* Function that sets the channel-to-duct maps
192201
*/
193-
virtual const std::vector<Node *> getDuctNodes() const = 0;
202+
void setChannelToDuctMaps(const std::vector<Node *> & duct_nodes);
203+
204+
bool _pin_mesh_exist = false;
205+
bool _duct_mesh_exist = false;
194206

195207
protected:
196208
/// unheated length of the fuel Pin at the entry of the assembly
@@ -199,32 +211,46 @@ class SubChannelMesh : public MooseMesh
199211
Real _heated_length;
200212
/// unheated length of the fuel Pin at the exit of the assembly
201213
Real _unheated_length_exit;
214+
202215
/// axial location of nodes
203216
std::vector<Real> _z_grid;
204217
/// axial form loss coefficient per computational cell
205218
std::vector<std::vector<Real>> _k_grid;
219+
220+
/// A list of all mesh nodes that form the (elements of) the duct
221+
/// mesh that surrounds the pins/subchannels.
222+
std::vector<Node *> _duct_nodes;
223+
224+
/// Maps between channel nodes and duct nodes
225+
std::map<Node *, Node *> _chan_to_duct_node_map;
226+
std::map<Node *, Node *> _duct_node_to_chan_map;
227+
206228
/// axial location of the spacers
207229
std::vector<Real> _spacer_z;
208230
/// form loss coefficient of the spacers
209231
std::vector<Real> _spacer_k;
232+
210233
/// axial location of blockage (inlet, outlet) [m]
211234
std::vector<Real> _z_blockage;
212235
/// index of subchannels affected by blockage
213236
std::vector<unsigned int> _index_blockage;
214237
/// area reduction of subchannels affected by blockage
215238
std::vector<Real> _reduction_blockage;
239+
216240
/// Lateral form loss coefficient
217241
Real _kij;
218242
/// Distance between the neighbor fuel pins, pitch
219243
Real _pitch;
220244
/// fuel Pin diameter
221245
Real _pin_diameter;
246+
222247
/// number of axial cells
223248
unsigned int _n_cells;
224249

225250
public:
226251
/// x,y coordinates of the subchannel centroids
227252
std::vector<std::vector<Real>> _subchannel_position;
253+
228254
static InputParameters validParams();
229255

230256
/**

0 commit comments

Comments
 (0)