[RegCNET] Re: Increasing output frequency (bugs)

Neil Davis nndavis at unity.ncsu.edu
Fri Mar 31 14:50:56 CEST 2006


I previously sent out a patch that allowed RegCM to output more than 
once an hour.  Unfortunatly I have recently found that that patch 
created some problems with the output of variables that are measured 
over time, such as rain being in mm/day.  I have gone back and made the 
necessary changes and have included them along with the original changes 
in the attached patch file.  The patch file updates 7 files from the 
original RegCM code to the new code they are:
 - grads_stuf.f
 - param.f
 - outtap.f
 - outtap0.f
 - zengocndrv.f
 - mkfile.f
 - interf.f
to apply the patch you just need to use the command
patch  -d default/Main < patch.regcm
where default/Main is your RegCM main directory.  Hope this helps.

Neil Davis
-------------- next part --------------
Common subdirectories: default/Main/Commons and synoptic/RegCM/Main/Commons
diff -uN default/Main/grads_stuf.f synoptic/RegCM/Main/grads_stuf.f
--- default/Main/grads_stuf.f	2006-03-31 07:38:43.000000000 -0500
+++ synoptic/RegCM/Main/grads_stuf.f	2006-03-28 12:04:11.000000000 -0500
@@ -144,19 +144,31 @@
       endif
       CALL FINDDATE(jbend,IDATE2)
       if(ldatez.EQ.IDATE0) then
-         number=(ibdyfrq/batfrq+0.00001)*(min0(jbend,mnend)-nbase)+1
+         number=(ibdyfrq*60./batfrq+0.00001)*(min0(jbend,mnend)-nbase)
+     &	 +1
       else
-         number=(ibdyfrq/batfrq+0.00001)*(min0(jbend,mnend)-nbase)
+         number=(ibdyfrq*60./batfrq+0.00001)*(min0(jbend,mnend)-nbase)
       endif
       ifrq=batfrq+0.00001
       if(ldatez.EQ.IDATE0) then
-         write(31,400)number,nhour     ,cday(nday),cmonth(month)
+        if(batfrq.le.90) then
+          write(31,401)number,nhour     ,cday(nday),cmonth(month)
      &               ,myear,ifrq
+        else
+          write(31,400)number,nhour     ,cday(nday),cmonth(month)
+     &               ,myear,(ifrq/60.)
+        endif
       else
-         write(31,400)number,nhour+ifrq,cday(nday),cmonth(month)
+        if(batfrq.le.90) then
+          write(31,401)number,nhour     ,cday(nday),cmonth(month)
      &               ,myear,ifrq
+        else
+          write(31,400)number,nhour     ,cday(nday),cmonth(month)
+     &               ,myear,(ifrq/60.)
+        endif
       endif
  400  format('tdef ',I4,' linear ',I2,'z',A2,A3,I4,' ',I2,'hr')
+ 401  format('tdef ',I4,' linear ',I2,'z',A2,A3,I4,' ',I2,'mn')
       if(iotyp.eq.2)  write(31,'(a)') 'theader 4'
       write(31,500) 21
  500  format('vars ',I2)
@@ -338,19 +350,31 @@
       endif
       CALL FINDDATE(jbend,IDATE2)
       if(ldatez.EQ.IDATE0) then
-         number=(ibdyfrq/batfrq+0.00001)*(min0(jbend,mnend)-nbase)+1
+         number=(ibdyfrq*60./batfrq+0.00001)*(min0(jbend,mnend)-nbase)
+     &	 +1
       else
-         number=(ibdyfrq/batfrq+0.00001)*(min0(jbend,mnend)-nbase)
+         number=(ibdyfrq*60./batfrq+0.00001)*(min0(jbend,mnend)-nbase)
       endif
       ifrq=batfrq+0.00001
       if(ldatez.EQ.IDATE0) then
-         write(31,400)number,nhour     ,cday(nday),cmonth(month)
+        if(batfrq.le.90) then
+          write(31,401)number,nhour     ,cday(nday),cmonth(month)
      &               ,myear,ifrq
