[MITgcm-support] STDOUT monitor output

chris hill cnh at mit.edu
Mon Jan 16 15:59:04 EST 2006


Hi Tom,

  If you modify the mon_out.F I/O statement to read

    WRITE(msgBuf(36:57),'(1X,1P1E21.13E3)') dval

  I think it will work properly - at least it does for me with g77 and 
ifort. If it turns out this is standard Fortran we'll fix it in the full 
code shortly.

Chris

Ed Hill wrote:
> On Mon, 2006-01-16 at 10:49 -0500, Thomas Haine wrote:
> 
>>Hi, I've noticed a very minor formatting glitch in STDOUT monitor
>>output:
>>
>>(PID.TID 0000.0001) %MON seaice_area_max              =
>>3.0247774315412-163
>>(PID.TID 0000.0001) %MON seaice_area_min              =
>>0.0000000000000E+00
> 
> 
> Hi Tom,
> 
> This "problem" boils down to a single formatted write (located in the
> mon_out.f file) which does:
> 
>   WRITE(msgBuf(36:57),'(1X,1P1E21.13)') dval
> 
> to generate the numerical part of the monitor output.  Using the simple
> program below, notice how different compilers give these answers:
> 
>   g77 (GCC 3.x):
>   1.2345678806305E+00  1.2345678900000E-07  1.2345678900000+123
>    1.2345678806305E+00   1.2345678900000E-07   1.2345678900000+123
>     1.2345678806305E+00    1.2345678900000E-07    1.2345678900000+123
> 
>   Intel ifort v8.x:
>   1.2345678806305E+00  1.2345678900000E-07  1.2345678900000+123
>    1.2345678806305E+00   1.2345678900000E-07   1.2345678900000+123
>     1.2345678806305E+00    1.2345678900000E-07    1.2345678900000+123
> 
>   PGI v5.2:
>   1.2345678806305E+00  1.2345678900000E-07  1.2345678900000+123
>    1.2345678806305E+00   1.2345678900000E-07   1.2345678900000+123
>     1.2345678806305E+00    1.2345678900000E-07    1.2345678900000+123
> 
> 
> which all drop the "E" even when there is sufficient "space" within the
> overall output field width.  So trying to parse the monitor ASCII output
> can be tricky.
> 
> Given the above, what can you do?  You have at least two choices:
> 
>   1) write a smarter parser for the ASCII output or
>   2) quick mucking about with ASCII and use MNC to write the 
>      monitor output to a neatly and consistently formatted 
>      netCDF file.
> 
> The MNC capability is there in the code so you just need to turn it on.
> And I'll be happy to help you build netCDF for whatever platform you're
> using.  For example, see: 
> 
>   http://eh3.com/blog_20060107.html
> 
> Ed
> 
> ===== t.f =====
>       program t
>       double precision a,b,c
>       a = 1.23456789
>       b = 1.23456789d-7
>       c = 1.23456789d+123
>       write(6,'(1P1E21.13,1P1E21.13,1P1E21.13)') a,b,c
>       write(6,'(1P1E22.13,1P1E22.13,1P1E22.13)') a,b,c
>       write(6,'(1P1E23.13,1P1E23.13,1P1E23.13)') a,b,c
>       end
> ===== t.f =====
> 




More information about the MITgcm-support mailing list