[WAM-IPE] WAM-IPE r91075: Update mediator to be the same as milestone 0.5

Samuel.Trahan at noaa.gov Samuel.Trahan at noaa.gov
Mon Apr 10 19:43:07 UTC 2017


Friendly WAM-IPE developers,

This is an automated email about a WAM-IPE commit.

Project: WAM-IPE
URL: https://svnemc.ncep.noaa.gov/projects/nems/branches/WAM-IPE/quasitrunk
Revision: 91075
Author:   robert.oehmke at noaa.gov
Date:     2017-04-10T19:31:20.954036Z
Message:
Update mediator to be the same as milestone 0.5


Differences:
Index: checkout/src/module_MEDIATOR_SpaceWeather.F90
===================================================================
--- checkout/src/module_MEDIATOR_SpaceWeather.F90	(revision 90318)
+++ checkout/src/module_MEDIATOR_SpaceWeather.F90	(revision 91075)
@@ -1405,8 +1405,8 @@
   real(ESMF_KIND_R8) :: hgt_prev, H_prev, data_prev
   real(ESMF_KIND_R8) :: hgt_curr, H_curr, data_curr
   real(ESMF_KIND_R8) :: H_avg
+  integer :: extrap_start_level
 
-
   rc = ESMF_SUCCESS
   R = 8.3141
   g0 = 9.80665
@@ -1413,6 +1413,9 @@
   re = 6.3712e03
   filename = 'wam2dmesh.nc'
 
+  ! The WAM source level above which extrapolation is used to compute the values in the fixed height grid
+  extrap_start_level=149  ! must be >=1 and <=inlevels
+
   !------------------------------------------------------------------------
   ! get global vm information
   !
@@ -1490,10 +1493,19 @@
          return  ! bail out
   localnodes=ubnd(1)-lbnd(1)+1
   totalnodes = localnodes * totallevels
+
+  ! Error check extrap start level
+  if ((extrap_start_level>inlevels) .or. &
+      (extrap_start_level<1)) then
+    call ESMF_LogSetError(ESMF_RC_VAL_OUTOFRANGE, & 
+                 msg="- extrap_start_level out of range") 
+    return
+  endif			       
+
   ! save the 149th level of temp field
   allocate(tempbuf(localnodes))
   do i=1,localnodes
-        tempbuf(i)=varbuf(i,ubnd(2))
+        tempbuf(i)=varbuf(i,extrap_start_level)
   enddo
 
 #if 0
@@ -1559,24 +1571,28 @@
                  do while (kk<=inlevels .and. hgtbuf(i,kk)<wamhgt(k))
 	            kk=kk+1
                  enddo
-	         if (kk>inlevels) then
-		    hgt_prev=hgtbuf(i,kk-1)
+	         if (kk>extrap_start_level) then
+		    hgt_prev=hgtbuf(i,extrap_start_level)
 		    dist=re/(re+hgt_prev)
                     H_prev=R*tempbuf(i)/(mass*g0*dist*dist)
-		    data_prev=varbuf(i,kk-1)
+		    data_prev=varbuf(i,extrap_start_level)
 
                     do l=k,wamdims(3) 
                        ! use the following equation:
-                       ! val(h) = val(150)*exp(h(150)-h)/H)
-                       !   Where H=R*T(150)/(mass*g)
-                       !   ‘h’ is the height in km
-                       !   h(150)= height at level 150 in km
-                       !   T(150)= temperature at level 150
+                       ! val(cur) = val(prev)*exp(h(prev)-h(cur))/H_avg)
+                       !   Where:
+                       !   H_avg=0.5*(H(prev)+H(cur))
+                       !   H(x)=R*T(esl)/(mass*g(x))
                        !   R=8.3141,  
                        !   mass=16,32,28 for O, O2 and N2, 
-                       !   g=g0(re/(re+h))^2
+                       !   g(x)=g0(re/(re+h(x)))^2
                        !   g0=9.80665
                        !   re=6.3712e+03
+                       !   h(prev)= height in km at the previous level
+                       !   val(prev)= value at the previous level
+                       !   h(cur)= height in km at the current level
+                       !   T(esl)= temperature at the extrap start level (temp values are extrapolated
+                       !            upwards by just copying the top level)
 
                        ! Calculate info for this level
                        hgt_curr=wamhgt(l)
@@ -1615,10 +1631,10 @@
                  do while (kk<=inlevels .and. hgtbuf(i,kk)<wamhgt(k))
 	            kk=kk+1
                  enddo
-	         if (kk>inlevels) then
+	         if (kk>extrap_start_level) then
                     do l=k,wamdims(3) ! use the value as the highest level in the source grid
                                       ! to fill the remaining levels in the destination