+        else
+          write(31,400)number,nhour     ,cday(nday),cmonth(month)
+     &               ,myear,(ifrq/60)
+        endif
       else
-         write(31,400)number,nhour+ifrq,cday(nday),cmonth(month)
+        if(batfrq.le.90) then
+	   write(31,401)number,nhour     ,cday(nday),cmonth(month)
      &               ,myear,ifrq
+        else
+          write(31,400)number,nhour     ,cday(nday),cmonth(month)
+     &               ,myear,(ifrq/60)
+        endif
       endif
  400  format('tdef ',I4,' linear ',I2,'z',A2,A3,I4,' ',I2,'hr')
+ 401  format('tdef ',I4,' linear ',I2,'z',A2,A3,I4,' ',I2,'mn')
       if(iotyp.eq.2)  write(31,'(a)') 'theader 4'
       write(31,500) 16
  500  format('vars ',I2)
@@ -524,19 +548,31 @@
       endif
       CALL FINDDATE(jbend,IDATE2)
       if(ldatez.EQ.IDATE0) then
-         number=(ibdyfrq/tapfrq+0.00001)*(min0(jbend,mnend)-nbase)+1
+         number=(ibdyfrq*60./tapfrq+0.00001)*(min0(jbend,mnend)-nbase)
+     &	 +1
       else
-         number=(ibdyfrq/tapfrq+0.00001)*(min0(jbend,mnend)-nbase)
+         number=(ibdyfrq*60./tapfrq+0.00001)*(min0(jbend,mnend)-nbase)
       endif
       ifrq=tapfrq+0.00001
       if(ldatez.EQ.IDATE0) then
-         write(31,400)number,nhour     ,cday(nday),cmonth(month)
+         if(tapfrq.le.90) then
+	   write(31,401)number,nhour     ,cday(nday),cmonth(month)
      &               ,myear,ifrq
+         else
+	   write(31,400)number,nhour     ,cday(nday),cmonth(month)
+     &               ,myear,(ifrq/60)
+         endif
       else
-         write(31,400)number,nhour+ifrq,cday(nday),cmonth(month)
+        if(tapfrq.le.90) then
+	   write(31,401)number,nhour     ,cday(nday),cmonth(month)
      &               ,myear,ifrq
+         else
+	   write(31,400)number,nhour     ,cday(nday),cmonth(month)
+     &               ,myear,(ifrq/60)
+         endif
       endif
  400  format('tdef ',I4,' linear ',I2,'z',A2,A3,I4,' ',I2,'hr')
+ 401  format('tdef ',I4,' linear ',I2,'z',A2,A3,I4,' ',I2,'mn')
       if(iotyp.eq.2)  write(31,'(a)') 'theader 4'
       write(31,500) ntr + 5*ntr
  500  format('vars ',I2)
@@ -842,19 +878,31 @@
       endif
       CALL FINDDATE(jbend,IDATE2)
       if(ldatez.EQ.IDATE0) then
-         number=(ibdyfrq/tapfrq+0.00001)*(min0(jbend,mnend)-nbase)+1
+         number=(ibdyfrq*60./tapfrq+0.00001)*(min0(jbend,mnend)-nbase)
+     &	 +1
       else
-         number=(ibdyfrq/tapfrq+0.00001)*(min0(jbend,mnend)-nbase)
+         number=(ibdyfrq*60./tapfrq+0.00001)*(min0(jbend,mnend)-nbase)
       endif
       ifrq=tapfrq+0.00001
       if(ldatez.EQ.IDATE0) then
-         write(31,400)number,nhour     ,cday(nday),cmonth(month)
+         if(tapfrq.le.90) then
+	   write(31,401)number,nhour     ,cday(nday),cmonth(month)
      &               ,myear,ifrq
+         else
+	   write(31,400)number,nhour     ,cday(nday),cmonth(month)
+     &               ,myear,(ifrq/60)
+         endif
       else
