c$Author: fredfox $ c$Date: 2001-11-21 22:58:07 $ c$Revision: 1.3 $ c$Source: /weru/cvs/weps/weps.src/manage/dogroup.for,v $ subroutine dogroup (sr) c + + + PURPOSE + + + c Dogroup reads in any coefficients associated with the group of c processes. c + + + KEYWORDS + + + c tillage, operation, management c + + + PARAMETERS AND COMMON BLOCKS + + + include 'p1werm.inc' include 'm1flag.inc' include 's1layr.inc' include 'c1db1.inc' include 'manage/man.inc' include 'manage/mproc.inc' include 'manage/oper.inc' c + + + ARGUMENT DECLARATIONS + + + integer sr c + + + ARGUMENT DEFINITIONS + + + c iunit - management file handle c sr - the subregion number 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 fracarea - fraction of area affected by process c + + + LOCAL VARIABLES + + + character*80 line character*1 grdumy integer temp c + + + SUBROUTINES CALLED + + + c + + + FUNCTION DECLARATONS + + + integer tillay integer skpnam integer lentrm c + + + DATA INITIALIZATIONS + + + c + + + END SPECIFICATIONS + + + 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 select case (grcode) 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 cropname = line(2:71) !at present, line ends with < symbol at 72 c 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 amdname = line(2:71) !at present, line ends with < symbol at 72 c 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 Error stops 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