c c subroutine dogroup (sr) c c + + + PURPOSE + + + c Dogroup reads in any coefficients associated with the group of c processes. C C Edit History C 18-Feb-99 wjr changed prcode to select statement C 19-Feb-99 wjr removed iunit from param C 19-Feb-99 wjr added error stops on reads C 20-Feb-99 wjr used skpnam to parse tbl lines c c + + + KEYWORDS + + + c tillage, operation, management c c + + + PARAMETERS AND COMMON BLOCKS + + + *$noereference include 'p1werm.inc' include 'm1flag.inc' include 's1layr.inc' include 'c1db1.inc' include 'manage/man.inc' include 'manage/mproc.inc' include 'manage/oper.inc' *$reference c c + + + ARGUMENT DECLARATIONS + + + integer sr c c + + + ARGUMENT DEFINITIONS + + + c iunit - management file handle c sr - the subregion number c c + + + ACCESSED COMMON BLOCK VARIABLE DEFINITIONS + + + c cropno - number that identifies the crop to be sown c tdepth - tillage depth (m) c trdflg - tillage ridge flag c ti - tillage intensity (fraction) c c fracarea - fraction of area affected by process c c + + + LOCAL VARIABLES + + + character*80 line character*1 grdumy c c + + + SUBROUTINES CALLED + + + c c + + + FUNCTION DECLARATONS + + + integer tillay integer skpnam integer lentrm c c + + + DATA INITIALIZATIONS + + + c c + + + END SPECIFICATIONS + + + C line = mtbl(mcur(sr)) read(line, 1001, err=901) grdumy, grcode, grname 1001 format(a1,1x,i2,1x,a) C*** print*, 'SR',sr,' Processing process:', grcode,' ',grname c select case (grcode) c case (1) c-----START tillage process (process code 01) c get process parameters c get additional line of data mcur(sr) = mcur(sr) + 1 line = mtbl(mcur(sr)) c read tillage depth, intensity and area read(line(2:lentrm(line)), *, err=901) * tdepth, ti, fracarea, tstddepth, tmindepth, tmaxdepth C c rtn=getr(iunit, sr, trdflg,trdflg,trdflg,1,'i') c expected last parameter for process, thus mlpos==0 C *** if (getr(iunit,sr,fracarea,fracarea,fracarea,1,'r').gt.0) then C *** print*,'ERROR in doproc ',prcode C *** stop C *** endif c pre-process stuff tlayer = tillay(tdepth, aszlyt(1,sr), nslay(sr)) c do process (usually just processes or other operations) c post-process stuff c-----END tillage process (process code 01) case (2) c-----START biomass manipulation process (process code 02) c get process parameters c rtn = getr(iunit, sr, bioflg,bioflg,bioflg,1,'i') c expected last parameter for process, thus mlpos==0 c get additional line of data mcur(sr) = mcur(sr) + 1 line = mtbl(mcur(sr)) c read biomass area affected read(line(2:lentrm(line)), *, err=901) fracarea C *** if (getr(iunit,sr,fracarea,fracarea,fracarea,1,'r').gt.0) then C *** print*,'ERROR in doproc ',prcode C *** stop C *** endif c pre-process stuff c do process (should include a tillage operation) c post-process stuff c-----END biomass manipulation process (process code 02) case (3) c-----START grow process (process code 03) c get process parameters c expected last parameter for process, thus mlpos==0 c get additional line of data mcur(sr) = mcur(sr) + 1 line = mtbl(mcur(sr)) c read crop name read(line(2:lentrm(line)),*, err=901) cropname C *** if (getr(iunit, sr, cropname,cropname,cropname,1,'c').gt.0) then C *** print*,'ERROR in doproc ',prcode C *** stop C *** endif c pre-process stuff c do process (should include a tillage operation) c post-process stuff c-----END grow process (process code 03) case (4) c-----START ammend process (process code 04) C *** 04 continue c get process parameters c expected last parameter for process, thus mlpos==0 c get additional line of data mcur(sr) = mcur(sr) + 1 line = mtbl(mcur(sr)) c read amendment name read(line(2:lentrm(line)),*, err=901) amdname C *** if (getr(iunit, sr, amdname,amdname,amdname,1,'c').gt.0) then C *** print*,'ERROR in doproc ',prcode C *** stop C *** endif c pre-process stuff c do process (could include a tillage operation) c post-process stuff c-----END ammend process (process code 04) case default goto 902 end select return C C Error stops C 901 write(*, 9901) line 9901 format('Error in procedure line ', a) stop 1004 902 write(*, 9902) line 9902 format('Bad procedure type ', a) stop 1004 end