-         write(31,400)number,nhour+ifrq,cday(nday),cmonth(month)
+        if(tapfrq.le.90) then
+	   write(31,401)number,nhour     ,cday(nday),cmonth(month)
      &               ,myear,ifrq
+        else
+	   write(31,400)number,nhour     ,cday(nday),cmonth(month)
+     &               ,myear,(ifrq/60)
+        endif
       endif
  400  format('tdef ',I4,' linear ',I2,'z',A2,A3,I4,' ',I2,'hr')
+ 401  format('tdef ',I4,' linear ',I2,'z',A2,A3,I4,' ',I2,'mn')
       if(iotyp.eq.2) write(31,'(a)') 'theader 4'
       write(31,500) 10
  500  format('vars ',I2)
@@ -1021,19 +1069,31 @@
       endif
       CALL FINDDATE(jbend,IDATE2)
       if(ldatez.EQ.IDATE0) then
-         number=(ibdyfrq/radisp+0.00001)*(min0(jbend,mnend)-nbase)+1
+         number=(ibdyfrq*60./radisp+0.00001)*(min0(jbend,mnend)-nbase)
+     &	 +1
       else
-         number=(ibdyfrq/radisp+0.00001)*(min0(jbend,mnend)-nbase)
+         number=(ibdyfrq*60./radisp+0.00001)*(min0(jbend,mnend)-nbase)
       endif
       ifrq=radisp+0.00001
       if(ldatez.EQ.IDATE0) then
-         write(31,400)number,nhour     ,cday(nday),cmonth(month)
+         if(radisp.le.90) then
+	   write(31,401)number,nhour     ,cday(nday),cmonth(month)
      &               ,myear,ifrq
+         else
+	   write(31,400)number,nhour     ,cday(nday),cmonth(month)
+     &               ,myear,(ifrq/60)
+         endif
       else
-         write(31,400)number,nhour+ifrq,cday(nday),cmonth(month)
+        if(radisp.le.90) then
+	   write(31,401)number,nhour     ,cday(nday),cmonth(month)
      &               ,myear,ifrq
+        else
+	   write(31,400)number,nhour     ,cday(nday),cmonth(month)
+     &               ,myear,(ifrq/60)
+        endif
       endif
  400  format('tdef ',I4,' linear ',I2,'z',A2,A3,I4,' ',I2,'hr')
+ 401  format('tdef ',I4,' linear ',I2,'z',A2,A3,I4,' ',I2,'mn')
       if(iotyp.eq.2) write(31,'(a)') 'theader 4'
       write(31,500) 13
  500  format('vars ',I2)
diff -uN default/Main/interf.f synoptic/RegCM/Main/interf.f
--- default/Main/interf.f	2006-03-31 07:38:43.000000000 -0500
+++ synoptic/RegCM/Main/interf.f	2006-03-31 06:50:20.000000000 -0500
@@ -217,12 +217,12 @@
          if (ktau.le.1) then
            mmpd = 86400./dtbat
            wpm2 = 1./dtbat
-         else if (real(ktau*dtmin).le.batfrq*60.+0.01) then
-           mmpd = 24./(batfrq-dtmin/60.)
-           wpm2 = 1./((batfrq-dtmin/60.)*3600.)
+         else if (real(ktau*dtmin).le.batfrq+0.01) then
+           mmpd = 24./(batfrq/60.-dtmin/60.)
+           wpm2 = 1./((batfrq/60.-dtmin/60.)*3600.)
          else
-           mmpd = 24./batfrq
-           wpm2 = 1./(batfrq*3600.)
+           mmpd = 24./(batfrq/60.)
+           wpm2 = 1./(batfrq*60.)
          end if
          do i=np1,nbmax
            u10m_o(j-1,i-1)=0.0
diff -uN default/Main/mkfile.f synoptic/RegCM/Main/mkfile.f
--- default/Main/mkfile.f	2006-03-31 07:38:43.000000000 -0500
+++ synoptic/RegCM/Main/mkfile.f	2006-03-31 07:00:42.000000000 -0500
@@ -263,10 +263,10 @@
         OPEN(99,FILE=filnam1,FORM='FORMATTED'
      &      ,STATUS='unknown')
         nline = 0
