12 #include "libmesh/edge_edge2.h" 17 QuadInterWrapperMeshGenerator,
25 params.
addClassDescription(
"Creates a mesh for the inter-wrapper around square subassemblies");
28 "Outer side lengths of assembly in x [m] - including duct");
30 "Outer side lengths of assembly in y [m] - including duct");
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.
addParam<
Real>(
"Kij", 0.5,
"Lateral form loss coefficient [-]");
35 params.
addRequiredParam<
unsigned int>(
"n_cells",
"The number of cells in the axial direction");
36 params.
addRequiredParam<
unsigned int>(
"nx",
"Number of assemblies in the x direction [-]");
37 params.
addRequiredParam<
unsigned int>(
"ny",
"Number of assemblies in the y direction [-]");
39 "Extra size of the bypass for the side assemblies [m]");
40 params.
addParam<
unsigned int>(
"block_id", 0,
"Domain Index");
46 _assembly_pitch(getParam<
Real>(
"assembly_pitch")),
47 _assembly_side_x(getParam<
Real>(
"assembly_side_x")),
48 _assembly_side_y(getParam<
Real>(
"assembly_side_y")),
49 _unheated_length_entry(getParam<
Real>(
"unheated_length_entry")),
50 _heated_length(getParam<
Real>(
"heated_length")),
51 _unheated_length_exit(getParam<
Real>(
"unheated_length_exit")),
52 _kij(getParam<
Real>(
"Kij")),
53 _n_cells(getParam<unsigned
int>(
"n_cells")),
54 _nx(getParam<unsigned
int>(
"nx")),
55 _ny(getParam<unsigned
int>(
"ny")),
56 _side_bypass_length(getParam<
Real>(
"side_bypass")),
57 _n_channels((_nx + 1) * (_ny + 1)),
58 _n_gaps(_nx * (_ny + 1) + _ny * (_nx + 1)),
59 _n_assemblies(_nx * _ny),
60 _block_id(getParam<unsigned
int>(
"block_id"))
67 mooseError(
name(),
": The number of assemblies cannot be less than one in any direction. ");
74 for (
unsigned int i = 0; i <
_n_cells + 1; i++)
90 Real positive_flow = 1.0;
91 Real negative_flow = -1.0;
95 for (
unsigned int iy = 0; iy <
_ny; iy++)
97 for (
unsigned int ix = 0; ix <
_nx; ix++)
99 unsigned int i_ch =
_nx * iy + ix;
100 bool is_corner = (ix == 0 && iy == 0) || (ix ==
_nx - 1 && iy == 0) ||
101 (ix == 0 && iy ==
_ny - 1) || (ix ==
_nx - 1 && iy ==
_ny - 1);
102 bool is_edge = (ix == 0 || iy == 0 || ix ==
_nx - 1 || iy ==
_ny - 1);
114 unsigned int i_gap = 0;
115 for (
unsigned int iy = 0; iy <
_ny; iy++)
117 for (
unsigned int ix = 0; ix <
_nx - 1; ix++)
119 unsigned int i_ch =
_nx * iy + ix;
120 unsigned int j_ch =
_nx * iy + (ix + 1);
128 if (iy == 0 || iy ==
_ny - 1)
137 for (
unsigned int iy = 0; iy <
_ny - 1; iy++)
139 for (
unsigned int ix = 0; ix <
_nx; ix++)
141 unsigned int i_ch =
_nx * iy + ix;
142 unsigned int j_ch =
_nx * (iy + 1) + ix;
150 if (ix == 0 || ix ==
_nx - 1)
159 for (
unsigned int iy = 0; iy <
_ny - 1; iy++)
161 for (
unsigned int ix = 0; ix <
_nx - 1; ix++)
163 unsigned int i_pin = (
_nx - 1) * iy + ix;
164 unsigned int i_chan_1 =
_nx * iy + ix;
165 unsigned int i_chan_2 =
_nx * (iy + 1) + ix;
166 unsigned int i_chan_3 =
_nx * (iy + 1) + (ix + 1);
167 unsigned int i_chan_4 =
_nx * iy + (ix + 1);
176 for (
unsigned int iy = 0; iy <
_ny; iy++)
178 for (
unsigned int ix = 0; ix <
_nx; ix++)
180 unsigned int i_ch =
_nx * iy + ix;
182 if (iy == 0 && ix == 0)
186 else if (iy ==
_ny - 1 && ix == 0)
190 else if (iy == 0 && ix ==
_nx - 1)
194 else if (iy ==
_ny - 1 && ix ==
_nx - 1)
204 else if (iy ==
_ny - 1)
214 else if (ix ==
_nx - 1)
242 _console <<
"Inter-wrapper quad mesh initialized" << std::endl;
245 std::unique_ptr<MeshBase>
249 BoundaryInfo & boundary_info = mesh_base->get_boundary_info();
250 mesh_base->set_spatial_dimension(3);
260 unsigned int node_id = 0;
261 for (
unsigned int iy = 0; iy <
_ny; iy++)
263 for (
unsigned int ix = 0; ix <
_nx; ix++)
265 int i_ch =
_nx * iy + ix;
267 for (
unsigned int iz = 0; iz <
_n_cells + 1; iz++)
269 _nodes[i_ch].push_back(mesh_base->add_point(
278 unsigned int elem_id = 0;
279 for (
unsigned int iy = 0; iy <
_ny; iy++)
281 for (
unsigned int ix = 0; ix <
_nx; ix++)
283 for (
unsigned int iz = 0; iz <
_n_cells; iz++)
285 Elem * elem =
new Edge2;
287 elem->set_id(elem_id++);
288 elem = mesh_base->add_elem(elem);
291 elem->set_node(0, mesh_base->node_ptr(indx1));
292 elem->set_node(1, mesh_base->node_ptr(indx2));
295 boundary_info.add_side(elem, 0, 0);
297 boundary_info.add_side(elem, 1, 1);
302 boundary_info.sideset_name(0) =
"inlet";
303 boundary_info.sideset_name(1) =
"outlet";
304 boundary_info.nodeset_name(0) =
"inlet";
305 boundary_info.nodeset_name(1) =
"outlet";
307 mesh_base->prepare_for_use();
320 sch_mesh._kij =
_kij;
338 _console <<
"Inter-wrapper quad mesh generated" << std::endl;
const Real & _kij
Lateral form loss coefficient.
std::vector< std::vector< Real > > _k_grid
axial form loss coefficient per computational cell
Real _unheated_length_entry
unheated length of the fuel Pin at the entry of the assembly
std::vector< EChannelType > _subch_type
Subchannel type.
std::vector< std::vector< double > > _sign_id_crossflow_map
Matrix used to give local sign to crossflow quantities.
std::vector< double > _gij_map
Vector to store gap size.
std::vector< std::pair< unsigned int, unsigned int > > _gap_to_chan_map
Defining the channel maps.
std::vector< std::vector< unsigned int > > _chan_to_gap_map
unsigned int _nx
Number of assemblies in the x direction.
const Real _unheated_length_exit
unheated length of the inter-wrapper section at the exit of the assembly
std::vector< std::vector< unsigned int > > _pin_to_chan_map
registerMooseObjectRenamed("SubChannelApp", QuadInterWrapperMeshGenerator, "06/30/2025 24:00", SCMQuadInterWrapperMeshGenerator)
virtual const std::string & name() const
const Real _assembly_side_x
Sides of the assemblies in the x and y direction.
const Real _side_bypass_length
Extra bypass lengths in the sides of the assembly.
const unsigned int _block_id
block index
unsigned int _ny
Number of assemblies in the y direction.
const unsigned int _n_gaps
Number of gaps per layer.
const Real _heated_length
heated length of the inter-wrapper section
std::vector< Real > _z_grid
axial location of nodes
const Real _assembly_side_y
static InputParameters validParams()
const unsigned int _n_channels
Total number of flow channels.
std::unique_ptr< MeshBase > generate() override
Creates the mesh of an inter-wrapper around square assemblies.
std::vector< std::vector< Node * > > _gapnodes
Nodes of the gaps.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const unsigned int _n_assemblies
Number of assemblies.
static InputParameters validParams()
const unsigned int _n_cells
number of axial cells
std::vector< std::vector< Node * > > _nodes
Channel nodes.
void mooseError(Args &&... args) const
const Real _assembly_pitch
Distance between the neighbor fuel assemblies, assembly pitch.
const Real _unheated_length_entry
unheated length of the inter-wrapper section at the entry of the assembly
const ConsoleStream _console
SCMQuadInterWrapperMeshGenerator(const InputParameters ¶meters)
std::unique_ptr< MeshBase > buildMeshBaseObject(unsigned int dim=libMesh::invalid_uint)
registerMooseObject("SubChannelApp", SCMQuadInterWrapperMeshGenerator)
void ErrorVector unsigned int
std::vector< std::vector< unsigned int > > _chan_to_pin_map
Class for Subchannel mesh generation in the square lattice geometry.