39 _console <<
" =========== DEFORMATION RECALCULATION ACTIVATED ============== " << std::endl;
40 Real standard_area, additional_area, wetted_perimeter, displaced_area;
46 for (
unsigned int iz = 0; iz <
_n_cells + 1; iz++)
48 for (
unsigned int i_ch = 0; i_ch <
_n_channels; i_ch++)
54 Real rod_perimeter = 0.0;
58 rod_area += 0.25 * 0.25 * M_PI * (*_Dpin_soln)(pin_node) * (*
_Dpin_soln)(pin_node);
59 rod_perimeter += 0.25 * M_PI * (*_Dpin_soln)(pin_node);
64 standard_area = 0.25 * pitch * pitch;
67 additional_area = pitch * side_gap + side_gap * side_gap;
69 rod_perimeter + pitch + 2 * side_gap + 2 * (*_displacement_soln)(node) / sqrt(2);
73 standard_area = 0.5 * pitch * pitch;
74 additional_area = pitch * side_gap;
75 displaced_area = pitch * (*_displacement_soln)(node);
76 wetted_perimeter = rod_perimeter + pitch;
80 standard_area = pitch * pitch;
82 additional_area = 0.0;
83 wetted_perimeter = rod_perimeter;
87 auto subchannel_area = displaced_area + standard_area + additional_area - rod_area;
90 auto overlapping_pin_area = 0.0;
91 auto overlapping_wetted_perimeter = 0.0;
95 auto pin_1 = gap_pins.first;
96 auto pin_2 = gap_pins.second;
99 auto Diameter1 = (*_Dpin_soln)(pin_node_1);
100 auto Radius1 = Diameter1 / 2.0;
101 auto Diameter2 = (*_Dpin_soln)(pin_node_2);
102 auto Radius2 = Diameter2 / 2.0;
105 if (pitch < (Radius1 + Radius2))
107 mooseWarning(
" The gap of index : '", i_gap,
" at axial cell ", iz,
" ' is blocked.");
109 (pitch * pitch + Radius1 * Radius1 - Radius2 * Radius2) / (2 * pitch * Radius1);
111 (pitch * pitch + Radius2 * Radius2 - Radius1 * Radius1) / (2 * pitch * Radius2);
112 auto angle1 = 2.0 * acos(cos1);
113 auto angle2 = 2.0 * acos(cos2);
115 overlapping_wetted_perimeter += 0.5 * angle1 * Radius1 + 0.5 * angle2 * Radius2;
117 overlapping_pin_area +=
118 0.5 * Radius1 * Radius1 * acos(cos1) + 0.5 * Radius2 * Radius2 * acos(cos2) -
119 0.25 * sqrt((-pitch + Radius1 + Radius2) * (pitch + Radius1 - Radius2) *
120 (pitch - Radius1 + Radius2) * (pitch + Radius1 + Radius2));
123 subchannel_area += overlapping_pin_area;
124 wetted_perimeter += -overlapping_wetted_perimeter;
128 for (
const auto & i_blockage : index_blockage)
130 if (i_ch == i_blockage && (Z >= z_blockage.front() && Z <= z_blockage.back()))
132 subchannel_area *= reduction_blockage[index];
142 for (
unsigned int iz = 0; iz <
_n_cells + 1; iz++)
144 for (
unsigned int i_gap = 0; i_gap <
_n_gaps; i_gap++)
147 auto pin_1 = gap_pins.first;
148 auto pin_2 = gap_pins.second;
153 auto displacement = 0.0;
161 displacement += (*_displacement_soln)(node);
165 displacement = displacement / counter;
167 iz, i_gap, (pitch - (*
_Dpin_soln)(pin_node_1)) / 2.0 + side_gap + displacement);
181 for (
unsigned int iz = 1; iz <
_n_cells + 1; iz++)
183 for (
unsigned int i_ch = 0; i_ch <
_n_channels; i_ch++)
193 _aux->solution().close();
245 unsigned int last_node = (iblock + 1) *
_block_size;
246 unsigned int first_node = iblock *
_block_size + 1;
249 for (
unsigned int i_ch = 0; i_ch <
_n_channels; i_ch++)
256 name(),
" : Calculation of negative Enthalpy h_out = : ", h_out,
" Axial Level= : ", 0);
264 for (
unsigned int iz = first_node; iz < last_node + 1; iz++)
267 for (
unsigned int i_ch = 0; i_ch <
_n_channels; i_ch++)
271 auto mdot_in = (*_mdot_soln)(node_in);
272 auto h_in = (*_h_soln)(node_in);
273 auto volume = dz * (*_S_flow_soln)(node_in);
274 auto mdot_out = (*_mdot_soln)(node_out);
277 Real sumWijPrimeDhij = 0.0;
280 unsigned int counter = 0;
284 unsigned int ii_ch = chans.first;
286 unsigned int jj_ch = chans.second;
291 if (
_Wij(i_gap, iz) > 0.0)
292 h_star = (*
_h_soln)(node_in_i);
293 else if (
_Wij(i_gap, iz) < 0.0)
294 h_star = (*
_h_soln)(node_in_j);
297 sumWijPrimeDhij +=
_WijPrime(i_gap, iz) * (2 * (*_h_soln)(node_in) -
301 h_out = (mdot_in * h_in - sumWijh - sumWijPrimeDhij + added_enthalpy +
307 " : Calculation of negative Enthalpy h_out = : ",
327 for (
unsigned int iz = first_node; iz < last_node + 1; iz++)
330 auto iz_ind = iz - first_node;
331 for (
unsigned int i_ch = 0; i_ch <
_n_channels; i_ch++)
335 auto S_in = (*_S_flow_soln)(node_in);
336 auto S_out = (*_S_flow_soln)(node_out);
338 auto volume = dz * S_interp;
341 PetscScalar Pe = 0.5;
345 auto w_perim_in = (*_w_perim_soln)(node_in);
346 auto w_perim_out = (*_w_perim_soln)(node_out);
357 auto Dh_i = 4.0 * S_interp / w_perim_interp;
358 Pe = mdot_loc * Dh_i * cp / (K * S_interp) * (mdot_loc / std::abs(mdot_loc));
367 PetscScalar value_tt =
_TR * (*_rho_soln)(node_out)*volume /
_dt;
368 LibmeshPetscCall(MatSetValues(
371 PetscScalar value_vec_tt =
378 if (iz == first_node)
380 PetscScalar value_vec_at = (*_mdot_soln)(node_in) * (*
_h_soln)(node_in);
382 LibmeshPetscCall(VecSetValues(
388 PetscInt col_at = i_ch +
_n_channels * (iz_ind - 1);
389 PetscScalar value_at = -1.0 * (*_mdot_soln)(node_in);
390 LibmeshPetscCall(MatSetValues(
397 PetscScalar value_at = (*_mdot_soln)(node_out);
398 LibmeshPetscCall(MatSetValues(
402 unsigned int counter = 0;
403 unsigned int cross_index = iz;
407 unsigned int ii_ch = chans.first;
408 unsigned int jj_ch = chans.second;
413 if (
_Wij(i_gap, cross_index) > 0.0)
415 if (iz == first_node)
417 h_star = (*_h_soln)(node_in_i);
418 PetscScalar value_vec_ct = -1.0 * alpha *
420 _Wij(i_gap, cross_index) * h_star;
422 LibmeshPetscCall(VecSetValues(
428 _Wij(i_gap, cross_index);
430 PetscInt col_ct = ii_ch +
_n_channels * (iz_ind - 1);
431 LibmeshPetscCall(MatSetValues(
434 PetscScalar value_ct = (1.0 - alpha) *
436 _Wij(i_gap, cross_index);
439 LibmeshPetscCall(MatSetValues(
442 else if (
_Wij(i_gap, cross_index) < 0.0)
444 if (iz == first_node)
446 h_star = (*_h_soln)(node_in_j);
447 PetscScalar value_vec_ct = -1.0 * alpha *
449 _Wij(i_gap, cross_index) * h_star;
451 LibmeshPetscCall(VecSetValues(
457 _Wij(i_gap, cross_index);
459 PetscInt col_ct = jj_ch +
_n_channels * (iz_ind - 1);
460 LibmeshPetscCall(MatSetValues(
463 PetscScalar value_ct = (1.0 - alpha) *
465 _Wij(i_gap, cross_index);
468 LibmeshPetscCall(MatSetValues(
473 if (iz == first_node)
475 PetscScalar value_vec_ct =
476 -2.0 * alpha * (*_h_soln)(node_in)*
_WijPrime(i_gap, cross_index);
477 value_vec_ct += alpha * (*_h_soln)(node_in_j)*
_WijPrime(i_gap, cross_index);
478 value_vec_ct += alpha * (*_h_soln)(node_in_i)*
_WijPrime(i_gap, cross_index);
485 PetscScalar value_center_ct = 2.0 * alpha *
_WijPrime(i_gap, cross_index);
487 PetscInt col_ct = i_ch +
_n_channels * (iz_ind - 1);
488 LibmeshPetscCall(MatSetValues(
491 PetscScalar value_left_ct = -1.0 * alpha *
_WijPrime(i_gap, cross_index);
494 LibmeshPetscCall(MatSetValues(
497 PetscScalar value_right_ct = -1.0 * alpha *
_WijPrime(i_gap, cross_index);
500 LibmeshPetscCall(MatSetValues(
503 PetscScalar value_center_ct = 2.0 * (1.0 - alpha) *
_WijPrime(i_gap, cross_index);
506 LibmeshPetscCall(MatSetValues(
509 PetscScalar value_left_ct = -1.0 * (1.0 - alpha) *
_WijPrime(i_gap, cross_index);
512 LibmeshPetscCall(MatSetValues(
515 PetscScalar value_right_ct = -1.0 * (1.0 - alpha) *
_WijPrime(i_gap, cross_index);
518 LibmeshPetscCall(MatSetValues(
537 LibmeshPetscCall(MatAssemblyBegin(
_hc_sys_h_mat, MAT_FINAL_ASSEMBLY));
538 LibmeshPetscCall(MatAssemblyEnd(
_hc_sys_h_mat, MAT_FINAL_ASSEMBLY));
540#if !PETSC_VERSION_LESS_THAN(3, 15, 0)
542 LibmeshPetscCall(MatAssemblyBegin(
_hc_sys_h_mat, MAT_FINAL_ASSEMBLY));
543 LibmeshPetscCall(MatAssemblyEnd(
_hc_sys_h_mat, MAT_FINAL_ASSEMBLY));
546 LibmeshPetscCall(MatAssemblyBegin(
_hc_sys_h_mat, MAT_FINAL_ASSEMBLY));
547 LibmeshPetscCall(MatAssemblyEnd(
_hc_sys_h_mat, MAT_FINAL_ASSEMBLY));
553 LibmeshPetscCall(MatAssemblyBegin(
_hc_sys_h_mat, MAT_FINAL_ASSEMBLY));
554 LibmeshPetscCall(MatAssemblyEnd(
_hc_sys_h_mat, MAT_FINAL_ASSEMBLY));
557 LibmeshPetscCall(MatAssemblyBegin(
_hc_sys_h_mat, MAT_FINAL_ASSEMBLY));
558 LibmeshPetscCall(MatAssemblyEnd(
_hc_sys_h_mat, MAT_FINAL_ASSEMBLY));
562 LibmeshPetscCall(MatAssemblyBegin(
_hc_sys_h_mat, MAT_FINAL_ASSEMBLY));
563 LibmeshPetscCall(MatAssemblyEnd(
_hc_sys_h_mat, MAT_FINAL_ASSEMBLY));
565 _console <<
"Block: " << iblock <<
" - Enthalpy conservation matrix assembled" << std::endl;