Skip to content

Commit 0fdb37a

Browse files
authored
Fix integer overflow for large simulations (#359)
Co-authored-by: Ben Wilfong <[email protected]>
1 parent 22e2d63 commit 0fdb37a

File tree

9 files changed

+15
-15
lines changed

9 files changed

+15
-15
lines changed

examples/2D_ibm_airfoil/case.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
# Correct errors when computing speed of sound
4646
'mixture_err' : 'T',
4747
# Use TVD RK3 for time marching
48-
'time_stepper' : 1,
48+
'time_stepper' : 3,
4949
# Reconstruct the primitive variables to minimize spurious
5050
# Use WENO5
5151
'weno_order' : 5,

examples/2D_ibm_multiphase/case.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
# Correct errors when computing speed of sound
4242
'mixture_err' : 'T',
4343
# Use TVD RK3 for time marching
44-
'time_stepper' : 1,
44+
'time_stepper' : 3,
4545
# Use WENO5
4646
'weno_order' : 5,
4747
'weno_eps' : 1.E-16,

examples/3D_ibm/case.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
# Correct errors when computing speed of sound
5151
'mixture_err' : 'T',
5252
# Use TVD RK3 for time marching
53-
'time_stepper' : 2,
53+
'time_stepper' : 3,
5454
# Reconstruct the primitive variables to minimize spurious
5555
# Use WENO5
5656
'weno_order' : 5,

src/post_process/m_checker.f90

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ subroutine s_check_inputs()
4242
elseif (n == 0 .and. p > 0) then
4343
call s_mpi_abort('Unsupported choice of the combination of '// &
4444
'values for n and p. Exiting ...')
45-
elseif ((m + 1)*(n + 1)*(p + 1) &
46-
< &
47-
2**(min(1, m) + min(1, n) + min(1, p))*num_procs) then
45+
elseif (nGlobal < 2**(min(1, m) + min(1, n) + min(1, p))*num_procs) then
4846
call s_mpi_abort('Unsupported choice of the combination of '// &
4947
'values for num_procs, m, n and p. '// &
5048
'Exiting ...')
@@ -97,9 +95,7 @@ subroutine s_check_inputs()
9795
elseif (p > 0 .and. p + 1 < weno_order) then
9896
call s_mpi_abort('Unsupported choice of the combination of '// &
9997
'values for p and weno_order. Exiting ...')
100-
elseif ((m + 1)*(n + 1)*(p + 1) &
101-
< &
102-
weno_order**(min(1, m) + min(1, n) + min(1, p))*num_procs) &
98+
elseif (nGlobal < weno_order**(min(1, m) + min(1, n) + min(1, p))*num_procs) &
10399
then
104100
call s_mpi_abort('Unsupported choice of the combination of '// &
105101
'values for num_procs, m, n, p and '// &

src/post_process/m_global_parameters.fpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ module m_global_parameters
3434
integer :: p
3535
!> @}
3636

37+
integer(8) :: nGlobal ! Total number of cells in global domain
38+
3739
!> @name Cylindrical coordinates (either axisymmetric or full 3D)
3840
!> @{
3941
logical :: cyl_coord

src/post_process/m_start_up.f90

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ subroutine s_read_input_file() ! ---------------------------------------
9898
m_glb = m
9999
n_glb = n
100100
p_glb = p
101+
102+
nGlobal = (m_glb + 1)*(n_glb + 1)*(p_glb + 1)
101103
else
102104
call s_mpi_abort('File post_process.inp is missing. Exiting ...')
103105
end if

src/pre_process/m_checker.f90

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,7 @@ subroutine s_check_inputs()
135135
elseif (n == 0 .and. p > 0) then
136136
call s_mpi_abort('Unsupported choice of the combination of '// &
137137
'values for n and p. Exiting ...')
138-
elseif ((m + 1)*(n + 1)*(p + 1) &
139-
< &
140-
2**(min(1, m) + min(1, n) + min(1, p))*num_procs) then
138+
elseif (nGlobal < 2**(min(1, m) + min(1, n) + min(1, p))*num_procs) then
141139
call s_mpi_abort('Unsupported choice of the combination of '// &
142140
'values for num_procs, m, n and p. '// &
143141
'Exiting ...')
@@ -408,9 +406,7 @@ subroutine s_check_inputs()
408406
elseif (p > 0 .and. p + 1 < weno_order) then
409407
call s_mpi_abort('Unsupported choice of the combination of '// &
410408
'values for p and weno_order. Exiting ...')
411-
elseif ((m + 1)*(n + 1)*(p + 1) &
412-
< &
413-
weno_order**(min(1, m) + min(1, n) + min(1, p))*num_procs) &
409+
elseif (nGlobal < weno_order**(min(1, m) + min(1, n) + min(1, p))*num_procs) &
414410
then
415411
call s_mpi_abort('Unsupported choice of the combination of '// &
416412
'values for num_procs, m, n, p and '// &

src/pre_process/m_global_parameters.fpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ module m_global_parameters
3535
integer :: p !<
3636
!! Number of cells in the x-, y- and z-coordinate directions
3737

38+
integer(8) :: nGlobal ! Global number of cells in the domain
39+
3840
integer :: m_glb, n_glb, p_glb !<
3941
!! Global number of cells in each direction
4042

src/pre_process/m_start_up.fpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ contains
159159
m_glb = m
160160
n_glb = n
161161
p_glb = p
162+
163+
nGlobal = (m_glb + 1)*(n_glb + 1)*(p_glb + 1)
162164
else
163165
call s_mpi_abort('File pre_process.inp is missing. Exiting ...')
164166
end if

0 commit comments

Comments
 (0)