Data Files
On Unix systems,
I know, this is very complicated ... in addition, it will not work on Windows. Sure, Windows XP supports creating links to files, but, unfortunately, the links are themselves files that must end in the extension lnk. As a result, the alias names in the code will never match those created in Windows.
A much simpler system is to just have the program get the filenames directly from the rundeck (configuration file). For test purposes, I modified the rundeck so that the filenames and aliases would be processed like the other parameters. Then I wrote a small subroutine to lookup the file names. (I just copied and modified the beginning of the openunit subroutine.)
subroutine openalias( filealias, iunit, qbin, qold ) USE PARAM !@sum openalias calls openunit with the filename associated with the provided alias implicit none !@var unit - unit of opened file, used in read and write commands integer, intent(out) :: iunit !@var filealias - alias use the find the name of the file to open character*(*), intent(in) :: filealias !@var qbin - .true. if file is binary (.false. by default) !@var qold - .true. if file is old (.false. by default) logical, optional, intent(in) :: qbin, qold character*255 filename call get_param( filealias, filename ) call openunit( filename, iunit, qbin, qold ) end subroutine openalias |
RADIATION.f
character*255 filename ! added 11-08-08 rlc c inquire (file=ddfile(n),exist=qexist) ! fails with the aliases - 11-08-08 rlc call get_param( ddfile(n), filename ) ! added 11-08-08 rlc inquire (file=filename,exist=qexist) ! added 11-08-08 rlc c call openunit (ddfile(n),ifile,qbinary) call openalias (ddfile(n),ifile,qbinary) ! 11-08-08 rlc |
inquire (file=dtfile,exist=qexist) if(.not.qexist) dtfile='RH_QG_Mie ' ! generic name used by GCM inquire (file=dtfile,exist=qexist) if(.not.qexist) call stop_model('setrel: no RH_QG files',255) |
"End of file" Error
At line 1839 of file SEAICE.f (unit = 51, file = 'GIC.E046D3M20A.1DEC1955') Fortran runtime error: End of file |
-DCONVERT_BIGENDIAN |
Little Endian / Big Endian
Fortunately, GNU Fortran provides a command extension to specify how binary data is read ... which is real useful if you know how the data is stored.
Reviewing the support scripts and the source code indicated that Big Endian should be specified via the command line.
SYSTEM.f
I had to change that guess for the following subroutine - gfortran requires a variable for signal's optional third parameter ... a constant causes a system crash.
SUBROUTINE sys_signal (sig, prog) !@sum system call to "signal" !@auth I. Aleinov !@ver 1.0 (SGI,IBM,Linux,Dec) !! should check if works with DEC !! IMPLICIT NONE !@var unit signal number to catch INTEGER, INTENT(IN) :: sig !@var prog handler subroutine for given signal EXTERNAL prog #if defined(MACHINE_SGI) || defined(MACHINE_Linux) || defined(MACHINE_DEC) || defined(MACHINE_MAC) call signal( sig, prog, -1 ) #elif defined( MACHINE_IBM ) || defined(MACHINE_XP) call signal( sig, prog ) #else None of supported architectures was specified. This will crash the compiling process. #endif RETURN END SUBROUTINE sys_signal |
Success
Program terminated due to the following reason: >> Terminated normally (reached maximum time) << |
The initial rundeck - E001.R - only simulates 1 hour.
&INPUTZ YEARI=1949,MONTHI=12,DATEI=1,HOURI=0, ! IYEAR1=YEARI (default) YEARE=1956,MONTHE=1,DATEE=1,HOURE=0, KDIAG=0,2,2,9*0,9, ISTART=2,IRANDI=0, YEARE=1949,MONTHE=12,DATEE=1,HOURE=1, &END |
Long Run
error = convective cloud opt. depth less than zero ISCCP CLOUD TYPING ERROR Program terminated due to the following reason: >> ISCCP CLOUD TYPING ERROR << |
isccp_diags=1 ! use =0 to save cpu time |
I recompiled with the -O2 switch and ran it for only one month, it crashed with the following after 57 minutes.
Program terminated due to the following reason: >> In Radia: Q<0 << At the command prompt In Radia: Time,I,J,L,QL<0 8661 63 25 9 -2.95842105406229798E-025 ->0 |
Apparently, several files write the errors only to zero.
WRITE(0,*)'In Radia: Time,I,J,L,QL<0',ITime,I,J,L,shl(L),'->0' |
Optimization
Adding -O2 optimization reduced the runtime to 57 minutes per month. (Actually it crashed at 57 minutes.)
1.92395 minutes per day 57.7 minutes per 30-day month 11.7 hours per year compile w/o -O2 :24 to :28 - 4 minutes to compile compile w/ -O2 :42 to :48 - 6 minutes to compile
Other Issues
crlf issues - The software reads one line at a time, but how are lines defined? Unix and Windows systems use different characters to indicated the end of a line. Apparently, the Fortran libraries correctly handle the Unix codes on a Windows system ... or not. The model still crashes and this is a possible cause.
The notes that come with the model indicate that some systems crash if the stack size is not manually set. So far, I have not had a problem with this.
Author: Robert Clemenzi