From e50e83bb1c116ea7ddfbc29b76c0e60bf7036354 Mon Sep 17 00:00:00 2001 From: Grzegorz Kowal Date: Fri, 27 May 2022 11:54:32 -0300 Subject: [PATCH 1/3] EQUATIONS: Adapt unphysical cell info for 2D and 3D. Signed-off-by: Grzegorz Kowal --- sources/equations.F90 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sources/equations.F90 b/sources/equations.F90 index d9a9921..1d0ad16 100644 --- a/sources/equations.F90 +++ b/sources/equations.F90 @@ -1479,8 +1479,13 @@ 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) +#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(loc, msg) idx(:,n) = [ i, j, k ] From cb56db78804e32bddc9329dd537c6d357481500b Mon Sep 17 00:00:00 2001 From: Grzegorz Kowal Date: Fri, 27 May 2022 11:58:06 -0300 Subject: [PATCH 2/3] HELPERS: Introduce two print_message variants. One prints the location, another one just the message. Signed-off-by: Grzegorz Kowal --- sources/helpers.F90 | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) 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 ! !=============================================================================== ! From 0f104bd0338bd3210d0a580ec420f2e075e5df8f Mon Sep 17 00:00:00 2001 From: Grzegorz Kowal Date: Fri, 27 May 2022 11:59:35 -0300 Subject: [PATCH 3/3] EQUATIONS: Print the location just once in correct_unphysical_states(). Signed-off-by: Grzegorz Kowal --- sources/equations.F90 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sources/equations.F90 b/sources/equations.F90 index 1d0ad16..ce7bef0 100644 --- a/sources/equations.F90 +++ b/sources/equations.F90 @@ -1486,7 +1486,7 @@ module equations 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(loc, msg) + call print_message(msg) idx(:,n) = [ i, j, k ] @@ -1533,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)