c Water-Balance/Transfer-Function (WBTF) model for simulating c ground-water recharge in deep water-table settings. c c Use of this program described in the following USGS report: c O'Reilly, A.M., 2004, A method for simulating transient ground-water c recharge in deep water-table settings in central florida by using a c simple water-balance/transfer-function model: U.S. Geological Survey c Scientific Investigations Report 2004-5195, 49 p. c c This program is written in standard FORTRAN 90. c c This MAIN program calls subroutines to execute the model: c wbal.for -- Bucket model for water balance which simulates the c water storage capacity of the root zone and vegetative canopy c trfn.for -- Transfer function which simulates the traveltime of c effective infiltration from the bottom of the root zone to the c water table c gammln.for -- called by trfn.for to compute Gamma Function. c c Andrew M. O'Reilly c U.S. Geological Survey c Florida Integrated Science Center c 224 West Central Parkway, Suite 1006 c Altamonte Springs, FL 32714 c ph - 407.865.7575 c c Beta Versions: c ============== c v1.0 07/15/2002 - original code c 07/16/2002 - modified to read all input data from file c 07/19/2002 - added new output file rcfil2 which contains c response function (recharge) for times concurrent with driving c function (effective infiltration) c v4.1 11/15/2002 - modified trfn c v4.2 12/10/2002 - modified wbal and structure of input file c 03/11/2003 - minor modifications to trfn c v5.0 03/17/2003 - modified wbal and trfn so precip and ET (wbal) and c driving function (trfn) can use any constant time step for the c unit event length (formerly limited to daily unit event), involved c dropping date interpretation routines in date.for c - added new input variables required to convert unit event times c (t) in which the precip and ET data provided to real times (tr) in c which the output written (to files eifil, rchfil, rcfil2): c tr=t*truc+tri c truc = multiplier for unit conversion of unit event times c (e.g. hours) to a user desired real time (e.g. days) c tri = offset, representing real time for the first unit c event time (i.e. the first precip and ET records) c - moved reading of precip and ET files into main c 03/21/2003 - added user-specified averaging time step (dtravg) c to infil, dtravg is in real-time units (same units as tri) c v6.0 01/08/2004 - modified dtdrf to be the real-time time step of c the input data (previously, dtdrf=1 which required that precip and c et data provided in [L/T] units have a time step if 1 [T] unit, c e.g. if data provided in mm/hr, it must be in time step of 1 hr). c Accordingly, infil reformatted and dtdrf specified in it. Also, c 'unit-event length' now is defined as the time step at which the c response function is computed (dt) (previously, this had referred c to the time step at which data for the driving function was c provided (dtdrf)). c c Public Release Versions: c ======================== c v1.0 05/28/2004 - minor changes to format of Main Output File; read c Item 7 of Main Input File as N, TAUI, K (was N,K,TAUI) to be c consistent with documentation report c c c double precision xn,xk,tlagi,dtdrf,dt,truc,tri,dtravg character*128 rec character*50 infil,prefil,etfil,eifil,rchfil,rcfil2 character*25 version allocatable precip(:),et(:),ei(:) c version='Version 1.0 -- 05/28/2004' write(*,*) write(*,*) '**************************************************' write(*,*) '** Water-Balance/Transfer-Function (WBTF) model **' write(*,*) '*********** ',version,' ************' write(*,*) '**** For simulating ground-water recharge in *****' write(*,*) '************ deep water-table settings ***********' write(*,*) '**************************************************' write(*,*) c c Read input file c write(*,*) 'Enter name of input file:' read(*,*) infil open(unit=10,file=infil,status='old',err=98) read(10,*,err=98) prefil read(10,*,err=98) etfil read(10,*,err=98) eifil read(10,*,err=98) rchfil read(10,*,err=98) rcfil2 read(10,*,err=98) sti,stmax read(10,*,err=98) xn,tlagi,xk read(10,*,err=98) dtdrf,dt read(10,*,err=98) truc,tri,dtravg close(10) write(*,*) write(*,*) 'Time step of precip and ET data (DTPE) =',dtdrf write(*,*) 'Factor to convert time units (TRUC) =',truc write(*,*) 'Time of first precip and ET data record (TRI) =',tri write(*,*) c c Count number of data records in precip and ET files; allocate arrays c and fill with no-data value c open(unit=10,file=prefil,status='old') open(unit=30,file=etfil,status='old') iunit=10 do 10 i=1,2 m=0 20 read(iunit,'(a)',end=30) rec if (rec(1:1).eq.'#') then !must be 'non-data' record...skip goto 20 else m=m+1 goto 20 endif 30 if (i.eq.1) then mp=m write(*,*) 'Number of data records in precip file=',mp elseif (i.eq.2) then write(*,*) 'Number of data records in ET file:',m endif iunit=30 10 continue c if (mp.ne.m) then write(*,*) 'ERROR -- Precipitation and ET data must span same t &ime period' stop endif c ntsd=mp !this is # time steps spanned by drf write(*,*) allocate (precip(ntsd),et(ntsd),ei(ntsd)) do 40 m=1,ntsd precip(m)=-999. et(m)=-999. ei(m)=-999. 40 continue c c Read values of precip and ET c rewind(10) rewind(30) iunit=10 do 50 i=1,2 m=1 60 read(iunit,'(a)',end=70) rec if (rec(1:1).eq.'#') then !must be 'non-data' record...skip goto 60 else if (iunit.eq.10) then read(rec,*) dum,precip(m) elseif (iunit.eq.30) then read(rec,*) dum,et(m) endif m=m+1 goto 60 endif 70 iunit=30 50 continue close(10) close(30) c c Water-balance component c call wbal(eifil,sti,stmax,dtdrf,truc,tri,ntsd,precip,et,ei) c c Transfer-function component c call trfn(rchfil,rcfil2,xn,xk,tlagi,dtdrf,dt,truc,tri,dtravg, &ntsd,ei) goto 99 c 98 write(*,*) '***** Error opening/reading file: ',infil,' *****' stop 99 write(*,*) 'Normal termination of WBTF ',version end