- 	               wamdata(i,l-startlevel+1)=varbuf(i,kk-1)
+ 	               wamdata(i,l-startlevel+1)=varbuf(i,extrap_start_level)
                     enddo
 	            exit
                  endif
-------------- next part --------------
Index: checkout/src/module_MEDIATOR_SpaceWeather.F90
===================================================================
--- checkout/src/module_MEDIATOR_SpaceWeather.F90	(revision 90318)
+++ checkout/src/module_MEDIATOR_SpaceWeather.F90	(revision 91075)
@@ -1405,8 +1405,8 @@
   real(ESMF_KIND_R8) :: hgt_prev, H_prev, data_prev
   real(ESMF_KIND_R8) :: hgt_curr, H_curr, data_curr
   real(ESMF_KIND_R8) :: H_avg
+  integer :: extrap_start_level
 
-
   rc = ESMF_SUCCESS
   R = 8.3141
   g0 = 9.80665
@@ -1413,6 +1413,9 @@
   re = 6.3712e03
   filename = 'wam2dmesh.nc'
 
+  ! The WAM source level above which extrapolation is used to compute the values in the fixed height grid
+  extrap_start_level=149  ! must be >=1 and <=inlevels
+
   !------------------------------------------------------------------------
   ! get global vm information
   !
@@ -1490,10 +1493,19 @@
          return  ! bail out
   localnodes=ubnd(1)-lbnd(1)+1
   totalnodes = localnodes * totallevels
+
+  ! Error check extrap start level
+  if ((extrap_start_level>inlevels) .or. &
+      (extrap_start_level<1)) then
+    call ESMF_LogSetError(ESMF_RC_VAL_OUTOFRANGE, & 
+                 msg="- extrap_start_level out of range") 
+    return
+  endif			       
+
   ! save the 149th level of temp field
   allocate(tempbuf(localnodes))
   do i=1,localnodes
-        tempbuf(i)=varbuf(i,ubnd(2))
+        tempbuf(i)=varbuf(i,extrap_start_level)
   enddo
 
 #if 0
@@ -1559,24 +1571,28 @@
                  do while (kk<=inlevels .and. hgtbuf(i,kk)<wamhgt(k))
 	            kk=kk+1
                  enddo
-	         if (kk>inlevels) then
-		    hgt_prev=hgtbuf(i,kk-1)
+	         if (kk>extrap_start_level) then
+		    hgt_prev=hgtbuf(i,extrap_start_level)
 		    dist=re/(re+hgt_prev)
                     H_prev=R*tempbuf(i)/(mass*g0*dist*dist)
-		    data_prev=varbuf(i,kk-1)
+		    data_prev=varbuf(i,extrap_start_level)
 
                     do l=k,wamdims(3) 
                        ! use the following equation:
-                       ! val(h) = val(150)*exp(h(150)-h)/H)
-                       !   Where H=R*T(150)/(mass*g)
-                       !   ‘h’ is the height in km
-                       !   h(150)= height at level 150 in km
-                       !   T(150)= temperature at level 150
+                       ! val(cur) = val(prev)*exp(h(prev)-h(cur))/H_avg)
+                       !   Where:
+                       !   H_avg=0.5*(H(prev)+H(cur))
+                       !   H(x)=R*T(esl)/(mass*g(x))
                        !   R=8.3141,  
                        !   mass=16,32,28 for O, O2 and N2, 
-                       !   g=g0(re/(re+h))^2
+                       !   g(x)=g0(re/(re+h(x)))^2
                        !   g0=9.80665
                        !   re=6.3712e+03
+                       !   h(prev)= height in km at the previous level
+                       !   val(prev)= value at the previous level
+                       !   h(cur)= height in km at the current level
+                       !   T(esl)= temperature at the extrap start level (temp values are extrapolated
+                       !            upwards by just copying the top level)
 
                        ! Calculate info for this level
                        hgt_curr=wamhgt(l)
@@ -1615,10 +1631,10 @@
                  do while (kk<=inlevels .and. hgtbuf(i,kk)<wamhgt(k))
 	            kk=kk+1
                  enddo
-	         if (kk>inlevels) then
+	         if (kk>extrap_start_level) then
                     do l=k,wamdims(3) ! use the value as the highest level in the source grid
                                       ! to fill the remaining levels in the destination
- 	               wamdata(i,l-startlevel+1)=varbuf(i,kk-1)
+ 	               wamdata(i,l-startlevel+1)=varbuf(i,extrap_start_level)
                     enddo
 	            exit
                  endif


More information about the WAM-IPE mailing list