c c file: nmnim.for c subroutine nmnim (k) c c + + + PURPOSE + + + c This subroutine estimates daily N and P mineralization and immobilization c considering fresh organic material (crop residue) and active and stable c humus material. Goto statements in the original code were replaced by if- c then-else statements as required by WEPP coding convention. c c + + + KEYWORDS + + + c mineralization c c + + + COMMON BLOCKS + + + *$noereference include 'crop/chumus.inc' include 'crop/cenvr.inc' include 'crop/cfert.inc' include 'crop/csoil.inc' *$reference c c + + + LOCAL VARIABLES + + + real tkg,cs,rwn,xx,hmp,r4,cnr,cpr,cnrf,cprf,ca,decr,rmn,rmp,rm2, 1 rdc integer k c c + + + LOCAL VARIABLE DEFINITIONS + + + c ca (cnp) - takes the value of 1.0,cnrf or cprf whichever is the smallest c cmn (cmn) - humus rate constant(1/d) - 2.160 c cnr (cnr) - C:N ratio in a soil layer - 2.155 c cnrf (cnp) - C:N ratio factor - 2.154 c cpr (cpr) - C:P ratio in a soil layer - 2.156 c cprf (cnp) - C:P ratio factor - 2.154 c cs - temp and soil moisture factor of - 2.153 c decr (dcr) - decay rate constant for fresh organic matter - 2.153 c hmp (hmp) - amount of P mineralized from humus - kg/ha/d c r4 - numerator of - 2.155 c rc (rc) - residue decomposition factor (.8,.05,.0095) c rdc - amount of decayed residue from fresh residue - kg/ha c rm2 - 20% of N mineralized from fersh residue - kg/ha/day c rmn (rmn) - amount of N mineralized from fresh residue - kg/ha/d - 2.152 c rmp - amount of P mineralized from fresh residue - kg/ha/d - 2.152 c rwn (ron) - flow rate between active and stable humus N pools - kg/ha/d c tkg - residue - kg/ha c xx - sum of active and stable N pools c c c + + + OUTPUT FORMATS + + + 2000 format(1x,2(i3,1x),11(f7.3,1x)) c c + + + END OF SPECIFICATIONS + + + c c convert residue to kg/ha. cmn=0.0003 tkg=rsd(k)*1000. c calculate parts of eq. 2.153 cs=sqrt(cdg*sut) c This section of code calculates amount of N&P mineralized from humus. c calculate N that becomes part of the stable N pool using eq. 2.159. c This eq. is not the same as in the manual--->(-1.0) added. rwn=.1e-4*(wmn(k)*(1./rtn(k)-1.)-wn(k)) c Add RWN to the stable organic N pool (WN(K)). wn(k)=wn(k)+rwn wim=0. wip=0. c Calculate amount of N mineralized from the active N pool. This eq is c not the same as in the manual--->BD*BD left out. c next line replaced by the line following it c HMN=CMN*CS*WMN(K)/(BDP(K)*BDP(K)) hmn=cmn*cs*wmn(k) c Calculate mineralized P (HMP) in the following 2 lines. xx=wn(k)+wmn(k) hmp=1.4*hmn*wp(k)/xx c calculate N&P mineralization from humus when there is not enough residue c IF (TKG.le.1.) then c calculate remaining amount of humus c HUM(K)=HUM(K)*(1.-HMN/XX) c subtract N flow to stable pool(RWN) and humus mineralized N(HMN) from c the active N pool (WMN) c WMN(K)=WMN(K)-HMN-RWN c subtract humus P from stable organic pool c WP(K)=WP(K)-HMP c RMNR=HMN c add humus N to the NO3_N supply c WNO3(K)=WNO3(K)+RMNR c add humus P to the labile P supply c AP(K)=AP(K)+HMP c WMP=HMP c else c calculate N&P mineral./immobil. from fresh residue and humus material c this section of code calculates N & P mineralization from fresh OM c numerator of eq 2.155 r4=.58*tkg c calculate C:N ratio cnr=r4/(fon(k)+wno3(k)) c calculate C:P ratio cpr=r4/(fop(k)+ap(k)) c calculate CNP (C:N and C:P ratio factor)--eq 2.154 cnrf=1. if(cnr.gt.25.) cnrf=exp(-.693*(cnr-25.)/25.) cprf=1. if(cpr.gt.200.) cprf=exp(-.693*(cpr-200.)/200.) ca=amin1(cnrf,cprf) c calculate the decay rate constant using eq. 2.153 c RC=0.05 is it constant ? when does it become 0.8 and 0.0095 ? c new code added to determine residue composition factor c if (rsdi(k).le.0.) rsdi(k)=1. c rfom=rsd(k)/rsdi(k) c if (rfom.ge.0.8) rc=0.8 c if (rfom.lt.0.8) rc=0.05 c if (rfom.lt.0.1) rc=0.0095 rc=0.05 c end of new code additions decr=rc*ca*cs c calculate N mineralization rate using eq. 2.152 rmn=decr*fon(k) c calculate P mineralization rate using eq. 2.152 rmp=decr*fop(k) c calculate 20% of fresh OM N rm2=.2*rmn c calculate amount of remaining humus hum(k)=hum(k)*(1.+(rm2-hmn)/xx) c update amount of active humus N pool wmn(k)=wmn(k)+rm2-hmn-rwn c update amount of stable organic N pool wp(k)=wp(k)-hmp+.2*rmp c calulate amount of decayed residue rdc=decr*tkg c update amount of residue and convert to t/ha rsd(k)=.001*(tkg-rdc) c calculate net minerlized N rmnr=.8*rmn+hmn c calculate net mineralized P wmp=.8*rmp+hmp C WIM=AMAX1(.0232*RDC-RMN,0.) C WIM=AMIN1(RMNR+WNO3(K),WIM) C WIP=AMAX1(.0029*RDC-RMP,0.) C WIP=AMIN1(WMP+AP(K),WIP) c add immobilized P and subtract mineralized P to fresh organic P pool fop(k)=fop(k)+wip-rmp c add immobilized N and subtract mineralized N to fresh organic N pool fon(k)=fon(k)+wim-rmn c update total NO3_N in soil layer wno3(k)=wno3(k)-wim+rmnr c update total labile P in soil layer ap(k)=ap(k)-wip+wmp c keep running totals of mineralized N & P from fresh residue(rmn*.8, c rmp*.8) and humus(hmn,hmp) trmn=trmn+.8*rmn trmp=trmp+.8*rmp thmn=thmn+hmn thmp=thmp+hmp c endif c write(37,2000)jd,k,wno3(k),ap(k),fon(k),rmn,rmp,hmn,hmp,trmn,trmp, c 1thmn,thmp c write(312,2001)jd,k,cnr,cpr,cnrf,cprf,ca,decr,cs,cdg,sut c write(313,2002)jd,k,hum(k),wmn(k),wn(k),wp(k),rwn,rmnr,wmp c2001 format (1x,2(i3,1x),9(f8.3,1x)) c2002 format (1x,2(i3,1x),7(f10.5,1x)) return end