-        dto = tapfrq
-        dtb = batfrq
-        dtr = radisp
-        dtc = chemfrq
+        dto = tapfrq/60.
+        dtb = batfrq/60.
+        dtr = radisp/60.
+        dtc = chemfrq/60.
         a78 = 'cccc SET DOMAIN DIMENSIONS'
         write(99,105)a78
         a78 = 'cccc ny = number of north-south points'
diff -uN default/Main/outtap0.f synoptic/RegCM/Main/outtap0.f
--- default/Main/outtap0.f	2006-03-31 07:38:43.000000000 -0500
+++ synoptic/RegCM/Main/outtap0.f	2006-03-31 07:01:07.000000000 -0500
@@ -34,10 +34,10 @@
       do k=1,kxp1
         sp1d(k) = sigma(kxp1-k+1)
       end do
-      dto = tapfrq
-      dtb = batfrq
-      dtr = radisp
-      dtc = chemfrq
+      dto = tapfrq/60.
+      dtb = batfrq/60.
+      dtr = radisp/60.
+      dtc = chemfrq/60.
       write (20,rec=1) mdate0,ibltyp,icup,ipptls,iboudy
      &    , il,jl,kl,sp1d,dxsp,ptsp,clat,clon,plat,plon,proj
      &    , dto,dtb,dtr,dtc,iotyp
diff -uN default/Main/outtap.f synoptic/RegCM/Main/outtap.f
--- default/Main/outtap.f	2006-03-31 07:38:43.000000000 -0500
+++ synoptic/RegCM/Main/outtap.f	2006-03-31 06:57:49.000000000 -0500
@@ -134,7 +134,7 @@
 c     elseif (iotyp.eq.2) then
 c       write(iutdat) fout
 c     end if
-      mmpd = 24./tapfrq
+      mmpd = 24./(tapfrq/60.)
       do i=1,ix-2
       do j=1,jx-2
         fout(j,i) = (rainc(i+1,j+1)+rainnc(i+1,j+1))*mmpd
diff -uN default/Main/param.f synoptic/RegCM/Main/param.f
--- default/Main/param.f	2006-03-31 07:38:43.000000000 -0500
+++ synoptic/RegCM/Main/param.f	2006-03-28 08:06:14.000000000 -0500
@@ -249,13 +249,13 @@
 c
       rfstrt = .false.      ! *
       ifsave = .false.
-         savfrq = 6.
+         savfrq = 2880.      ! time interval for creating save file (min)
       iftape = .true.
-         tapfrq = 6.
+         tapfrq = 360.0   ! time interval for disposing atm output (min)
       ifrad = .true.
-         radisp = 6.0    ! time interval for disposing rad output (hrs)
+         radisp = 360.0    ! time interval for disposing rad output (min)
       ifbat = .true.
-        batfrq = 1.0    ! time interval for disposing bats output (hrs)
+        batfrq = 180.0    ! time interval for disposing bats output (min)
       ifsub = .true.
       ifprt  = .true.
          prtfrq =  12.
@@ -267,7 +267,7 @@
 
 Cchem2
       ifchem=.false.
-      chemfrq = 6.0   ! time interval for disposeing chem output (hrs)
+      chemfrq = 360.0   ! time interval for disposeing chem output (min)
 Cchem2_
 
 c
@@ -375,10 +375,10 @@
          print*,'ABATM=',abatm,'DT=',dt
          stop 'Surface Timestep (param.f)'
       end if
-      if (mod(anint(batfrq*3600.),anint(abatm)).ne.0) then
+      if (mod(anint(batfrq*60.),anint(abatm)).ne.0) then
          print*,'INCONSISTENT TIMESTEPS SPECIFIED'
          print*,'BATFRQ=',batfrq,'ABATM=',abatm
