8 January 2008

This is an approved src.alt for 481.wrf in CPU2006 v1.0 and v1.0.1.
It fixes a Fortran standard parameter overlap issue that has been
corrected by the original wrf developers.

To apply the src.alt, unpack the tar file in the top level of the CPU2006
directory.  The following sequence of commands should accomplish this:

$ /bin/sh
$ cd <cpu2006 dir>
$ . ./shrc
$ go top
$ specbzip2 -dc <src.alt tarball> | spectar -xvf -

Please replace the items in angle brackets ( <> ) as appropriate.

To have the src.alt applied during compilation, please add the following
stanza to your config file:

# Fix wrf alias violation
481.wrf:
srcalt=wrfv22

This src.alt changes 2 calls to subroutines that used the same parameter
for 2 different dummy arguments.  The exact change is detailed below.

Please address any questions about this src.alt to cpu2006support@spec.org.


DETAILS OF CHANGE.

There is a subroutine in module_bl_ysu.F90 that is called in violation
of the Fortran standard about variable overlapping.

The routine tridin has three variables (cu,r1,r2) that are passed in
the same parameters as (au,a1,a2) in both calls.  

The newer Version 2.2 of WRF has fixed this problem by making copies
of the read-only versions of the duplicated parameters before the call

That is done here:


--- ../../module_bl_ysu.F90	2005-08-16 14:55:19.000000000 -0500
+++ module_bl_ysu.F90	2007-10-29 12:24:27.000000000 -0500
@@ -348,11 +348,13 @@
 !
       real,    dimension( its:ite, kts:kte )    ::      xkzm,xkzh, &
                                                             a1,a2, &
+                                                            r1,r2, &
                                                             ad,au, &
+                                                               cu, &
                                                                al, &
                                                              zfac, &
                                                              scr4
-      real,    dimension( its:ite, kts:kte, ncloud)  ::        a3
+      real,    dimension( its:ite, kts:kte, ncloud)  ::     r3,a3
 !
       logical, dimension( its:ite )             ::         pblflg, &
                                                            sfcflg, &
@@ -908,10 +910,28 @@
           enddo
         enddo
       endif
+
+! copies here to avoid duplicate input args for tridin
+
+      do k = kts,kte
+        do i = its,ite
+          cu(i,k) = au(i,k)
+          r1(i,k) = a1(i,k)
+        enddo
+      enddo
+!
+      do ic = 1,ncloud
+        do k = kts,kte
+          do i = its,ite
+            r3(i,k,ic) = a3(i,k,ic)
+          enddo
+        enddo
+      enddo
+!
 !
 !     solve tridiagonal problem for heat and moisture, and clouds
 !
-      call tridin(al,ad,au,a1,a3,au,a1,a3,                 &
+      call tridin(al,ad,cu,r1,r3,au,a1,a3,                 &
                   its,ite,kts,kte,ncloud                   )
 !
 !     recover tendencies of heat and moisture
@@ -993,10 +1013,21 @@
           ad(i,k+1) = 1.-al(i,k)
         enddo
       enddo
+
+! copies here to avoid duplicate input args for tridin
+
+      do k = kts,kte
+        do i = its,ite
+          cu(i,k) = au(i,k)
+          r1(i,k) = a1(i,k)
+          r2(i,k) = a2(i,k)
+        enddo
+      enddo
+!
 !
 !     solve tridiagonal problem for momentum
 !
-      call tridin(al,ad,au,a1,a2,au,a1,a2,                 &
+      call tridin(al,ad,cu,r1,r2,au,a1,a2,                 &
                   its,ite,kts,kte,1                         )
 !
 !     recover tendencies of momentum
