From 2c84fe09d35fba1d946c5f8f1f3d44b73100abed Mon Sep 17 00:00:00 2001 From: ignis Date: Tue, 2 Jun 2026 17:35:44 +0000 Subject: [PATCH] refactor: replace non-standard GNU Fortran extensions with standard intrinsics --- code/m_openmpi.f90 | 11 +++++------ code/post.f90 | 19 +++++-------------- code/post_dns.f90 | 6 +++--- 3 files changed, 13 insertions(+), 23 deletions(-) diff --git a/code/m_openmpi.f90 b/code/m_openmpi.f90 index 9c22bdc..53f2e51 100644 --- a/code/m_openmpi.f90 +++ b/code/m_openmpi.f90 @@ -125,16 +125,15 @@ contains subroutine openmpi_get_command_line implicit none - character*80 :: tmp_str - integer :: iargc + character(len=80) :: tmp_str ! reading the run_name from the command line - if(iargc().eq.0) then - call getarg(0,tmp_str) + if(command_argument_count().eq.0) then + call get_command_argument(0,tmp_str) print*, 'Format: ',trim(tmp_str),' (run name) ["split"/"never"]' stop end if - call getarg(1,run_name_local) + call get_command_argument(1,run_name_local) if(len_trim(run_name_local).ne.10) then print *, 'Run name: "',run_name_local,'"' print *, ' "1234567890"' @@ -143,7 +142,7 @@ contains end if ! getting the split parameter, if it's there - if(iargc().eq.2) call getarg(2,split) + if(command_argument_count().eq.2) call get_command_argument(2,split) end subroutine openmpi_get_command_line diff --git a/code/post.f90 b/code/post.f90 index 8cc163a..7a3b5e4 100644 --- a/code/post.f90 +++ b/code/post.f90 @@ -172,14 +172,8 @@ MODULE post real(real64) :: dt,dummyu INTEGER :: ncyc - integer(8) :: ctime_i character(len=30) :: date - - REAL*4 :: e, t(2) - REAL*4 :: e0, t0(2) - REAL*4 :: e1, t1(2) - - e0 = etime(t0) + integer :: date_values(8) OPEN(num,FORM='unformatted',STATUS='unknown') @@ -210,18 +204,15 @@ MODULE post CLOSE (num) - e = etime(t) - - ctime_i = time8() - call ctime(ctime_i,date) + call date_and_time(values=date_values) + write(date, '(I4.4,"-",I2.2,"-",I2.2," ",I2.2,":",I2.2,":",I2.2)') & + date_values(1), date_values(2), date_values(3), & + date_values(5), date_values(6), date_values(7) WRITE(*,'(a,a,i2,a,i1,a,i4,a,i4,a,i4)') & date, "PID", myid, "|PASS", ipass, "|fort.", num, & "|", nprogress, "/", endnum-startnum+1 - - - END SUBROUTINE READ_FILE diff --git a/code/post_dns.f90 b/code/post_dns.f90 index 88fef14..aabefd4 100644 --- a/code/post_dns.f90 +++ b/code/post_dns.f90 @@ -48,9 +48,9 @@ WRITE(*,*) " -v print version information" WRITE(*,*) " -x print latex equations" ELSE IF(num1char=="-v") THEN - WRITE(*,*) input_string(1:lnblnk(input_string)) + WRITE(*,*) input_string(1:len_trim(input_string)) ELSE IF(num1char=="-x") THEN - WRITE(*,*) latex_string(1:lnblnk(latex_string)) + WRITE(*,*) latex_string(1:len_trim(latex_string)) ELSE WRITE(*,*) 'ERROR, OPTION NOT SUPPORTED ', num1char END IF @@ -61,7 +61,7 @@ CALL m_openmpi_init - if (iammaster) write(*,*) input_string(1:lnblnk(input_string)) + if (iammaster) write(*,*) input_string(1:len_trim(input_string)) CALL main