Skip to content

Commit b8d3c3d

Browse files
authored
Merge branch 'MFlowCode:master' into master
2 parents 11754c6 + 43812d8 commit b8d3c3d

File tree

5 files changed

+29
-19
lines changed

5 files changed

+29
-19
lines changed

src/common/m_checker_common.fpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -331,11 +331,11 @@ contains
331331
if (any((/bc_${X}$%${VB2}$, bc_${X}$%${VB3}$/) /= 0._wp)) then
332332
call s_mpi_abort("bc_${X}$%beg must be -15 if "// &
333333
"bc_${X}$%${VB2}$ or bc_${X}$%${VB3}$ "// &
334-
"is set. Exiting.")
334+
"is set. Exiting.", CASE_FILE_ERROR_CODE)
335335
end if
336336
elseif (bc_${X}$%beg /= -16) then
337337
call s_mpi_abort("bc_${X}$%beg must be -15 or -16 if "// &
338-
"bc_${X}$%vb[1,2,3] is set. Exiting.")
338+
"bc_${X}$%vb[1,2,3] is set. Exiting.", CASE_FILE_ERROR_CODE)
339339
end if
340340
end if
341341
#:endfor
@@ -346,11 +346,11 @@ contains
346346
if (any((/bc_${X}$%${VE2}$, bc_${X}$%${VE3}$/) /= 0._wp)) then
347347
call s_mpi_abort("bc_${X}$%end must be -15 if "// &
348348
"bc_${X}$%${VE2}$ or bc_${X}$%${VE3}$ "// &
349-
"is set. Exiting.")
349+
"is set. Exiting.", CASE_FILE_ERROR_CODE)
350350
end if
351351
elseif (bc_${X}$%end /= -16) then
352352
call s_mpi_abort("bc_${X}$%end must be -15 or -16 if "// &
353-
"bc_${X}$%ve[1,2,3] is set. Exiting.")
353+
"bc_${X}$%ve[1,2,3] is set. Exiting.", CASE_FILE_ERROR_CODE)
354354
end if
355355
end if
356356
#:endfor

src/common/m_constants.fpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,7 @@ module m_constants
7878
real(wp), parameter :: ERRCON = 1.89e-4_wp !< Limit to slightly increase dt when truncation error is between ERRCON and 1
7979
real(wp), parameter :: PGROW = -0.2_wp !< Factor to increase dt when truncation error is between ERRCON and 1
8080

81+
! System constants
82+
integer, parameter :: CASE_FILE_ERROR_CODE = 22
83+
8184
end module m_constants

src/common/m_helper.fpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -475,17 +475,14 @@ contains
475475
subroutine s_prohibit_abort(condition, message)
476476
character(len=*), intent(in) :: condition, message
477477
478-
print *, " "
479-
print *, " "
480-
print *, " CASE FILE ERROR "
481-
print *, " "
482-
print *, "Prohibited condition: ", trim(condition)
478+
print *, ""
479+
print *, "CASE FILE ERROR"
480+
print *, " - Prohibited condition: ", trim(condition)
483481
if (len_trim(message) > 0) then
484-
print *, "Note: ", trim(message)
482+
print *, " - Note: ", trim(message)
485483
end if
486-
print *, " "
487484
print *, ""
488-
call s_mpi_abort
485+
call s_mpi_abort(code=CASE_FILE_ERROR_CODE)
489486
end subroutine s_prohibit_abort
490487
491488
!> This function generates the unassociated legendre poynomials

src/common/m_mpi_common.fpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -474,9 +474,10 @@ contains
474474
475475
!> The subroutine terminates the MPI execution environment.
476476
!! @param prnt error message to be printed
477-
subroutine s_mpi_abort(prnt)
477+
subroutine s_mpi_abort(prnt, code)
478478
479479
character(len=*), intent(in), optional :: prnt
480+
integer, intent(in), optional :: code
480481
481482
if (present(prnt)) then
482483
print *, prnt
@@ -485,14 +486,18 @@ contains
485486
end if
486487
487488
#ifndef MFC_MPI
488-
489-
stop 1
490-
489+
if (present(code)) then
490+
stop code
491+
else
492+
stop 1
493+
end if
491494
#else
492-
493495
! Terminating the MPI environment
494-
call MPI_ABORT(MPI_COMM_WORLD, 1, ierr)
495-
496+
if (present(code)) then
497+
call MPI_ABORT(MPI_COMM_WORLD, code, ierr)
498+
else
499+
call MPI_ABORT(MPI_COMM_WORLD, 1, ierr)
500+
end if
496501
#endif
497502
498503
end subroutine s_mpi_abort

toolchain/templates/include/helpers.mako

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ END
8787
8888
t_${target.name}_stop=$(python3 -c 'import time; print(time.time())')
8989
90+
if [ $code -eq 22 ]; then
91+
echo
92+
error "$YELLOW CASE FILE ERROR$COLOR_RESET > $YELLOW Case file has prohibited conditions as stated above.$COLOR_RESET"
93+
fi
94+
9095
if [ $code -ne 0 ]; then
9196
echo
9297
error ":( $MAGENTA${target.get_install_binpath(case)}$COLOR_RESET failed with exit code $MAGENTA$code$COLOR_RESET."

0 commit comments

Comments
 (0)