[Wrf-users] Minor bug found in Grell-Devenyi cumulus scheme (WRF 3.2.1 and WRF 3.3)
Kemp, Eric M. (GSFC-610.3)[NORTHROP GRUMMAN]
eric.kemp at nasa.gov
Fri Sep 2 11:17:50 MDT 2011
All:
I’ve found a minor bug in the Grell-Devenyi cumulus scheme while running a test domain including the Himalayas and with run time checking turned on. The relevant code is in lines 261-276 of module_cu_gd.F:
do k= kts+1,ktf-1
DO I = its,itf
if((p2d(i,1)-p2d(i,k)).gt.150.and.p2d(i,k).gt.300)then
dp=-.5*(p2d(i,k+1)-p2d(i,k-1))
umean(i)=umean(i)+us(i,k)*dp
vmean(i)=vmean(i)+vs(i,k)*dp
pmean(i)=pmean(i)+dp
endif
enddo
enddo
DO I = its,itf
umean(i)=umean(i)/pmean(i)
vmean(i)=vmean(i)/pmean(i)
direction(i)=(atan2(umean(i),vmean(i))+3.1415926)*57.29578
if(direction(i).gt.360.)direction(i)=direction(i)-360.
ENDDO
p2d is the 2D slab of pressure in mb. Pmean is an average pressure thickness of model levels below the 300 mb level and 150 mb above the model level closest to the ground. Pmean is initialized to zero earlier in the routine. In my test run, I encountered a situation in the Himalayas where the pmean value is not updated, triggering a division-by-zero error in the umean, vmean, and direction calculations. My suggested bug fix is:
DO I = its,itf
!EMK Bug fix
if (pmean(i) > 0) then
umean(i)=umean(i)/pmean(i)
vmean(i)=vmean(i)/pmean(i)
direction(i)=(atan2(umean(i),vmean(i))+3.1415926)*57.29578
if(direction(i).gt.360.)direction(i)=direction(i)-360.
end if
!EMK END Bug fix
ENDDO
Note that umean and vmean are only used to calculate direction, and direction is initialized as zero. It does not appear that this direction variable is actually used anywhere else in the code (code fragments that did use it are all commented out), so this is a minor bug and bug fix that shouldn’t change simulation results. Nonetheless I suggest fixing it, since it can interfere with run-time checks for other errors (as it did in my test case!) and it could slow down the simulation by producing NaNs.
-Eric
--------------------------------------------------------------------
Eric M. Kemp Northrop Grumman Corporation
Meteorologist Information Systems
Civil Enterprise Solutions Civil Systems Division
Goddard Space Flight Center
Mailstop 610.3
Greenbelt, MD 20771
Telephone 301-286-9768
Fax 301-286-1775
E-mail: eric.kemp at nasa.gov
E-mail: eric.kemp at ngc.com
--------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/wrf-users/attachments/20110902/5784d085/attachment.html
More information about the Wrf-users
mailing list