Skip to content

Commit 43812d8

Browse files
authored
Checker Error Message (#792)
1 parent 6b3e012 commit 43812d8

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
@@ -339,11 +339,11 @@ contains
339339
if (any((/bc_${X}$%${VB2}$, bc_${X}$%${VB3}$/) /= 0._wp)) then
340340
call s_mpi_abort("bc_${X}$%beg must be -15 if "// &
341341
"bc_${X}$%${VB2}$ or bc_${X}$%${VB3}$ "// &
342-
"is set. Exiting.")
342+
"is set. Exiting.", CASE_FILE_ERROR_CODE)
343343
end if
344344
elseif (bc_${X}$%beg /= -16) then
345345
call s_mpi_abort("bc_${X}$%beg must be -15 or -16 if "// &
346-
"bc_${X}$%vb[1,2,3] is set. Exiting.")
346+
"bc_${X}$%vb[1,2,3] is set. Exiting.", CASE_FILE_ERROR_CODE)
347347
end if
348348
end if
349349
#:endfor
@@ -354,11 +354,11 @@ contains
354354
if (any((/bc_${X}$%${VE2}$, bc_${X}$%${VE3}$/) /= 0._wp)) then
355355
call s_mpi_abort("bc_${X}$%end must be -15 if "// &
356356
"bc_${X}$%${VE2}$ or bc_${X}$%${VE3}$ "// &
357-
"is set. Exiting.")
357+
"is set. Exiting.", CASE_FILE_ERROR_CODE)
358358
end if
359359
elseif (bc_${X}$%end /= -16) then
360360
call s_mpi_abort("bc_${X}$%end must be -15 or -16 if "// &
361-
"bc_${X}$%ve[1,2,3] is set. Exiting.")
361+
"bc_${X}$%ve[1,2,3] is set. Exiting.", CASE_FILE_ERROR_CODE)
362362
end if
363363
end if
364364
#: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)