c decini.for subroutine decoinit(isr) c + + + PURPOSE + + + C This subroutine initalizes values needed in the decomposiiton c submodel. The values are read from a file that indicate the previous c crop harvested and quantities of biomass remaining in the field, for c standing, surface, buried, and root residues. c The subroutine also sets all other age pools and decompdays to 0. c + + + COMMON BLOCKS + + + include 'p1werm.inc' include 'wpath.inc' include 'd1gen.inc' include 's1layr.inc' include 'm1subr.inc' include 'c1db1.inc' include 'd1glob.inc' include 'decomp/decomp.inc' c + + + LOCAL VARIABLE DECLARATION + + + character resname*80 character line*80 integer isr integer i,j, l, idx c + + + LOCAL VARIABLE DEFINITIONS + + + c resname name of crop c line holds the contents of each line as it is read c isr current subregion c + + + FUNCTION DECLARATION + + + integer lentrm integer begtrm c + + + DATA INITIALIZATION + + + c + + + FORMAT STATEMENT + + + 2500 format (' Problem reading the DECOMPOSITION parameters from file &crop.db - WEPS EXECUTION HALTED') c + + + END SPECIFICATION + + + c Set harvest flag to 0 and pool values to 1 hrvflag = 0 ipool = 1 ipoolf = 1 c read inital values for crop type, stem no. stem biomass c surface biomass, below ground biomass, and root biomass stmnoy(1,isr)=addstm(1,isr) dmsbmy(1,isr)=admst(1,isr) c water coefficent parameters diwcsy(isr) = 0.0 dweti(isr) = 0.0 c cummulative ddays for surface residues do 90 iage= 1,mnbpls cumdds(iage,isr)=0.0 90 continue c standing stem biomass, stem number, stem diam, stem height do 70 iage= 2,mnbpls admst(iage,isr)=0.0 addstm(iage,isr)=0.0 adxstm(iage,isr)=0.0 stmht(iage,isr)=0.0 70 continue c cumulative ddays and biomass for each layer below ground do 40 isz= 1,nslay(isr) do 41 iage= 1,mnbpls cumddg(isz,iage,isr)=0.0 41 continue do 42 iage= 2,mnbpls admbgz(isz,iage,isr)=0.0 admrtz(isz,iage,isr)=0.0 42 continue 40 continue c flat biomass, cummddays, and covfact for surface residues do 30 iage = 1,mnbpls cumddf(iage,isr)=0.0 covfact(iage,isr)=0.0 30 continue do 31 iage = 2,mnbpls admf(iage,isr)= 0.0 31 continue c set biomass decomposition rates to 0.0 for all pools except no.1 c residue type counter do 50 j = 1,5 c residue pool counter do 60 l = 2,mnbpls dkrate(j,l,isr)=0.0 60 continue 50 continue c Read from "crop.db" database file - search for residue type (crop name) c to read in the decomposition parameters for the current residue c skip header lines at top (or other comment lines starting with "#") 205 read (31,'(a)') line if (line(1:1) .eq. '#') go to 205 resname = line(begtrm(line):lentrm(line)) if (resname(1:lentrm(resname)) .eq. 'no_crop') then write(*,*) ' the selected initial residue - ',ad0nam(isr), & 'is not in the decomp database - using winter wheat dk rates' goto 208 end if c Check if current residue (crop) name matches one we are at in crop db if ( resname(1:lentrm(resname)) .ne. & ad0nam(isr)(1:lentrm(ad0nam(isr))) ) then c Go back and read next residue (crop) entry from database goto 205 else c skip the crop growth parameters in the database do 209 i=1,5 read (31,'(a)') line 209 continue endif c Read decomp parameters from the database 208 read (31,*,err=80) dkrate(1,1,isr), dkrate(2,1,isr), & dkrate(3,1,isr), dkrate(4,1,isr), dkrate(5,1,isr), & adxstm(1,isr), ddsthrsh(1,isr), covfact(1,isr) c go back to top of 'crop.db' to be ready for next crop rewind(unit = 31) c Open output files call decopen C c temporarily initialize residue to bypass an error in crop-jt 7/22/94 c remove when problem is solved in crop do idx = 1, nslay(isr) admbgz(idx,1,isr) = 0.001 c initialize the stem diameters to zero before use. - LEW 4/26/99 end do do idx = 1, mnbpls adxstm(idx,isr) = 0.0 end do return 80 write(*,2500) end