subroutine day_gen i (nbt,jd,iyear,clt,tymax,timpkd,usdur,damt,ustpr,uxmav, i itype,ntd1, m ntd,moveto) c + + + PURPOSE + + + c To generate the Daily Outputs for CLIGEN. c c ----- Split out from the CLIGEN main module 10/1/99 by C. R. Meyer. c c + + + ARGUMENT DECLARATIONS + + + integer nbt,jd,iyear,itype,ntd1,ntd,moveto real tymax(4),timpkd(0:12),usdur,damt,ustpr,uxmav,clt c c + + + ARGUMENT DEFINITIONS + + + c nbt - Julian day of the year. c jd - Day of the Storm. c iyear - Beginning Simulation Year. c clt - 57.296 180/pi: deg -> radians convert; deg/clt -> radian c tymax(4) - upper limit of r5p (based on itype) c timpkd - The 12 interval time to peak accummulated distribution c parameters for the station. Cumulative distribution of c computed time to peak rainfall intensity values based on c NWS 15-minute rainfall data (section 2.1.4 WEPP tech 1995) c usdur - Storm Duration in Hours for Single Storm. c damt - Design Storm Amount in Inches for Single Storm. c ustpr - Time to Peak Intensity (% Duration e.g. .4). c uxmav - Maximum Intensity Inches/Hour for Single Storm. c itype - integer value [1..4] to set single storm parameters. c ntd - Days in this year; ie, 365 or 366. c moveto - A global flag. If set to 'XX' it means "goto XX". c c + + + COMMON BLOCKS + + + include 'cbk1.inc' c read: wv c modify: th,tdp c include 'cbk3.inc' c modify: ida c include 'cbk4.inc' c read: mo,iopt,dtp c include 'cbk7.inc' c read: k10,ra c write: nsim,msim c modify: tmxg,tmng c include 'cbk5.inc' c modify: r c include 'cbk9.inc' c read: r1 c include 'ccl1.inc' c write: prcip,tgmx,tgmn c modify: radg,dur c CC include 'ctap.inc' CC include 'ctap2.inc' c read: tap1, tap2, tap3, tap4, tap5, tap6 c include 'cinterp.inc' c c + + + LOCAL VARIABLES + + + c tpr - ratio of (time to rainfall peak)/(rainfall duration) c xmav - ratio of (max rainfall intensity)/(avg rainfall intensity) c r5p - apparently: max rainfall intensity; peak rainfall rate c (mm/h). (Yu's r_p): instantaneous peak intensity (mm/h) real xmav, r5p, tpr, xr integer i, irida, idr, itmxg, itmng c c c + + + FUNCTIONS CALLED + + + real timepk c + + + SUBROUTINES CALLED + + + c jlt c clgen c windg c alph c timepk c c + + + INPUT FORMATS + + + 1000 format(15x,3i5) c c + + + OUTPUT FORMATS + + + 2000 format(2i3,1x,i4,1x,f5.1,1x,f5.2,1x,f4.2,1x,f6.2,2(1x,f5.1), 1 1x,f4.0,1x,f4.1,2x,f4.0,1x,f5.1) c2001 format(i2,1x,6g17.9) 2001 format(i2,1x,6f17.13) c c + + + END SPECIFICATIONS + + + c c c Start of the Daily Generation Loop with nbt and ntd if(iopt.eq.4.or.iopt.eq.7) ntd=ntd1 ida=nbt 180 continue if(iopt.eq.6) then msim=0 nsim=0 moveto = 225 read(9,1000,end=199)irida,itmxg,itmng moveto = 0 199 continue if(moveto .eq. 0) then if(irida.eq.9999) nsim=1 if(itmxg.eq.9999) msim=1 if(itmng.eq.9999) msim=1 r(ida)=irida*.01 tmxg=itmxg tmng=itmng endif endif c ****** L1 ENDIF **** if(moveto .eq. 0) then idr=ida call jlt(ntd,idr,mo,jd) c -------- Interpolation Code inserted here. if(interp .eq. 1) then c-----------(compute lf, rf, & o_mo for current day) call lintrp(mo,jd,ntd) endif call clgen(ntd,iyear) call windg c c ----------- Output Standard Normal deviates for testing CLIGEN. c write(73,*) mo, tap1, tap2, tap3, tap4, tap5, tap6 CC write(73,2001) mo, tap1, tap2, tap3, tap4, tap5, tap6 c ----------- Output date and generated temps, rad & RF for testing CLIGEN. CC write(72,2223) mo,jd,iyear,tmxg,tmng,ra,r(ida) 2223 format(2i3,1x,i4,2(1x,f5.1),1x,f4.0,1x,f5.2) c th=th*clt prcip(mo,jd)=r(ida) c -------- generated max & min daily temp (F) tgmx(mo,jd)=tmxg tgmn(mo,jd)=tmng c -------- convert generated max & min daily temp from F to C. tmxg=(tmxg-32.0)*(5.0/9.0) tmng=(tmng-32.0)*(5.0/9.0) tdp = (tdp-32.0)*(5.0/9.0) radg(mo,jd)=ra if(r(ida).le.0.0) then r(ida)=0.0 dur(mo,jd)=0.0 else c call alph call alphb c ---------- Equation 2.1.6 c dur(mo,jd)=9.210/(-2.0*alog(1.0-r1)) c ---- This is the new cofficient 3.99 developed for the validation sites. c B.YU -- 6/99. dur(mo,jd) = 3.99/(-2.0*alog(1.0-r1)) c if(dur(mo,jd).gt.24.0) dur(mo,jd)=24.0 endif c c Set duration if a single storm is selected c c -- XXX -- Where is "RDUR" set? -- CRM -- 9/22/99 c -- Added initialization of RDUR to Zero: c rdur = 0.0 c if(iopt.eq.4.or.iopt.eq.7) dur(mo,jd)=rdur if(iopt.eq.4.or.iopt.eq.7) dur(mo,jd)=0.0 c ******** L2 IF **** if(iopt.ge.4) then if(r(ida).gt.0.) then c call alph call alphb xr=r(ida)*25.4 tpr=timepk(timpkd,k10) if(tpr.gt.0.99) tpr=0.99 c ------------ Equation 2.1.7 r5p=-2.0*xr*alog(1.0-r1) if(r5p.gt.tymax(itype)) r5p = tymax(itype) xmav=r5p/(xr/dur(mo,jd)) if((tmxg+tmng)/2.0.le.0.0) xmav = 1.01 if(xmav.lt.1.01) xmav =1.01 else xr=r(ida)*25.4 xmav=0.0 tpr=0.0 endif c -------- Change for new option 4 and 7 if(iopt.eq.4) then dur(mo,jd)=usdur xr=damt*25.4 tpr=ustpr xmav=(uxmav*25.4)/(xr/dur(mo,jd)) if(xmav.lt.1.01) xmav=1.01 else if(iopt.eq.7) then dur(mo,jd)=24. xr = damt*25.4 xmav=tymax(itype)/(xr/dur(mo,jd)) if(xmav.lt.1.01) xmav=1.01 tpr=dtp(itype) endif c c Write WEPP Continuous Storm File c Writes WEPP Single Storm when nbt=ndt write(7,2000) jd,mo,iyear,xr,dur(mo,jd),tpr, 1 xmav,tmxg,tmng,radg(mo,jd),wv,th,tdp c ******** L2 ENDIF **** endif c ****** L1 ENDIF **** endif c180 continue ida=ida+1 if(ida .le. ntd) goto 180 c c End of Daily Loop c c moveto = 0 c return end