[Wrf-users] Bug fixes for ARWpost

Kemp, Eric M. Eric.Kemp at ngc.com
Fri Jul 20 07:19:27 MDT 2007


Dear wrf-users:

I have started using the new ARWpost program version 1.0, released on June 19.  In running ARWpost with the Intel compiler (ifort 9.1.043) on a Xeon cluster, I have found three bugs that cause the program to crash.  (Curiously no problems are indicated when using pgf90 on an Opteron cluster).

1.  In input_module.F90, subroutine read_next_field, near line 97:

Replace:

      IF ( ASSOCIATED(real_array) ) DEALLOCATE(real_array)
      IF ( ASSOCIATED(real_domain) ) DEALLOCATE(real_domain)
    
with:

      IF ( ASSOCIATED(real_array) ) DEALLOCATE(real_array)
!      IF ( ASSOCIATED(real_domain) ) DEALLOCATE(real_domain)
      nullify(real_domain) ! Bug fix

The bug is that real_array and real_domain point to the same target after read_next_field is called once.  The first deallocate call will destroy the target for both pointers.  Attempting to deallocate an unallocated target is illegal in Fortran 90.  

2.  In input_module.F90, subroutine read_spec_field, near line 156:

Replace:

      IF ( ASSOCIATED(real_domain) ) DEALLOCATE(real_domain)
      IF ( ASSOCIATED(real_array) ) DEALLOCATE(real_array)

with:

!      IF ( ASSOCIATED(real_domain) ) DEALLOCATE(real_domain)
      nullify(real_domain) ! Bug fix
      IF ( ASSOCIATED(real_array) ) DEALLOCATE(real_array)

This is the same type of bug at #1.

3.  In process_domain_module.F90, subroutine get_fields, near line 615.

Replace:

          IF (cname(len_trim(cname)-1:len_trim(cname)) == "_U" ) CYCLE process_all_fields
          IF (cname(len_trim(cname)-1:len_trim(cname)) == "_V" ) CYCLE process_all_fields

with:

          ! Bug fix
          if (len_trim(cname) >= 2) then
            IF (cname(len_trim(cname)-1:len_trim(cname)) == "_U" ) CYCLE process_all_fields
            IF (cname(len_trim(cname)-1:len_trim(cname)) == "_V" ) CYCLE process_all_fields
          end if
          ! End bug fix

The bug is that several variables in the wrfout files have one character names (e.g., "U", "V", "W").  For those variables, len_trim(cname) returns 1, and the if statements try to evaluate cname(0:1), which is out of bounds.

Eric Kemp
Northrop Grumman Corporation/TASC
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/wrf-users/attachments/20070720/336f1913/attachment.html


More information about the Wrf-users mailing list