diff --git a/sources/equations.F90 b/sources/equations.F90 index d9a9921..ce7bef0 100644 --- a/sources/equations.F90 +++ b/sources/equations.F90 @@ -1479,9 +1479,14 @@ module equations n = n + 1 +#if NDIMS == 3 sfmt = '("n: ",i0,", [i,j,k]: ",3(1x,i0),", [x,y,z]: ",3es12.4)' write(msg,sfmt) n, i, j, k, x(i), y(j), z(k) - call print_message(loc, msg) +#else /* NDIMS == 3 */ + sfmt = '("n: ",i0,", [i,j]: ",2(1x,i0),", [x,y]: ",2es12.4)' + write(msg,sfmt) n, i, j, x(i), y(j) +#endif /* NDIMS == 3 */ + call print_message(msg) idx(:,n) = [ i, j, k ] @@ -1528,14 +1533,14 @@ module equations ! neighbours failed ! msg = "Not sufficient number of physical neighbors!" - call print_message(loc, msg) + call print_message(msg) sfmt = '("Block ID:",i0,", cell position = ( ",3(i4," ")," ).")' write(msg,sfmt) pdata%meta%id, i, j, k - call print_message(loc, msg) + call print_message(msg) write(msg,"('Q = ',10(1x,1es24.16e3))") pdata%q(:,i,j,k) - call print_message(loc, msg) + call print_message(msg) msg = "Applying lower bounds for positive variables." - call print_message(loc, msg) + call print_message(msg) q( : ,n) = pdata%q( : ,i,j,k) q(idn,n) = max(pdata%q(idn,i,j,k), dmin) diff --git a/sources/helpers.F90 b/sources/helpers.F90 index c55cffd..0c332b9 100644 --- a/sources/helpers.F90 +++ b/sources/helpers.F90 @@ -44,6 +44,10 @@ module helpers module procedure print_parameter_double_range module procedure print_parameter_string_range end interface + interface print_message + module procedure print_message_loc + module procedure print_message_msg + end interface private @@ -417,8 +421,8 @@ module helpers ! !=============================================================================== ! -! subroutine PRINT_MESSAGE: -! ------------------------ +! subroutine PRINT_MESSAGE_LOC: +! ---------------------------- ! ! Subroutine prints a message for a given location. ! @@ -429,7 +433,7 @@ module helpers ! !=============================================================================== ! - subroutine print_message(loc, msg) + subroutine print_message_loc(loc, msg) use iso_fortran_env, only : error_unit @@ -444,7 +448,36 @@ module helpers !------------------------------------------------------------------------------- ! - end subroutine print_message + end subroutine print_message_loc +! +!=============================================================================== +! +! subroutine PRINT_MESSAGE_LOC: +! ---------------------------- +! +! Subroutine prints just a message without the location. +! +! Arguments: +! +! msg - the warning message; +! +!=============================================================================== +! + subroutine print_message_msg(msg) + + use iso_fortran_env, only : error_unit + + implicit none + + character(len=*), intent(in) :: msg + +!------------------------------------------------------------------------------- +! + write(error_unit,"(4x,a)" ) trim(msg) + +!------------------------------------------------------------------------------- +! + end subroutine print_message_msg ! !=============================================================================== !