13 #include "libmesh/edge_edge2.h" 14 #include "libmesh/unstructured_mesh.h" 18 TriSubChannelMeshGenerator,
27 "Creates a mesh of 1D subchannels in a triangular lattice arrangement");
28 params.
addRequiredParam<
unsigned int>(
"n_cells",
"The number of cells in the axial direction");
31 params.
addParam<
Real>(
"unheated_length_entry", 0.0,
"Unheated length at entry [m]");
33 params.
addParam<
Real>(
"unheated_length_exit", 0.0,
"Unheated length at exit [m]");
34 params.
addRequiredParam<
unsigned int>(
"nrings",
"Number of fuel Pin rings per assembly [-]");
36 "Flat to flat distance for the hexagonal assembly [m]");
39 params.
addParam<std::vector<Real>>(
"spacer_z",
40 "Axial location of spacers/vanes/mixing_vanes [m]");
41 params.
addParam<std::vector<Real>>(
"spacer_k",
42 "K-loss coefficient of spacers/vanes/mixing_vanes [-]");
43 params.
addParam<
Real>(
"Kij", 0.5,
"Lateral form loss coefficient [-]");
44 params.
addParam<std::vector<Real>>(
"z_blockage",
45 std::vector<Real>({0.0, 0.0}),
46 "axial location of blockage (inlet, outlet) [m]");
47 params.
addParam<std::vector<unsigned int>>(
"index_blockage",
48 std::vector<unsigned int>({0}),
49 "index of subchannels affected by blockage");
52 std::vector<Real>({1.0}),
53 "Area reduction of subchannels affected by blockage (number to muliply the area)");
54 params.
addParam<std::vector<Real>>(
"k_blockage",
55 std::vector<Real>({0.0}),
56 "Form loss coefficient of subchannels affected by blockage");
57 params.
addParam<
unsigned int>(
"block_id", 0,
"Domain Index");
63 _unheated_length_entry(getParam<
Real>(
"unheated_length_entry")),
64 _heated_length(getParam<
Real>(
"heated_length")),
65 _unheated_length_exit(getParam<
Real>(
"unheated_length_exit")),
66 _block_id(getParam<unsigned
int>(
"block_id")),
67 _spacer_z(getParam<
std::vector<
Real>>(
"spacer_z")),
68 _spacer_k(getParam<
std::vector<
Real>>(
"spacer_k")),
69 _z_blockage(getParam<
std::vector<
Real>>(
"z_blockage")),
70 _index_blockage(getParam<
std::vector<unsigned
int>>(
"index_blockage")),
71 _reduction_blockage(getParam<
std::vector<
Real>>(
"reduction_blockage")),
72 _k_blockage(getParam<
std::vector<
Real>>(
"k_blockage")),
73 _pitch(getParam<
Real>(
"pitch")),
74 _kij(getParam<
Real>(
"Kij")),
75 _pin_diameter(getParam<
Real>(
"pin_diameter")),
76 _n_cells(getParam<unsigned
int>(
"n_cells")),
77 _n_rings(getParam<unsigned
int>(
"nrings")),
78 _flat_to_flat(getParam<
Real>(
"flat_to_flat")),
79 _dwire(getParam<
Real>(
"dwire")),
80 _hwire(getParam<
Real>(
"hwire")),
81 _duct_to_pin_gap(0.5 *
82 (_flat_to_flat - (_n_rings - 1) * _pitch *
std::
sqrt(3.0) - _pin_diameter))
85 mooseError(
name(),
": Size of vector spacer_z should be equal to size of vector spacer_k");
88 mooseError(
name(),
": Location of spacers should be less than the total bundle length");
94 mooseError(
name(),
": The area reduction of the blocked subchannels cannot be more than 1");
100 ": Size of vectors: index_blockage, reduction_blockage, k_blockage, must be equal " 110 std::vector<int> spacer_cell;
112 spacer_cell.emplace_back(std::round(elem *
_n_cells / L));
115 std::vector<Real> kgrid;
119 for (
unsigned int index = 0; index < spacer_cell.size(); index++)
120 kgrid[spacer_cell[index]] +=
_spacer_k[index];
138 Real avg_coor_x = 0.0;
140 Real avg_coor_y = 0.0;
146 unsigned int kgap = 0;
148 unsigned int icorner = 0;
150 const Real positive_flow = 1.0;
152 const Real negative_flow = -1.0;
154 std::vector<std::pair<unsigned int, unsigned int>> gap_fill;
161 for (
unsigned int i = 1; i <
_n_rings; i++)
162 for (
unsigned int j = 0;
j < i * 6;
j++)
166 unsigned int chancount = 0.0;
175 ": The index of the blocked subchannel cannot be more than the max index of the " 181 ": Size of vectors: index_blockage, reduction_blockage, k_blockage, cannot be more " 182 "than the total number of subchannels");
191 for (
unsigned int i = 0; i <
_n_cells + 1; i++)
195 unsigned int index(0);
225 for (
unsigned int j = 0;
j < 3;
j++)
232 for (
unsigned int iz = 0; iz <
_n_cells + 1; iz++)
237 for (
unsigned int i = 0; i <
_npins; i++)
245 for (
unsigned int i = 1; i <
_n_rings; i++)
385 for (
unsigned int loc_rod = 0; loc_rod <
_npins; loc_rod++)
389 bool rod_in_sc =
false;
498 gap_fill[
j].first = 1;
503 gap_fill[
j].second = 1;
517 gap_fill[
j].first = 1;
522 gap_fill[
j].second = 1;
587 for (
unsigned int iz = 0; iz <
_n_cells + 1; iz++)
589 for (
unsigned int i_gap = 0; i_gap <
_n_gaps; i_gap++)
606 for (
unsigned int k = 0;
k < 3;
k++)
637 for (
unsigned int k = 0;
k < 2;
k++)
718 a2 = std::sqrt((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0)) + a1;
730 a2 = std::sqrt((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0)) + a1;
755 std::unique_ptr<MeshBase>
760 BoundaryInfo & boundary_info = mesh_base->get_boundary_info();
761 mesh_base->set_spatial_dimension(3);
769 unsigned int node_id = 0;
773 for (
unsigned int iz = 0; iz <
_n_cells + 1; iz++)
775 _nodes[i].push_back(mesh_base->add_point(
782 unsigned int elem_id = 0;
785 for (
unsigned int iz = 0; iz <
_n_cells; iz++)
787 Elem * elem =
new Edge2;
788 elem->set_id(elem_id++);
789 elem = mesh_base->add_elem(elem);
790 const int indx1 = (
_n_cells + 1) * i + iz;
791 const int indx2 = (
_n_cells + 1) * i + (iz + 1);
792 elem->set_node(0, mesh_base->node_ptr(indx1));
793 elem->set_node(1, mesh_base->node_ptr(indx2));
796 boundary_info.add_side(elem, 0, 0);
798 boundary_info.add_side(elem, 1, 1);
801 boundary_info.sideset_name(0) =
"inlet";
802 boundary_info.sideset_name(1) =
"outlet";
803 boundary_info.nodeset_name(0) =
"inlet";
804 boundary_info.nodeset_name(1) =
"outlet";
809 mesh_base->prepare_for_use();
823 sch_mesh._kij =
_kij;
unsigned int _npins
number of fuel pins
std::vector< EChannelType > _gap_type
gap type
std::vector< std::vector< Real > > _pins_in_rings
fuel pins that are belonging to each ring
std::vector< std::pair< unsigned int, unsigned int > > _chan_pairs_sf
sweeping flow model channel pairs to specify directional edge flow
std::vector< std::pair< unsigned int, unsigned int > > _gap_to_chan_map
stores the channel pairs for each gap
std::vector< EChannelType > _subch_type
subchannel type
std::vector< std::pair< unsigned int, unsigned int > > _gap_pairs_sf
sweeping flow model gap pairs per channel to specify directional edge flow
const Real _hwire
wire lead length
const unsigned int _n_cells
number of axial cells
std::vector< Real > _z_grid
axial location of nodes
Real _unheated_length_entry
unheated length of the fuel Pin at the entry of the assembly
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 std::vector< Real > & _spacer_z
axial location of the spacers
const unsigned int _block_id
block index
virtual const std::string & name() const
const Real _flat_to_flat
the distance between flat surfaces of the duct facing each other
unsigned int _n_channels
number of subchannels
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...
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 Real _pitch
Distance between the neighbor fuel pins, pitch.
const unsigned int _n_rings
number of rings of fuel pins
const std::vector< Real > _k_blockage
form loss coefficient of subchannels affected by blockage
registerMooseObjectRenamed("SubChannelApp", TriSubChannelMeshGenerator, "06/30/2025 24:00", SCMTriSubChannelMeshGenerator)
std::vector< std::vector< Real > > _subchannel_position
x,y coordinates of the subchannel centroids
Mesh class for triangular, edge and corner subchannels for hexagonal lattice fuel assemblies...
unsigned int _n_gaps
number of gaps
std::vector< Point > _pin_position
x,y coordinates of the fuel pins
std::vector< std::vector< Real > > _gij_map
gap size
const Real _pin_diameter
fuel Pin diameter
static InputParameters validParams()
registerMooseObject("SubChannelApp", SCMTriSubChannelMeshGenerator)
const Real _heated_length
heated length of the fuel Pin
Mesh class for triangular, edge and corner subchannels for hexagonal lattice fuel assemblies...
std::vector< std::vector< unsigned int > > _chan_to_pin_map
stores the fuel pins belonging to each subchannel
const std::vector< Real > _reduction_blockage
area reduction of subchannels affected by blockage
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 ...
const Real _unheated_length_entry
unheated length of the fuel Pin at the entry of the assembly
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
std::unique_ptr< MeshBase > generate() override
static InputParameters validParams()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
std::vector< std::vector< Real > > _k_grid
axial form loss coefficient per computational cell
CTSub CT_OPERATOR_BINARY CTMul CTCompareLess CTCompareGreater CTCompareEqual _arg template * sqrt(_arg)) *_arg.template D< dtag >()) CT_SIMPLE_UNARY_FUNCTION(tanh
std::vector< std::pair< unsigned int, unsigned int > > _gap_to_pin_map
stores the fuel pin pairs for each gap each gap
SCMTriSubChannelMeshGenerator(const InputParameters ¶meters)
void mooseError(Args &&... args) const
const Real _duct_to_pin_gap
the gap thickness between the duct and peripheral fuel pins
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
const Real _dwire
wire diameter
const Real & _kij
Lateral form loss coefficient.
std::vector< std::vector< unsigned int > > _pin_to_chan_map
stores the map from pins to channels
std::unique_ptr< MeshBase > buildMeshBaseObject(unsigned int dim=libMesh::invalid_uint)
const std::vector< Real > & _spacer_k
form loss coefficient of the spacers
std::vector< std::vector< Node * > > _nodes
nodes
const Real _unheated_length_exit
unheated length of the fuel Pin at the exit of the assembly
std::vector< std::vector< unsigned int > > _chan_to_gap_map
stores the gaps that forms each subchannel
static const std::string k
void ErrorVector unsigned int