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;
348 PetscScalar value_tt =
_TR * (*_rho_soln)(node_out)*volume /
_dt;
349 LibmeshPetscCall(MatSetValues(
352 PetscScalar value_vec_tt =
359 if (iz == first_node)
361 PetscScalar value_vec_at = (*_mdot_soln)(node_in) * (*
_h_soln)(node_in);
363 LibmeshPetscCall(VecSetValues(
369 PetscInt col_at = i_ch +
_n_channels * (iz_ind - 1);
370 PetscScalar value_at = -1.0 * (*_mdot_soln)(node_in);
371 LibmeshPetscCall(MatSetValues(
378 PetscScalar value_at = (*_mdot_soln)(node_out);
379 LibmeshPetscCall(MatSetValues(
383 unsigned int counter = 0;
384 unsigned int cross_index = iz;
388 unsigned int ii_ch = chans.first;
389 unsigned int jj_ch = chans.second;
394 if (
_Wij(i_gap, cross_index) > 0.0)
396 if (iz == first_node)
398 h_star = (*_h_soln)(node_in_i);
399 PetscScalar value_vec_ct = -1.0 * alpha *
401 _Wij(i_gap, cross_index) * h_star;
403 LibmeshPetscCall(VecSetValues(
409 _Wij(i_gap, cross_index);
411 PetscInt col_ct = ii_ch +
_n_channels * (iz_ind - 1);
412 LibmeshPetscCall(MatSetValues(
415 PetscScalar value_ct = (1.0 - alpha) *
417 _Wij(i_gap, cross_index);
420 LibmeshPetscCall(MatSetValues(
423 else if (
_Wij(i_gap, cross_index) < 0.0)
425 if (iz == first_node)
427 h_star = (*_h_soln)(node_in_j);
428 PetscScalar value_vec_ct = -1.0 * alpha *
430 _Wij(i_gap, cross_index) * h_star;
432 LibmeshPetscCall(VecSetValues(
438 _Wij(i_gap, cross_index);
440 PetscInt col_ct = jj_ch +
_n_channels * (iz_ind - 1);
441 LibmeshPetscCall(MatSetValues(
444 PetscScalar value_ct = (1.0 - alpha) *
446 _Wij(i_gap, cross_index);
449 LibmeshPetscCall(MatSetValues(
454 if (iz == first_node)
456 PetscScalar value_vec_ct =
457 -2.0 * alpha * (*_h_soln)(node_in)*
_WijPrime(i_gap, cross_index);
458 value_vec_ct += alpha * (*_h_soln)(node_in_j)*
_WijPrime(i_gap, cross_index);
459 value_vec_ct += alpha * (*_h_soln)(node_in_i)*
_WijPrime(i_gap, cross_index);
466 PetscScalar value_center_ct = 2.0 * alpha *
_WijPrime(i_gap, cross_index);
468 PetscInt col_ct = i_ch +
_n_channels * (iz_ind - 1);
469 LibmeshPetscCall(MatSetValues(
472 PetscScalar value_left_ct = -1.0 * alpha *
_WijPrime(i_gap, cross_index);
475 LibmeshPetscCall(MatSetValues(
478 PetscScalar value_right_ct = -1.0 * alpha *
_WijPrime(i_gap, cross_index);
481 LibmeshPetscCall(MatSetValues(
484 PetscScalar value_center_ct = 2.0 * (1.0 - alpha) *
_WijPrime(i_gap, cross_index);
487 LibmeshPetscCall(MatSetValues(
490 PetscScalar value_left_ct = -1.0 * (1.0 - alpha) *
_WijPrime(i_gap, cross_index);
493 LibmeshPetscCall(MatSetValues(
496 PetscScalar value_right_ct = -1.0 * (1.0 - alpha) *
_WijPrime(i_gap, cross_index);
499 LibmeshPetscCall(MatSetValues(
518 LibmeshPetscCall(MatAssemblyBegin(
_hc_sys_h_mat, MAT_FINAL_ASSEMBLY));
519 LibmeshPetscCall(MatAssemblyEnd(
_hc_sys_h_mat, MAT_FINAL_ASSEMBLY));
521#if !PETSC_VERSION_LESS_THAN(3, 15, 0)
523 LibmeshPetscCall(MatAssemblyBegin(
_hc_sys_h_mat, MAT_FINAL_ASSEMBLY));
524 LibmeshPetscCall(MatAssemblyEnd(
_hc_sys_h_mat, MAT_FINAL_ASSEMBLY));
527 LibmeshPetscCall(MatAssemblyBegin(
_hc_sys_h_mat, MAT_FINAL_ASSEMBLY));
528 LibmeshPetscCall(MatAssemblyEnd(
_hc_sys_h_mat, MAT_FINAL_ASSEMBLY));
534 LibmeshPetscCall(MatAssemblyBegin(
_hc_sys_h_mat, MAT_FINAL_ASSEMBLY));
535 LibmeshPetscCall(MatAssemblyEnd(
_hc_sys_h_mat, MAT_FINAL_ASSEMBLY));
538 LibmeshPetscCall(MatAssemblyBegin(
_hc_sys_h_mat, MAT_FINAL_ASSEMBLY));
539 LibmeshPetscCall(MatAssemblyEnd(
_hc_sys_h_mat, MAT_FINAL_ASSEMBLY));
543 LibmeshPetscCall(MatAssemblyBegin(
_hc_sys_h_mat, MAT_FINAL_ASSEMBLY));
544 LibmeshPetscCall(MatAssemblyEnd(
_hc_sys_h_mat, MAT_FINAL_ASSEMBLY));
546 _console <<
"Block: " << iblock <<
" - Enthalpy conservation matrix assembled" << std::endl;