c This routine takes a residue amount and depth and distributes it c into the array of soil layers subroutine resinit(resmass, resdepth, nlay, resarray, laythick) c + + + INPUT VARIABLE DECLARATIONS + + + real resmass real resdepth integer nlay real resarray(nlay) real laythick(nlay) c + + + INPUT VARIABLE DEFINITIONS + + + c resmass - residue mass (Kg/m^2) c resdepth - Depth residue is distributed in soil (mm) c nlay - number of soil layers c resarray(nlay) - soil residue array by layer (Kg/m^2) c laythick(nlay) - soil layer thickness (mm) c + + + LOCAL VARIABLE DECLARATIONS + + + integer ilay real depth c + + + LOCAL VARIABLE DEFINITIONS + + + c ilay - array index c depth - accumulator for depth c thick - thickness of slice to which residue is to be added depth = resdepth do 100 ilay=1, nlay if (depth.le.0.0) goto 1000 resarray(ilay) = resmass*min(depth,laythick(ilay))/(resdepth) depth = depth - laythick(ilay) 100 continue 1000 return end