Skip to content

Commit 804c3bf

Browse files
danieljvickersDaniel VickerssbryngelsonSpencer Bryngelson
authored
Fix MPI Divergent Grid Stretching (#1625)
* Added a global domain length to pre-process so that we can normalize by the global length * Empty commit to refresh PR mergeability check --------- Co-authored-by: Daniel Vickers <danieljvickers@login10.frontier.olcf.ornl.gov> Co-authored-by: Spencer Bryngelson <sbryngelson@gmail.com> Co-authored-by: Spencer Bryngelson <sbryngelson@login10.frontier.olcf.ornl.gov>
1 parent 54aa379 commit 804c3bf

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

src/pre_process/m_global_parameters.fpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ module m_global_parameters
3838
real(wp), allocatable, dimension(:) :: x_cb, y_cb, z_cb
3939
real(wp) :: dx, dy, dz !< Minimum cell-widths in the x-, y- and z-coordinate directions
4040
type(bounds_info) :: x_domain, y_domain, z_domain !< Locations of the domain bounds in the x-, y- and z-coordinate directions
41+
!> Global (pre-decomposition) domain bounds, needed by s_generate_serial_grid to stretch the grid using the full domain length
42+
!! rather than a local processor's sub-domain length
43+
type(bounds_info) :: x_domain_glb, y_domain_glb, z_domain_glb
4144
4245
! Simulation Algorithm Parameters
4346
! sys_size, eqn_idx, b_size, tensor_size, chemistry, elasticity, shear_*: in m_global_parameters_common

src/pre_process/m_grid.f90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impure subroutine s_generate_serial_grid
4949

5050
! Hyperbolic tangent grid stretching
5151
if (stretch_x) then
52-
length = abs(x_cb(m) - x_cb(-1))
52+
length = abs(x_domain_glb%end - x_domain_glb%beg)
5353
x_cb = x_cb/length
5454
x_a = x_a/length
5555
x_b = x_b/length
@@ -96,7 +96,7 @@ impure subroutine s_generate_serial_grid
9696

9797
! Hyperbolic tangent grid stretching in y-direction
9898
if (stretch_y) then
99-
length = abs(y_cb(n) - y_cb(-1))
99+
length = abs(y_domain_glb%end - y_domain_glb%beg)
100100
y_cb = y_cb/length
101101
y_a = y_a/length
102102
y_b = y_b/length
@@ -130,7 +130,7 @@ impure subroutine s_generate_serial_grid
130130

131131
! Hyperbolic tangent grid stretching in z-direction
132132
if (stretch_z) then
133-
length = abs(z_cb(p) - z_cb(-1))
133+
length = abs(z_domain_glb%end - z_domain_glb%beg)
134134
z_cb = z_cb/length
135135
z_a = z_a/length
136136
z_b = z_b/length

src/pre_process/m_start_up.fpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,12 @@ contains
622622
! Neither procedure has to be carried out if pre-process is in fact not truly executed in parallel.
623623
call s_mpi_bcast_user_inputs()
624624
call s_initialize_parallel_io()
625+
626+
! Save the global domain bounds before decomposition overwrites x/y/z_domain with each processor's local sub-domain bounds
627+
x_domain_glb = x_domain
628+
y_domain_glb = y_domain
629+
z_domain_glb = z_domain
630+
625631
call s_mpi_decompose_computational_domain()
626632
627633
end subroutine s_initialize_mpi_domain

0 commit comments

Comments
 (0)