c subroutine doproc (sr) c c + + + PURPOSE + + + c Doproc is called when a processline is found in the management file c Doproc reads in any coefficients associated with the c process. Doproc then makes a call to a subroutine which, in turn, c modifies the state variables to mimic the processes of doing the c process. C C Edit History C 19-Feb-99 wjr put selection into case statement C 19-Feb-99 wjr removed iunit; cvt to using mtbl C 20-Feb-99 wjr used skpnam to parse tbl lines C c c + + + KEYWORDS + + + c tillage, process, management c c + + + PARAMETERS AND COMMON BLOCKS + + + include 'p1werm.inc' include 'p1unconv.inc' include 'm1flag.inc' include 'm1sim.inc' include 'm1dbug.inc' include 's1layr.inc' include 's1layd.inc' include 's1agg.inc' include 's1sgeo.inc' include 's1phys.inc' include 's1surf.inc' include 's1dbh.inc' include 's1dbc.inc' include 'c1gen.inc' include 'c1db1.inc' include 'c1db2.inc' include 'c1db3.inc' include 'c1glob.inc' include 'c1info.inc' include 'd1glob.inc' include 'd1gen.inc' include 'h1hydro.inc' include 'h1db1.inc' include 'decomp/decomp.inc' include 'manage/oper.inc' include 'manage/asd.inc' include 'manage/man.inc' include 'manage/harv.inc' include 'manage/mproc.inc' include 'manage/tcrop.inc' c c + + + ARGUMENT DECLARATIONS + + + integer sr c + + + ARGUMENT DEFINITIONS + + + c sr - the number of subregions c c + + + ACCESSED COMMON BLOCK VARIABLE DEFINITIONS + + + c c acdpop - crop seeding density c acrlai - crop leaf area index c aheaep - soil air entery potential c ahrwc - soil water content (mass bases) c ahrwca - available soil water content c ahrwcf - 1/3 bar soil water content c ahrwcs - saturation soil water content c ahrwcw - 15 bar soil water content c am0cgf - flag to call crop growth between plant and harvest c am0hrvfl - flag to determine if the crop is perennial and killed c during a harvest. Values are c 0 - no harvesting being done c 1 - perennial crop which is NOT killed c 2 - annual crop which is killed c am0tdb - flag for outputing debug information to a file c 0 - no output c 1 - output to file ../out/tdbug.out c am0tfl - flag for outputing management operations to a file c 0 - no output c 1 - output to file ../out/manage.out c as0ags - aggr. size geom. mean std. dev. c as0ph - soil Ph c asargo - ridge orientation (clockwise from true North) (degrees) c ascmg - magnesium ion concentration c ascna - sodium ion concentration c asdadg - aggregrate density c asdblk - soil layer bulk density c aseags - dry aggregrate stability c asfcce - fraction of calcium carbonate c asfcec - cation exchange capcity c asfcla - fraction of clay c asfesp - exchangable sodium percentage c asfnoh - organic N concentration of humus c asfom - fraction of organic matter c asfpoh - organic P concentration of humus c asfpsp - fraction of fertilizer P that is labile c asfsan - fraction of sand c asfsil - fraction of silt c asfsmb - sum of bases c aslagm - aggr. size geom. mean diameter (mm) c aslagn - min. aggr. size of each layer (mm) c aslagx - max aggr. size of each layer (mm) c aslrr - Allmaras random roughness parameter (mm) c asxrgs - ridge spacing (mm) c asxrgw - ridge width (mm) c aszlyt - soil layer thickness (mm) c aszrgh - ridge height (mm) c prcode - the process id number c prname - the process name c + + + LOCAL VARIABLES + + + integer flag,rdgflag,cutflg real massf (msieve+1,mnsz) real alpha, beta, mu, rho real rrimpl c real intens, rrimpl real kappa real thinval real tibcp real grainf,cropf,standf,decompf,bgf real rdght,rdgwt,rdgspac,dikeht,dikespac real af,cf,mf real afvt(5), mfvt(5) integer burydistflg real irrig real rdght1 character*1 prdumy character*80 line integer idx, thinflg real dmassres, zmassres, dmassrot, zmassrot c c + + + LOCAL VARIABLE DEFINITIONS + + + c c alpha - parameter reflecting the breakage of all soil c aggregrates regardless of size c beta - parameter reflecting the uneveness of breakage among c aggregrates in different size classes c bgf - percent of below ground mass to be removed c buryf - fraction of mass to be buried c cropf - percent of crop to be removed c kappa - fraction of the crust destroyed during a tillage operation c decompf - percent if decomp pool material to be removed c dikeht - dike height (mm) c dikespac - dike spacing (mm) c flag - flag used in the remove subroutine which determines c what needs to be removed c fltcoef - flattening coefficient of an implement c grainf - percent of grain to be removed c harvflag - flag indicating a harvest c intens - tillage intensity factor c liftf - fraction of mass to be lifted c massf - mass fractions of aggregrates within sieve cuts c (sum of all the mass fractions are expected to be 1.0) c tarea - fraction of the surface tilled c rdght - ridge height (mm) c rdght1 - tmp variable - ridge height (mm) c rdgflag - flag indicating whether ridge modifications are needed c rdgspac - ridge spacing (mm) c rdgwt - ridge top width (mm) c rrimpl - assigned nominal RR value for the tillage operation (mm) c tibcp - tillage intensity factor used for below tillage compaction c mu - loosening coefficient (0 <= mu <= 1) c rho - mixing coefficient (0 <= rho <= 1) c irrig - irrigation quantity for a day (mm) c dmassres - Buried crop residue mass(kg/m^2) c zmassres - depth in soil of Buried crop residue mass (mm) c dmassrot - Buried root residue mass(kg/m^2) c zmassrot - depth in soil of Buried root residue mass (mm) c c + + + SUBROUTINES CALLED + + + c c asd2m - aggregate size distribution to mass fraction converter c burylift - performs the biomass transfer either into the soil c or from the soil to the surface (deals with decomp c pools only c crush - the crushing process c crust - destroys a cursted surface depending on the operation that c is performed c invert - performs an inversion of the vertical soil layers c loosn - performs the loosen/compact process c m2asd - mass fraction to aggregate size distribution converter c mix - mixes components in specified layers c orient - calculates the oriented roughness c remove - performs the biomass removal during a harvest, burn, etc. c and updates the decomposition pools accordingly. c rough - calculated the post tillage random roughness c tdbug - subroutine which writes out variables for debugging purposes c c + + + FUNCTION DECLARATONS + + + integer tillay integer skpnam integer lentrm c c + + + DATA INITIALIZATIONS + + + c None c c + + + OUTPUT FORMATS + + + 2015 format (' Process code ',i2,1x,'Process ',1x,a20 ) c c + + + END SPECIFICATIONS + + + data massf /110*0/ line = mtbl(mcur(sr)) read(line, 1001, err=901) prdumy, prcode, prname 1001 format(a1,1x,i2,1x,a) C if (am0tfl .eq. 1) write (15,2015) prcode,prname C C*** print*, 'SR',sr,' Performing process:', C*** & prcode,' ',prname c Default all flatten, bury, and lift processes to "all" biomass c for now. bioflg = 15 c c process calls follow select case (prcode) C case (1) c-----START crust breakdown process (process code 01) c pre-process stuff kappa = 1.0 ! *** NOTE that kappa is NOT being read from file if (am0tdb .eq. 1) then write (29,*) write (29,*) '//Before crust breakdown process//' call tdbug(sr, nslay(sr),prcode) end if am0til = .true. !set flag for surface modification c do process call crust(kappa,tarea,asfcr(sr),asflos(sr),asmlos(sr)) c post-process stuff if (am0tdb .eq. 1) then write (29,*) '//After crust breakdown process//' call tdbug(sr, nslay(sr),prcode) end if c-----END crust breakdown process (process code 01) case (2) c-----START random roughness process (process code 02) c pre-process stuff if (am0tdb .eq. 1) then write (29,*) write (29,*) '//Before random roughness process//' call tdbug(sr, nslay(sr),prcode) end if c read the random roughness for the implement. tillage intensity c factor, and the fraction of the surface tilled come in as group parameter c get additional line of data mcur(sr) = mcur(sr) + 1 line = mtbl(mcur(sr)) read(line(2:lentrm(line)),* , err=901) rrimpl am0til = .true. !set flag for surface modification c do process call rough(rrimpl,ti,tarea,aslrr(sr)) c post-process stuff if (am0tdb .eq. 1) then write (29,*) '//After random roughness process//' call tdbug(sr, nslay(sr),prcode) end if c-----END random roughness process (process code 02) case (3) c-----START oriented roughness ridge only process (process code 03) c pre-process stuff if (am0tdb .eq. 1) then write (29,*) write (29,*) '//Before oriented roughness1 process//' call tdbug(sr, nslay(sr),prcode) end if c read the oriented roughness (ridge) parameters for the implement c get additional line of data mcur(sr) = mcur(sr) + 1 line = mtbl(mcur(sr)) read(line(2:lentrm(line)),* , err=901) & rdgflag, rdght, rdgspac, rdgwt rdght1 = aszrgh(sr) !keep initial ridge height value am0til = .true. !set flag for surface modification c do process call orient1(aszrgh(sr),asxrgw(sr),asxrgs(sr),asargo(sr), & rdght,rdgwt,rdgspac,odir,tdepth,rdgflag) c post-process stuff !if the ridge height changed or is very small, !then assume any dikes got destroyed if (rdght1 .ne. aszrgh(sr) .or. (aszrgh(sr) .le. 0.1)) then asxdkh(sr) = 0.0 asxdks(sr) = 0.0 end if if (am0tdb .eq. 1) then write (29,*) '//After oriented roughness process//' call tdbug(sr, nslay(sr),prcode) end if c-----END oriented roughness process (process code 03) case (4) c-----START oriented roughness process dike only (process code 04) c pre-process stuff if (am0tdb .eq. 1) then write (29,*) write (29,*) '//Before oriented roughness2 process//' call tdbug(sr, nslay(sr),prcode) end if c read the oriented roughness (dike) parameters for the implement mcur(sr) = mcur(sr) + 1 line = mtbl(mcur(sr)) read(line(2:lentrm(line)),* , err=901) * rdgflag, dikeht, dikespac c NOTE: we don't need rdgflag anymore - LEW am0til = .true. !set flag for surface modification c do process call orient2(asxdkh(sr),asxdks(sr),dikeht,dikespac) c post-process stuff if (am0tdb .eq. 1) then write (29,*) '//After oriented roughness process//' call tdbug(sr, nslay(sr),prcode) end if c-----END oriented roughness dike only process (process code 04) case (5) c-----START oriented roughness process (process code 05) c pre-process stuff if (am0tdb .eq. 1) then write (29,*) write (29,*) '//Before oriented roughness process//' call tdbug(sr, nslay(sr),prcode) end if c read the oriented roughness parameters for the implement mcur(sr) = mcur(sr) + 1 line = mtbl(mcur(sr)) read(line(2:lentrm(line)),* , err=901) * rdgflag, rdght, rdgspac, rdgwt, dikeht, dikespac am0til = .true. !set flag for surface modification c do process call orient(aszrgh(sr),asxrgw(sr),asxrgs(sr),asargo(sr), & asxdkh(sr),asxdks(sr), & rdght,rdgwt,rdgspac,odir,dikeht,dikespac, & tdepth,rdgflag) c post-process stuff if (am0tdb .eq. 1) then write (29,*) '//After oriented roughness process//' call tdbug(sr, nslay(sr),prcode) end if c-----END oriented roughness process (process code 05) case (11) c-----START crushing process (process code 11) c pre-process stuff if (am0tdb .eq. 1) then write (29,*) write (29,*) '//Before crushing process//' call tdbug(sr, nslay(sr),prcode) end if c c Convert ASD from modified log-normal to sieve classes call asd2m(aslagn(1,sr), aslagx(1,sr), aslagm(1,sr), & as0ags(1,sr), nslay(sr), massf) c c c read the crushing parameters for the implement mcur(sr) = mcur(sr) + 1 line = mtbl(mcur(sr)) read(line(2:lentrm(line)),* , err=901) alpha, beta c do process call crush(alpha, beta, tlayer, massf) c c post-process stuff c c Convert ASD back from sieve classes to modified log-normal call m2asd(massf, nslay(sr), & aslagn(1,sr), aslagx(1,sr), aslagm(1,sr), as0ags(1,sr)) c if (am0tdb .eq. 1) then write (29,*) '//After crushing process//' call tdbug(sr, nslay(sr),prcode) end if c-----END crushing process (process code 11) case (12) c-----START loosening process (process code 12) c pre-process stuff if (am0tdb .eq. 1) then write (29,*) write (29,*) '//Before loosening process//' call tdbug(sr, nslay(sr),prcode) end if c read the loosening parameter for the implement mcur(sr) = mcur(sr) + 1 line = mtbl(mcur(sr)) read(line(2:lentrm(line)),* , err=901) mu c do process call loosn(mu,tlayer, & asdblk(1,sr),asdsbk(1,sr),aszlyt(1,sr)) c post-process stuff if (am0tdb .eq. 1) then write (29,*) '//After loosening process//' call tdbug(sr, nslay(sr),prcode) end if c-----END loosening process (process code 12) case (13) c-----START mixing process (process code 13) c pre-process stuff if (am0tdb .eq. 1) then write (29,*) write (29,*) '//Before mixing process//' write (29,*) 'Tillage layer depth is', tlayer call tdbug(sr, nslay(sr),prcode) end if c read the mixing coefficient from the data file mcur(sr) = mcur(sr) + 1 line = mtbl(mcur(sr)) read(line(2:lentrm(line)),* , err=901) rho c Convert ASD from modified log-normal to sieve classes call asd2m(aslagn(1,sr), aslagx(1,sr), aslagm(1,sr), & as0ags(1,sr), nslay(sr), massf) c do process call mix(rho,tlayer,asdblk(1,sr),aszlyt(1,sr),asfsan(1,sr), & asfsil(1,sr),asfcla(1,sr),as0ph(1,sr),ascmg(1,sr), & ascna(1,sr),asfcce(1,sr),asfcec(1,sr),asfesp(1,sr), & asfom(1,sr),asfnoh(1,sr),asfpoh(1,sr),asfpsp(1,sr), & asfsmb(1,sr),asdagd(1,sr),aseags(1,sr),ahrwc(1,sr), & aheaep(1,sr),ahrwcw(1,sr),ahrwcf(1,sr),ahrwca(1,sr), & ahrwcs(1,sr), & admrtz(1,1,sr),admbgz(1,1,sr), & massf) c post-process stuff c Convert ASD back from sieve classes to modified log-normal call m2asd(massf, nslay(sr), & aslagn(1,sr), aslagx(1,sr), aslagm(1,sr), as0ags(1,sr)) if (am0tdb .eq. 1) then write (29,*) '//After mixing process//' call tdbug(sr, nslay(sr),prcode) end if c-----END mixing process (process code 13) c case (14) c-----START inversion process (process code 14) c pre-process stuff if (am0tdb .eq. 1) then write (29,*) write (29,*) '//Before inversion process//' call tdbug(sr, nslay(sr),prcode) end if c Convert ASD from modified log-normal to sieve classes call asd2m(aslagn(1,sr), aslagx(1,sr), aslagm(1,sr), & as0ags(1,sr), nslay(sr), massf) c do process call invert(tlayer,asdblk(1,sr),aszlyt(1,sr),asfsan(1,sr), & asfsil(1,sr),asfcla(1,sr),as0ph(1,sr),ascmg(1,sr), & ascna(1,sr),asfcce(1,sr),asfcec(1,sr),asfesp(1,sr), & asfom(1,sr),asfnoh(1,sr),asfpoh(1,sr),asfpsp(1,sr), & asfsmb(1,sr),asdagd(1,sr),aseags(1,sr),ahrwc(1,sr), & aheaep(1,sr),ahrwcw(1,sr),ahrwcf(1,sr),ahrwca(1,sr), & ahrwcs(1,sr), & admrtz(1,1,sr),admbgz(1,1,sr), & massf) c post-process stuff c Convert ASD back from sieve classes to modified log-normal call m2asd(massf, nslay(sr), & aslagn(1,sr), aslagx(1,sr), aslagm(1,sr), as0ags(1,sr)) if (am0tdb .eq. 1) then write (29,*) '//After inversion process//' call tdbug(sr, nslay(sr),prcode) end if c-----END inversion process (process code 14) c case (21) c-----START below layer compaction (process code 21) c pre-process stuff c do process c post-process stuff mcur(sr) = mcur(sr) + 1 line = mtbl(mcur(sr)) read(line(2:lentrm(line)),* , err=901) tibcp c-----END below layer compaction (process code 21) c case (23) c-----START flatten process variable toughness (process code 23) c pre-process stuff mcur(sr) = mcur(sr) + 1 line = mtbl(mcur(sr)) read(line(2:lentrm(line)),* , err=901) afvt(1), afvt(2), & afvt(3), afvt(4), afvt(5) af = afvt(1) c Default all flatten processes to "all" biomass for now. bioflg = 0 c do process call flat(af, & acmst(sr), acdstm(sr), & tcmf(sr), & admst(1,sr),admf(1,sr), addstm(1,sr), & bioflg) c post-process stuff c-----END flatten process variable toughness (process code 23) c case (24) c-----START mass bury process variable toughness (process code 24) c pre-process stuff mcur(sr) = mcur(sr) + 1 line = mtbl(mcur(sr)) read(line(2:lentrm(line)),* , err=901) burydistflg, & mfvt(1), mfvt(2), mfvt(3), mfvt(4), mfvt(5) mf = mfvt(1) c Default all flatten processes to "all" biomass for now. bioflg = 0 c do process if (am0tdb .eq. 1) then write (29,*) write (29,*) '//Before mass bury process//' call tdbug(sr, nslay(sr),prcode) end if call mbury(mf,tlayer,admf(1,sr), admbgz(1,1,sr), & tcmf(sr), tcmbgz(1,sr), bioflg) if (am0tdb .eq. 1) then write (29,*) '//After mass bury process//' call tdbug(sr, nslay(sr),prcode) end if c post-process stuff c-----END mass bury process variable toughness (process code 24) c case (26) c-----START re-surface process variable toughness (process code 26) c pre-process stuff mcur(sr) = mcur(sr) + 1 line = mtbl(mcur(sr)) read(line(2:lentrm(line)),* , err=901) mfvt(1), mfvt(2), & mfvt(3), mfvt(4), mfvt(5) mf = mfvt(1) c Default all lift processes to only decomp biomass pools for now. bioflg = (2**mnbpls - 1) - 1 c do process call lift(mf,tlayer, & admf(1,sr),admrtz(1,1,sr),admbgz(1,1,sr), & bioflg) c post-process stuff c-----END re-surface process variable toughness (process code 26) c case (31) c-----START killing process (process code 31) c Note that the "kill" process only stops the crop growth c submodel and moves the "crop" parameters to the "temporary" c crop pool. The "transfer" process does the final transfer c of the "temporary" crop pool values over to the "decomp" c pools where they can now begin to decay. c pre-process stuff c Some operations will not kill certain types of crops, c ie., a mowing operation usually will not kill a perennial c crop like alfalfa but would kill many annual crops. c So, we have a "kill flag" that makes that distinction. c This flag may get expanded in the future as new situations c arise. c set am0hrvfl c 0 - no kill being done c 1 - perennial crop which is NOT killed c 2 - annual or perennial crop which is killed mcur(sr) = mcur(sr) + 1 line = mtbl(mcur(sr)) read(line(2:lentrm(line)),* , err=901) am0hrvfl c do process write(*,*) ' doprocess: am0hrvfl ', am0hrvfl if (am0hrvfl.gt.1) then c need to stop the crop growth (ie. stop calling crop submodel) am0cgf = .false. !copy the stem diameter over tcxstm(sr) = acxstm(sr) !transfer plant properties to temporary pool tczht(sr) = aczht(sr) !crop height aczht(sr) = 0.0 tcdstm(sr) = tcdstm(sr) + acdstm(sr) !stem diameter acdstm(sr) = 0.0 tcmst(sr) = tcmst(sr) + acmst(sr) !mass of standing biomass acmst(sr) = 0.0 tcmyld(sr) = tcmyld(sr) + acmyld(sr) !mass of yield component acmyld(sr) = 0.0 tcmrt(sr) = tcmrt(sr) + acmrt(sr) !mass of roots (total) acmrt(sr) = 0.0 tczrtd(sr) = aczrtd(sr) !root depth aczrtd(sr) = 0.0 do 666 idx=1,nslay(sr) !mass of roots (by layer) tcmrtz(idx,sr) = tcmrtz(idx,sr) + acmrtz(idx,sr) acmrtz(idx,sr) = 0.0 666 continue ! once we move crop biomass into the "temporary" crop pool ! it is assumed to be dead biomass. Currently we assume that ! dead biomass does not have "leaves" which significantly ! influence wind erosion. Probably not a good generic assumption, ! but that's the way it is right now. acrlai(sr) = 0.0 endif c post-process stuff harvdate = am0jd !not sure what this is used for - LEW - 8/26/1999 c-----END killing process (process code 31) case (32) c-----START cutting process (process code 32) c pre-process stuff mcur(sr) = mcur(sr) + 1 line = mtbl(mcur(sr)) read(line(2:lentrm(line)),* , err=901) * cutflg, cutht, grainf, cropf, standf c do process call cut(cutflg, cutht, grainf, cropf, standf, & aczht(sr), acmyld(sr), acmst(sr), & tczht(sr), tcmyld(sr), tcmst(sr), tcmf(sr), & adzht(1,sr), admst(1,sr), admf(1,sr)) c post-process stuff c-----END cutting process (process code 32) case (33) c-----START flatten process (process code 33) c pre-process stuff mcur(sr) = mcur(sr) + 1 line = mtbl(mcur(sr)) read(line(2:lentrm(line)),* , err=901) af c Default all flatten processes to "all" biomass for now. bioflg = 0 c do process call flat(af, & acmst(sr), acdstm(sr), & tcmf(sr), & admst(1,sr),admf(1,sr), addstm(1,sr), & bioflg) c post-process stuff c-----END flatten process (process code 33) c case (34) c-----START mass bury process (process code 34) c pre-process stuff mcur(sr) = mcur(sr) + 1 line = mtbl(mcur(sr)) read(line(2:lentrm(line)),* , err=901) mf c Default all flatten processes to "all" biomass for now. bioflg = 0 c do process if (am0tdb .eq. 1) then write (29,*) write (29,*) '//Before mass bury process//' call tdbug(sr, nslay(sr),prcode) end if call mbury(mf,tlayer,admf(1,sr), admbgz(1,1,sr), & tcmf(sr), tcmbgz(1,sr), bioflg) if (am0tdb .eq. 1) then write (29,*) '//After mass bury process//' call tdbug(sr, nslay(sr),prcode) end if c post-process stuff c-----END mass bury process (process code 34) c case (35) c-----START cover bury process (process code 35) c pre-process stuff mcur(sr) = mcur(sr) + 1 line = mtbl(mcur(sr)) read(line(2:lentrm(line)),* , err=901) cf c Default all cbury processes to only decomp biomass pools for now. bioflg = (2**mnbpls - 1) - 1 c do process call cbury(cf,tlayer,admf(1,sr), admbgz(1,1,sr), & tcmf(sr), tcmbgz(1,sr), bioflg) c post-process stuff c-----END cover bury process (process code 35) c case (36) c-----START re-surface process (process code 36) c pre-process stuff mcur(sr) = mcur(sr) + 1 line = mtbl(mcur(sr)) read(line(2:lentrm(line)),* , err=901) mf c Default all lift processes to only decomp biomass pools for now. bioflg = (2**mnbpls - 1) - 1 c do process call lift(mf,tlayer, & admf(1,sr),admrtz(1,1,sr),admbgz(1,1,sr), & bioflg) c post-process stuff c-----END re-surface process (process code 36) c case (37) c-----START thinning process (process code 37) c pre-process stuff mcur(sr) = mcur(sr) + 1 line = mtbl(mcur(sr)) read(line(2:lentrm(line)),* , err=901) * thinflg, thinval, grainf, cropf, standf c do process call thin(thinflg, thinval, grainf, cropf, standf, & acdstm(sr), acmyld(sr), acmst(sr), & tcdstm(sr), tcmyld(sr), tcmst(sr), tcmf(sr), & addstm(1,sr), admst(1,sr), admf(1,sr)) c post-process stuff c-----END cutting process (process code 32) case (40) c-----START crop to biomass transfer process (process code 40) c pre-process stuff C c do process C put in code to check if a crop is actually "growing" here C if so, then do the "transfer" process (default action) C may later want to include a "transfer process" flag that could C force a "biomass transfer" to occur C if ((tczht(sr) .gt. 0.0) .or. & (tcdstm(sr) .gt. 0.0) .or. & (tcmst(sr) .gt. 0.0) .or. & (tcmf(sr) .gt. 0.0) .or. & (tcmrt(sr) .gt. 0.0) .or. & (tcmyld(sr) .gt. 0.0)) then ! assume these are enough to check C*** if (tczht(sr) .gt. 0.0) write(*,*) 'tczht: ', tczht(sr) C*** if (tcdstm(sr) .gt. 0.0) write(*,*) 'tcdstm: ', tcdstm(sr) C*** if (tcmst(sr) .gt. 0.0) write(*,*) 'tcmst: ', tcmst(sr) C*** if (tcmf(sr) .gt. 0.0) write(*,*) 'tcmf: ', tcmf(sr) C*** if (tcmrt(sr) .gt. 0.0) write(*,*) 'tcmrt: ', tcmrt(sr) C*** if (tcmyld(sr) .gt. 0.0) write(*,*) 'tcmyld: ', tcmyld(sr) call trans( & tczht(sr), adzht(1,sr), & tcxstm(sr), adxstm(1,sr), & tcdstm(sr), addstm(1,sr), & tcmyld(sr), & tcmst(sr), admst(1,sr), & tcmf(sr), admf(1,sr), & tcmbg(sr), admbg(1,sr), & tcmrt(sr), admrt(1,sr), & tcmbgz(1,sr), admbgz(1,1,sr), & tcmrtz(1,sr), admrtz(1,1,sr), & cumdds(1,sr), cumddf(1,sr), cumddg(1,1,sr), & dkrate(1,1,sr), covfact(1,sr), & ddsthrsh(1,sr), & acdkrate(1,sr), accovfact(sr), & acddsthrsh(sr), & ac0nam(sr), ad0nam(sr), & nslay(sr)) C zero these "dependent" values - they will be updated by crop if necessary acm(sr) = acmst(sr) + acmrt(sr) + acmyld(sr) acrsai(sr) = 0.0 acrlai(sr) = 0.0 do 667 idx=1,mncz acrsaz(idx,sr) = 0.0 acrlaz(idx,sr) = 0.0 667 continue acffcv(sr) = 0.0 acfscv(sr) = 0.0 acftcv(sr) = 0.0 end if c c post-process stuff c c-----END crop to biomass transfer process (process code 40) c case (50) c-----START residue initialization process (process code 50) c Read surface residue counts and amount mcur(sr) = mcur(sr) + 1 line = mtbl(mcur(sr)) read(line(2:lentrm(line)),* , err=901) * addstm(1,sr), adzht(1,sr), admst(1,sr), admf(1,sr) c get additional line of data mcur(sr) = mcur(sr) + 1 line = mtbl(mcur(sr)) c read buried residue amounts read(line(2:lentrm(line)), *, err=901) * dmassres, zmassres, dmassrot, zmassrot c place buried residue in pools by layer call resinit(dmassrot,zmassrot,nslay(sr),admrtz(1,1,sr), & aszlyt(1,sr)) call resinit(dmassres,zmassres,nslay(sr),admbgz(1,1,sr), & aszlyt(1,sr)) c get additional line of data mcur(sr) = mcur(sr) + 1 line = mtbl(mcur(sr)) c read decomposition parameters for type of residue buried read(line(2:lentrm(line)), *, err=901) * acdkrate(1,sr), acdkrate(2,sr), acdkrate(3,sr), * acdkrate(4,sr), acdkrate(5,sr), acxstm(sr), * acddsthrsh(sr), accovfact(sr) c pre-process stuff c do process c give residue the proper name ad0nam(sr) = cropname c post-process stuff c-----END residue initialization process (process code 50) c case (51) c-----START row planting process (process code 51) c set the crop id number, cropno read in process mcur(sr) = mcur(sr) + 1 line = mtbl(mcur(sr)) read(line(2:lentrm(line)),* , err=901) & acdpop(sr), ac0til(sr), acrsfg(sr), acxrow(sr), acrofg(sr) c get additional line of data mcur(sr) = mcur(sr) + 1 line = mtbl(mcur(sr)) c read yield reporting values read(line(2:lentrm(line)), *, err=901) & acthud(sr), acytgt(sr) mcur(sr) = mcur(sr) + 1 line = mtbl(mcur(sr)) c read yield reporting name read(line(2:lentrm(line)), *, err=901) & acynmu(sr) mcur(sr) = mcur(sr) + 1 line = mtbl(mcur(sr)) c read yield reporting values read(line(2:lentrm(line)), *, err=901) & acyprt(sr), acywct(sr), acycon(sr) c read 7 lines of crop data mcur(sr) = mcur(sr) + 1 line = mtbl(mcur(sr)) read(line(2:lentrm(line)), *, err=901) & ac0id(sr), ac0idc(sr), ac0bn1(sr), ac0bn2(sr), ac0bn3(sr), & ac0bp1(sr), ac0bp2(sr), ac0bp3(sr) mcur(sr) = mcur(sr) + 1 line = mtbl(mcur(sr)) read(line(2:lentrm(line)), *, err=901) & ac0ck(sr), acrhi(sr), acehu0(sr), aczmxc(sr), aczmrt(sr), & actmin(sr), actopt(sr), ac0bev(sr) mcur(sr) = mcur(sr) + 1 line = mtbl(mcur(sr)) read(line(2:lentrm(line)), *, err=901) & ac0fd1(1,sr), ac0fd2(1,sr), ac0fd1(2,sr), ac0fd2(2,sr), & ac0be1(1,sr), ac0be2(1,sr), ac0be1(2,sr), ac0be2(2,sr) mcur(sr) = mcur(sr) + 1 line = mtbl(mcur(sr)) read(line(2:lentrm(line)), *, err=901) & ac0alf(sr), ac0blf(sr), ac0clf(sr), ac0dlf(sr), ac0arp(sr), & ac0brp(sr), ac0crp(sr), ac0drp(sr) mcur(sr) = mcur(sr) + 1 line = mtbl(mcur(sr)) read(line(2:lentrm(line)), *, err=901) & ac0aht(sr), ac0bht(sr), ac0ssa(sr), ac0ssb(sr), ac0sla(sr), & ac0hue(sr), ac0lfe(sr), actdtm(sr) c convert sla and ssa to cm^2/plant ac0sla(sr) = ac0sla(sr) * 10. ac0ssa(sr) = ac0ssa(sr) * 10. mcur(sr) = mcur(sr) + 1 line = mtbl(mcur(sr)) read(line(2:lentrm(line)), *, err=901) & acdkrate(1,sr),acdkrate(2,sr),acdkrate(3,sr),acdkrate(4,sr), & acdkrate(5,sr), acxstm(sr), acddsthrsh(sr), accovfact(sr) c set row spacing based on flag select case( acrsfg(sr) ) case(0) ! Broadcast Planting acxrow(sr) = 0.0 case(1) ! Use Specified Row Spacing c convert incoming mm to meters used in acxrow acxrow(sr) = acxrow(sr)*mmtom case(2) ! Use Existing Ridge Spacing if(asxrgs(sr).gt.0.01) then acxrow(sr) = asxrgs(sr)*mmtom else ! no ridges, so this is a broadcast crop acxrow(sr) = 0.0 endif case default write(*,*) 'Invalid row spacing flag value' end select select case( acrofg(sr) ) case(0) ! Use Existing Ridge Direction case(1) ! Use Operation Direction case default end select c pre-process stuff c do process c do not initialize crop if no crop is present if( ac0id(sr).ne.0 ) then c set flag for crop initialization - jt am0cif = .true. c set crop growth flag on - jt am0cgf = .true. endif c post-process stuff acdstm(sr) = acdpop(sr) !eventually we will multiply by tillering factor c give crop the proper name ac0nam(sr) = cropname c-----END row planting process (process code 51) c case (61) c-----START biomass remove process (process code 61) c 10 print*, 'SR',sr,' process:',prcode,' is ',prname c pre-process stuff read(line(skpnam(line):lentrm(line)), *, err=901) grainf, cropf, * decompf, cutht, bgf, flag c do process if (am0tdb .eq. 1) then write (29,*) write (29,*) '//Before biomass remove process//' call tdbug(sr, nslay(sr),prcode) end if call remove(grainf,cropf,decompf,bgf,cutht, & aczht(sr),acdstm(sr),acmyld(sr),acmst(sr), & acmrt(sr), acmrtz(1,sr), & tczht(sr),tcdstm(sr),tcmyld(sr),tcmst(sr),tcmf(sr), & tcmbg(sr), tcmbgz(1,sr),tcmrt(sr), tcmrtz(1,sr), & adzht(1,sr),addstm(1,sr),admst(1,sr),admf(1,sr), & admbgz(1,1,sr),admrtz(1,1,sr), & nslay(sr),flag) if (am0tdb .eq. 1) then write (29,*) '//After biomass remove process//' call tdbug(sr, nslay(sr),prcode) end if c post-process stuff c-----END biomass remove process (process code 61) c case (71) c-----START irrigate process (process code 71) c pre-process stuff ! write (*,*) 'prior to irrig -> ahzirr(sr), amt', ahzirr(sr), irrig read(line(skpnam(line):lentrm(line)), *, err=901) irrig ahzirr(sr) = ahzirr(sr) + irrig ! write (*,*) 'irrig this much -> ahzirr(sr), amt', ahzirr(sr), irrig c do process if (am0tdb .eq. 1) then write (29,*) write (29,*) '//Before irrigate process//' !call tdbug(sr, nslay(sr),prcode) end if c Hmm, don't really need to "call" an irrigation routine yet. c call irrig(am0irr(sr), ahzirr(sr)) c call irrig(0, 254.0) if (am0tdb .eq. 1) then write (29,*) '//After irrigate process//' !call tdbug(sr, nslay(sr),prcode) end if c post-process stuff c-----END irrigate process (process code 71) c case default goto 902 end select C return C C Error stops C 901 write(*,*) 'Error reading parameter ', line stop 1003 902 write(*,*) 'Invalid process ', prname, ' ', prcode stop 1003 end