13 #include "libmesh/edge_edge2.h" 14 #include "libmesh/unstructured_mesh.h" 23 "Creates a mesh of 1D subchannels in a triangular lattice arrangement");
24 params.
addRequiredParam<
unsigned int>(
"n_cells",
"The number of cells in the axial direction");
27 params.
addParam<
Real>(
"unheated_length_entry", 0.0,
"Unheated length at entry [m]");
29 params.
addParam<
Real>(
"unheated_length_exit", 0.0,
"Unheated length at exit [m]");
30 params.
addRequiredParam<
unsigned int>(
"nrings",
"Number of fuel Pin rings per assembly [-]");
32 "Flat to flat distance for the hexagonal assembly [m]");
36 "spacer_z", {},
"Axial location of spacers/vanes/mixing_vanes [m]");
38 "spacer_k", {},
"K-loss coefficient of spacers/vanes/mixing_vanes [-]");
39 params.
addParam<
Real>(
"Kij", 0.5,
"Lateral form loss coefficient [-]");
40 params.
addParam<std::vector<Real>>(
"z_blockage",
41 std::vector<Real>({0.0, 0.0}),
42 "axial location of blockage (inlet, outlet) [m]");
43 params.
addParam<std::vector<unsigned int>>(
"index_blockage",
44 std::vector<unsigned int>({0}),
45 "index of subchannels affected by blockage");
48 std::vector<Real>({1.0}),
49 "Area reduction of subchannels affected by blockage (number to muliply the area)");
50 params.
addParam<std::vector<Real>>(
"k_blockage",
51 std::vector<Real>({0.0}),
52 "Form loss coefficient of subchannels affected by blockage");
53 params.
addParam<
unsigned int>(
"block_id", 0,
"Domain Index");
59 _unheated_length_entry(getParam<
Real>(
"unheated_length_entry")),
60 _heated_length(getParam<
Real>(
"heated_length")),
61 _unheated_length_exit(getParam<
Real>(
"unheated_length_exit")),
62 _block_id(getParam<unsigned
int>(
"block_id")),
63 _spacer_z(getParam<
std::vector<
Real>>(
"spacer_z")),
64 _spacer_k(getParam<
std::vector<
Real>>(
"spacer_k")),
65 _z_blockage(getParam<
std::vector<
Real>>(
"z_blockage")),
66 _index_blockage(getParam<
std::vector<unsigned
int>>(
"index_blockage")),
67 _reduction_blockage(getParam<
std::vector<
Real>>(
"reduction_blockage")),
68 _k_blockage(getParam<
std::vector<
Real>>(
"k_blockage")),
69 _pitch(getParam<
Real>(
"pitch")),
70 _kij(getParam<
Real>(
"Kij")),
71 _pin_diameter(getParam<
Real>(
"pin_diameter")),
72 _n_cells(getParam<unsigned
int>(
"n_cells")),
73 _n_rings(getParam<unsigned
int>(
"nrings")),
74 _flat_to_flat(getParam<
Real>(
"flat_to_flat")),
75 _dwire(getParam<
Real>(
"dwire")),
76 _hwire(getParam<
Real>(
"hwire")),
77 _duct_to_pin_gap(0.5 *
78 (_flat_to_flat - (_n_rings - 1) * _pitch *
std::
sqrt(3.0) - _pin_diameter))
81 mooseError(
name(),
": Size of vector spacer_z should be equal to size of vector spacer_k");
85 mooseError(
name(),
": Location of spacers should be less than the total bundle length");
91 mooseError(
name(),
": The area reduction of the blocked subchannels cannot be more than 1");
97 ": Size of vectors: index_blockage, reduction_blockage, k_blockage, must be equal " 107 std::vector<int> spacer_cell;
109 spacer_cell.emplace_back(std::round(elem *
_n_cells / L));
112 std::vector<Real> kgrid;
116 for (
unsigned int index = 0; index < spacer_cell.size(); index++)
117 kgrid[spacer_cell[index]] +=
_spacer_k[index];
135 Real avg_coor_x = 0.0;
137 Real avg_coor_y = 0.0;
143 unsigned int kgap = 0;
145 unsigned int icorner = 0;
147 const Real positive_flow = 1.0;
149 const Real negative_flow = -1.0;
151 std::vector<std::pair<unsigned int, unsigned int>> gap_fill;
158 for (
unsigned int i = 1; i <
_n_rings; i++)
159 for (
unsigned int j = 0;
j < i * 6;
j++)
163 unsigned int chancount = 0.0;
172 ": The index of the blocked subchannel cannot be more than the max index of the " 178 ": Size of vectors: index_blockage, reduction_blockage, k_blockage, cannot be more " 179 "than the total number of subchannels");
188 for (
unsigned int i = 0; i <
_n_cells + 1; i++)
192 unsigned int index(0);
222 for (
unsigned int j = 0;
j < 3;
j++)
229 for (
unsigned int iz = 0; iz <
_n_cells + 1; iz++)
234 for (
unsigned int i = 0; i <
_npins; i++)
242 for (
unsigned int i = 1; i <
_n_rings; i++)
382 for (
unsigned int loc_rod = 0; loc_rod <
_npins; loc_rod++)
386 bool rod_in_sc =
false;
495 gap_fill[
j].first = 1;
500 gap_fill[
j].second = 1;
514 gap_fill[
j].first = 1;
519 gap_fill[
j].second = 1;
584 for (
unsigned int iz = 0; iz <
_n_cells + 1; iz++)
586 for (
unsigned int i_gap = 0; i_gap <
_n_gaps; i_gap++)
603 for (
unsigned int k = 0;
k < 3;
k++)
634 for (
unsigned int k = 0;
k < 2;
k++)
715 a2 = std::sqrt((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0)) + a1;
727 a2 = std::sqrt((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0)) + a1;
752 std::unique_ptr<MeshBase>
757 BoundaryInfo & boundary_info = mesh_base->get_boundary_info();
758 mesh_base->set_spatial_dimension(3);
766 unsigned int node_id = 0;
770 for (
unsigned int iz = 0; iz <
_n_cells + 1; iz++)
772 _nodes[i].push_back(mesh_base->add_point(
779 unsigned int elem_id = 0;
782 for (
unsigned int iz = 0; iz <
_n_cells; iz++)
784 Elem * elem =
new Edge2;
785 elem->set_id(elem_id++);
786 elem = mesh_base->add_elem(elem);
787 const int indx1 = (
_n_cells + 1) * i + iz;
788 const int indx2 = (
_n_cells + 1) * i + (iz + 1);
789 elem->set_node(0, mesh_base->node_ptr(indx1));
790 elem->set_node(1, mesh_base->node_ptr(indx2));
793 boundary_info.add_side(elem, 0, 0);
795 boundary_info.add_side(elem, 1, 1);
798 boundary_info.sideset_name(0) =
"inlet";
799 boundary_info.sideset_name(1) =
"outlet";
800 boundary_info.nodeset_name(0) =
"inlet";
801 boundary_info.nodeset_name(1) =
"outlet";
806 mesh_base->prepare_for_use();
820 sch_mesh._kij =
_kij;
847 sch_mesh.computeAssemblyHydraulicParameters();
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
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 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
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::string & name() const
const std::vector< Real > _k_blockage
form loss coefficient of subchannels affected by blockage
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
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
void mooseError(Args &&... args) const
SCMTriSubChannelMeshGenerator(const InputParameters ¶meters)
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