subroutine getcli(ccd, ccm, ccy) C ***************************************************************** wjr C reads cligen file into common blocks and supplies cligen data to main C C Edit History C 09-Mar-99 wjr created C include 'p1werm.inc' include 'file.fi' include 'w1clig.inc' include 'm1sim.inc' include 'w1pavg.inc' c + + + LOCAL COMMON BLOCKS + + + include 'main/w1cli.inc' C C + + + Arguments + + + integer ccd,ccm,ccy C c + + + LOCAL VARIABLES + + + integer dayidx integer maxday character header*80 logical wrnflg integer ioc real dummy c wgrad - Global radiation (ly/day) as read in from CLIGEN. C c + + + FUNCTION DECLARATIONS + + + C data dayidx /0/ data wrnflg /.true./ C C skip header if (dayidx .ne. 0) goto 40 rewind luicli 10 do 20 dayidx=1,8 read(luicli, 1010, err=9000) header 1010 format (a80) 20 continue C C load data buffers if it is the first day of a year 40 if ((ccd .eq. 1) .and. (ccm .eq. 1)) then maxday = 365 C *** if (mod(ccy, 4) .eq. 0) maxday=366 do 30 dayidx=1,maxday ioc=0 read(luicli, *, iostat=ioc) & wcd(dayidx), wcm(dayidx), * wcy(dayidx),wwzdpt(dayidx),dummy,dummy,dummy, & wwtdmx(dayidx),wwtdmn(dayidx),wgrad(dayidx),dummy,dummy, * wwtdpt(dayidx) c 1030 format (2(2x,i2),1x,i4,1x,2f6.2,f5.2,1x,f6.2,3f7.2,f6.2, c * 2f7.2) if (ioc .eq. -1) then if ((ccd .eq. 1) .and. (ccm .eq. 1)) then rewind luicli write(6,2030) 2030 format (' warning !',24x,' day month year') write(6,2040) wcd(dayidx), wcm(dayidx), wcy(dayidx) 2040 format (' current CLIGEN date - ',i2,9x,i2, * 8x,i4,/,' is beyond the end of file - rewinding to top of ', * 'CLIGEN file',/) goto 10 else goto 9001 endif endif 30 continue dayidx = 1 endif c if (wrnflg) then if ((wcd(dayidx) .ne. ccd) .or. (wcm(dayidx) .ne. ccm) .or. * (wcy(dayidx) .ne. ccy)) then write (*,2010) 2010 format (' warning !',28x,' day month year') write (6,2020) wcd(dayidx), wcm(dayidx), wcy(dayidx), * ccd, ccm, ccy 2020 format (' current simulation date - ',i2,9x,i2, * 8x,i4,/,' does not match current CLIGEN date - ',i2,9x, * i2,8x,i4,/) wrnflg = .false. endif endif C *** ccd = wcd(dayidx) C *** ccm = wcm(dayidx) C *** ccy = wcy(dayidx) awzdpt = wwzdpt(dayidx) awtdmx = wwtdmx(dayidx) awtdmn = wwtdmn(dayidx) awtdpt = wwtdpt(dayidx) aweirr = wgrad(dayidx) * 0.04186 dayidx = dayidx + 1 c calculate air density from temperature and pressure awtdav = (awtdmx + awtdmn) / 2. awdair = 348.56 * (1.013-0.1183*(amzele/1000.) & + 0.0048 * (amzele/1000.)**2.) / (awtdav + 273.1) return C C error returns and stops C 9000 write(*,*) 'Unexpected error in cligen header' stop 1301 9001 write(*,*) 'Unexpected error reading cligen file day ', dayidx stop 1302 end