Skip to content

Commit

Permalink
Fix integer overflow for large simulations (#359)
Browse files Browse the repository at this point in the history
Co-authored-by: Ben Wilfong <bwilfong3@gatech.edu>
  • Loading branch information
wilfonba and wilfonba authored Feb 25, 2024
1 parent 22e2d63 commit 0fdb37a
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion examples/2D_ibm_airfoil/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
# Correct errors when computing speed of sound
'mixture_err' : 'T',
# Use TVD RK3 for time marching
'time_stepper' : 1,
'time_stepper' : 3,
# Reconstruct the primitive variables to minimize spurious
# Use WENO5
'weno_order' : 5,
Expand Down
2 changes: 1 addition & 1 deletion examples/2D_ibm_multiphase/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
# Correct errors when computing speed of sound
'mixture_err' : 'T',
# Use TVD RK3 for time marching
'time_stepper' : 1,
'time_stepper' : 3,
# Use WENO5
'weno_order' : 5,
'weno_eps' : 1.E-16,
Expand Down
2 changes: 1 addition & 1 deletion examples/3D_ibm/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
# Correct errors when computing speed of sound
'mixture_err' : 'T',
# Use TVD RK3 for time marching
'time_stepper' : 2,
'time_stepper' : 3,
# Reconstruct the primitive variables to minimize spurious
# Use WENO5
'weno_order' : 5,
Expand Down
8 changes: 2 additions & 6 deletions src/post_process/m_checker.f90
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ subroutine s_check_inputs()
elseif (n == 0 .and. p > 0) then
call s_mpi_abort('Unsupported choice of the combination of '// &
'values for n and p. Exiting ...')
elseif ((m + 1)*(n + 1)*(p + 1) &
< &
2**(min(1, m) + min(1, n) + min(1, p))*num_procs) then
elseif (nGlobal < 2**(min(1, m) + min(1, n) + min(1, p))*num_procs) then
call s_mpi_abort('Unsupported choice of the combination of '// &
'values for num_procs, m, n and p. '// &
'Exiting ...')
Expand Down Expand Up @@ -97,9 +95,7 @@ subroutine s_check_inputs()
elseif (p > 0 .and. p + 1 < weno_order) then
call s_mpi_abort('Unsupported choice of the combination of '// &
'values for p and weno_order. Exiting ...')
elseif ((m + 1)*(n + 1)*(p + 1) &
< &
weno_order**(min(1, m) + min(1, n) + min(1, p))*num_procs) &
elseif (nGlobal < weno_order**(min(1, m) + min(1, n) + min(1, p))*num_procs) &
then
call s_mpi_abort('Unsupported choice of the combination of '// &
'values for num_procs, m, n, p and '// &
Expand Down
2 changes: 2 additions & 0 deletions src/post_process/m_global_parameters.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ module m_global_parameters
integer :: p
!> @}

integer(8) :: nGlobal ! Total number of cells in global domain

!> @name Cylindrical coordinates (either axisymmetric or full 3D)
!> @{
logical :: cyl_coord
Expand Down
2 changes: 2 additions & 0 deletions src/post_process/m_start_up.f90
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ subroutine s_read_input_file() ! ---------------------------------------
m_glb = m
n_glb = n
p_glb = p

nGlobal = (m_glb + 1)*(n_glb + 1)*(p_glb + 1)
else
call s_mpi_abort('File post_process.inp is missing. Exiting ...')
end if
Expand Down
8 changes: 2 additions & 6 deletions src/pre_process/m_checker.f90
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,7 @@ subroutine s_check_inputs()
elseif (n == 0 .and. p > 0) then
call s_mpi_abort('Unsupported choice of the combination of '// &
'values for n and p. Exiting ...')
elseif ((m + 1)*(n + 1)*(p + 1) &
< &
2**(min(1, m) + min(1, n) + min(1, p))*num_procs) then
elseif (nGlobal < 2**(min(1, m) + min(1, n) + min(1, p))*num_procs) then
call s_mpi_abort('Unsupported choice of the combination of '// &
'values for num_procs, m, n and p. '// &
'Exiting ...')
Expand Down Expand Up @@ -408,9 +406,7 @@ subroutine s_check_inputs()
elseif (p > 0 .and. p + 1 < weno_order) then
call s_mpi_abort('Unsupported choice of the combination of '// &
'values for p and weno_order. Exiting ...')
elseif ((m + 1)*(n + 1)*(p + 1) &
< &
weno_order**(min(1, m) + min(1, n) + min(1, p))*num_procs) &
elseif (nGlobal < weno_order**(min(1, m) + min(1, n) + min(1, p))*num_procs) &
then
call s_mpi_abort('Unsupported choice of the combination of '// &
'values for num_procs, m, n, p and '// &
Expand Down
2 changes: 2 additions & 0 deletions src/pre_process/m_global_parameters.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ module m_global_parameters
integer :: p !<
!! Number of cells in the x-, y- and z-coordinate directions

integer(8) :: nGlobal ! Global number of cells in the domain

integer :: m_glb, n_glb, p_glb !<
!! Global number of cells in each direction

Expand Down
2 changes: 2 additions & 0 deletions src/pre_process/m_start_up.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ contains
m_glb = m
n_glb = n
p_glb = p

nGlobal = (m_glb + 1)*(n_glb + 1)*(p_glb + 1)
else
call s_mpi_abort('File pre_process.inp is missing. Exiting ...')
end if
Expand Down

0 comments on commit 0fdb37a

Please sign in to comment.