-         stop 'Surface/Radiation Timestep (param.f)'
+         stop 'Surface/Output Timestep (param.f)'
       end if
       if (mod(anint(abemh*3600.),anint(dt)).ne.0) then
          print*,'INCONSISTENT TIMESTEPS SPECIFIED'
@@ -393,9 +393,33 @@
 
 c-----reset the options/calculate variables using namelist info:
 c
-      nsavfrq = nint(3600.*savfrq)
-      ntapfrq = nint(3600.*tapfrq)
-      nprtfrq = nint(3600.*prtfrq)
+c ----- Test output frequency to determine if it is less than 90
+c       where it can be output in minutes otherwise it has to be whole
+c       hour values
+      if (tapfrq.gt.90.) then
+        if(mod(nint(tapfrq),60).ne.0.) then
+	  stop 'ATM output greater than 1.5 hours and not on a whole hour'
+	endif
+      endif
+      if (batfrq.gt.90.) then
+        if(mod(nint(batfrq),60).ne.0.) then
+	  stop 'SRF Output greater than 1.5 hours and not on a whole hour'
+	endif
+      endif
+      if (radisp.gt.90.) then
+        if(mod(nint(radisp),60).ne.0.) then
+	  stop 'RAD Output greater than 1.5 hours and not on a whole hour'
+	endif
+      endif
+      if (chemfrq.gt.90.) then
+        if(mod(nint(chemfrq),60).ne.0.) then
+	  stop 'CHE Output greater than 1.5 hours and not on a whole hour'
+	endif
+      endif
+c Convert save, ATM, and print output frequency from min to sec
+      nsavfrq = nint(60.*savfrq)
+      ntapfrq = nint(60.*tapfrq)
+      nprtfrq = nint(60.*prtfrq)
       ktau = 0
       xtime = 0.
       ntime = 0
@@ -406,14 +430,14 @@
       enddo
       print *,' dtau = ', dtau
       dt0 = dt      !store original dt
-      maschk=nint(prtfrq*3600./dt) !convert prtfrq to #of time steps
-      nradisp=nint(radisp*3600) !convert radisp to time steps
+      maschk=nint(prtfrq*60./dt) !convert prtfrq to #of time steps
+      nradisp=nint(60.*radisp) !convert radisp to time steps
       ifrabe=nint(3600.*abemh/dt)  !abemh is time interval abs./emis. calc.
-      kbats = nint(3600.*batfrq)
+      kbats = nint(60.*batfrq)
       nbatst=nint(abatm/dt)
       dt2 = 2.*dt
 Cchem2
-      kchem = nint(3600.*chemfrq)  ! convert chemfrq to time steps
+      kchem = nint(60.*chemfrq)  ! convert chemfrq to time steps
 Cchem2_
 c.....calculate the time step in minutes.
       dtmin = dt/60.
diff -uN default/Main/zengocndrv.f synoptic/RegCM/Main/zengocndrv.f
--- default/Main/zengocndrv.f	2006-03-31 07:38:43.000000000 -0500
+++ synoptic/RegCM/Main/zengocndrv.f	2006-03-31 06:59:13.000000000 -0500
@@ -45,12 +45,12 @@
             if (ktau.le.1) then
               mmpd = 86400./dtbat
               wpm2 = 1./dtbat
-            else if (real(ktau*dtmin).le.batfrq*60.+0.01) then
-              mmpd = 24./(batfrq-dtmin/60.)
-              wpm2 = 1./((batfrq-dtmin/60.)*3600.)
+            else if (real(ktau*dtmin).le.batfrq+0.01) then
+              mmpd = 24./(batfrq/60.-dtmin/60.)
+              wpm2 = 1./((batfrq/60.-dtmin/60.)*3600.)
             else
-              mmpd = 24./batfrq
-              wpm2 = 1./(batfrq*3600.)
+              mmpd = 24./(batfrq/60.)
+              wpm2 = 1./(batfrq*60.)
             end if
             facttq = dlog(z995/2.)/dlog(z995/zo)
             u10m1d(n,i) = ubx3d(i,kl,j)*uv10/uv995


More information about the RegCNET mailing list