-
Notifications
You must be signed in to change notification settings - Fork 0
/
killop.f
366 lines (306 loc) · 13.5 KB
/
killop.f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
subroutine killop
!! ~ ~ ~ PURPOSE ~ ~ ~
!! this subroutine performs the kill operation
!! ~ ~ ~ INCOMING VARIABLES ~ ~ ~
!! name |units |definition
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! bio_ms(:) |kg/ha |land cover/crop biomass (dry weight)
!! curyr |none |current year of simulation
!! hrupest(:) |none |pesticide use flag:
!! | 0: no pesticides used in HRU
!! | 1: pesticides used in HRU
!! icr(:) |none |sequence number of crop grown within the
!! |current year
!! ihru |none |HRU number
!! ncrops(:,:,:)|
!! npmx |none |number of different pesticides used in
!! |the simulation
!! nro(:) |none |sequence number for year in rotation
!! nyskip |none |number of years to skip output printing/
!! |summarization
!! plt_pst(:,:)|kg/ha |pesticide on plant foliage
!! sol_fon(:,:) |kg N/ha |amount of nitrogen stored in the fresh
!! |organic (residue) pool
!! sol_fop(:,:) |kg P/ha |amount of phosphorus stored in the fresh
!! |organic (residue) pool
!! sol_pst(:,:,1)|kg/ha |pesticide in first layer of soil
!! sol_rsd(:,:) |kg/ha |amount of organic matter in the soil
!! |classified as residue
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! ~ ~ ~ OUTGOING VARIABLES ~ ~ ~
!! name |units |definition
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! bio_ms(:) |kg/ha |land cover/crop biomass (dry weight)
!! idorm(:) |none |dormancy status code:
!! |0 land cover growing (not dormant)
!! |1 land cover dormant
!! igro(:) |none |land cover status code:
!! |0 no land cover currently growing
!! |1 land cover growing
!! laiday(:) |m**2/m**2 |leaf area index
!! ncrops(:,:,:)|
!! phuacc(:) |none |fraction of plant heat units accumulated
!! plantn(:) |kg N/ha |amount of nitrogen in plant biomass
!! plantp(:) |kg P/ha |amount of phosphorus in plant biomass
!! plt_pst(:,:) |kg/ha |pesticide on plant foliage
!! sol_fon(:,:) |kg N/ha |amount of nitrogen stored in the fresh
!! |organic (residue) pool
!! sol_fop(:,:) |kg P/ha |amount of phosphorus stored in the fresh
!! |organic (residue) pool
!! sol_pst(:,:,1)|kg/ha |pesticide in first layer of soil
!! sol_rsd(:,:) |kg/ha |amount of organic matter in the soil
!! |classified as residue
!! strsw(:) |none |fraction of potential plant growth achieved
!! |on the day where the reduction is caused by
!! |water stress
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! ~ ~ ~ LOCAL DEFINITIONS ~ ~ ~
!! name |units |definition
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! j |none |HRU number
!! k |none |counter
!! resnew |
!! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
!! ~ ~ ~ SUBROUTINES/FUNCTIONS CALLED ~ ~ ~
!! Intrinsic: Max
!! ~ ~ ~ ~ ~ ~ END SPECIFICATIONS ~ ~ ~ ~ ~ ~
use parm
integer :: j, k
real :: resnew
!!by zhang
!!====================
real :: BLG1, BLG2, BLG3, CLG, sf
real :: sol_min_n, resnew_n, resnew_ne
real :: LMF, LSF, LSLF, LSNF,LMNF
orgc_f = 0.
BLG1 = 0.
BLG2 = 0.
BLG3 = 0.
CLG = 0.
sf = 0.
sol_min_n = 0.
resnew = 0.
resnew_n = 0.
resnew_ne = 0.
LMF = 0.
LSF = 0.
LSLF = 0.
LSNF = 0.
LMNF = 0.
!!by zhang
!!====================
j = 0
j = ihru
! if (curyr > nyskip) then
! ncrops(icr(j),j) = ncrops(icr(j),j) + 1
! endif
!! 22 January 2008
resnew = 0.
rtresnew = 0.
resnew = bio_ms(j) * (1. - rwt(j))
rtresnew = bio_ms(j) * rwt(j)
call rootfr
!! update residue, N, P on soil surface
sol_rsd(1,j) = resnew + sol_rsd(1,j)
sol_fon(1,j) = plantn(j) * (1. - rwt(j)) + sol_fon(1,j)
sol_fop(1,j) = plantp(j) * (1. - rwt(j)) + sol_fop(1,j)
sol_rsd(1,j) = Max(sol_rsd(1,j),0.)
sol_fon(1,j) = Max(sol_fon(1,j),0.)
sol_fop(1,j) = Max(sol_fop(1,j),0.)
!!insert new biomss by zhang
!!=================================
if (cswat == 2) then
!!all the lignin from STD is assigned to LSL,
!!add STDL calculation
!!
!sol_LSL(k,ihru) = sol_STDL(k,ihru)
!CLG=BLG(3,JJK)*HUI(JJK)/(HUI(JJK)+EXP(BLG(1,JJK)-BLG(2,JJK)*&HUI(JJK))
! 52 BLG1 = LIGNIN FRACTION IN PLANT AT .5 MATURITY
! 53 BLG2 = LIGNIN FRACTION IN PLANT AT MATURITY
!CROPCOM.dat BLG1 = 0.01 BLG2 = 0.10
!SUBROUTINE ASCRV(X1,X2,X3,X4)
!EPIC0810
!THIS SUBPROGRAM COMPUTES S CURVE PARMS GIVEN 2 (X,Y) POINTS.
!USE PARM
!XX=LOG(X3/X1-X3)
!X2=(XX-LOG(X4/X2-X4))/(X4-X3)
!X1=XX+X3*X2
!RETURN
!END
!HUI(JJK)=HU(JJK)/XPHU
BLG1 = 0.01/0.10
BLG2 = 0.99
BLG3 = 0.10
XX = log(0.5/BLG1-0.5)
BLG2 = (XX -log(1./BLG2-1.))/(1.-0.5)
BLG1 = XX + 0.5*BLG2
CLG=BLG3*phuacc(j)/(phuacc(j)+EXP(BLG1-BLG2*phuacc(j)))
!if (k == 1) then
sf = 0.05
!else
!sf = 0.1
!end if
!kg/ha
sol_min_n = 0.
sol_min_n = (sol_no3(1,j)+sol_nh3(1,j))
resnew = resnew
resnew_n = ff1 * (plantn(j) - yieldn)
resnew_ne = resnew_n + sf * sol_min_n
!Not sure 1000 should be here or not!
!RLN = 1000*(resnew * CLG/(resnew_n+1.E-5))
RLN = (resnew * CLG/(resnew_n+1.E-5))
RLR = MIN(.8, resnew * CLG/(resnew+1.E-5))
LMF = 0.85 - 0.018 * RLN
if (LMF <0.01) then
LMF = 0.01
else
if (LMF >0.7) then
LMF = 0.7
end if
end if
!if ((resnew * CLG/(resnew_n+1.E-5)) < 47.22) then
! LMF = 0.85 - 0.018 * (resnew * CLG/(resnew_n+1.E-5))
!else
! LMF = 0.
!end if
LSF = 1 - LMF
sol_LM(1,j) = sol_LM(1,j) + LMF * resnew
sol_LS(1,j) = sol_LS(1,j) + LSF * resnew
!here a simplified assumption of 0.5 LSL
LSLF = 0.0
LSLF = CLG
sol_LSL(1,j) = sol_LSL(1,j) + RLR* LSF * resnew
sol_LSC(1,j) = sol_LSC(1,j) + 0.42*LSF * resnew
sol_LSLC(1,j) = sol_LSLC(1,j) + RLR*0.42*LSF * resnew
sol_LSLNC(1,j) = sol_LSC(1,j) - sol_LSLC(1,j)
!X3 = MIN(X6,0.42*LSF * resnew/150)
if (resnew_n >= (0.42 * LSF * resnew /150)) then
sol_LSN(1,j) = sol_LSN(1,j) + 0.42 * LSF * resnew / 150
sol_LMN(1,j) = sol_LMN(1,j) + resnew_n -
& (0.42 * LSF * resnew / 150) + 1.E-25
else
sol_LSN(1,j) = sol_LSN(1,j) + resnew_n
sol_LMN(1,j) = sol_LMN(1,j) + 1.E-25
end if
!LSNF = sol_LSN(1,j)/(sol_LS(1,j)+1.E-5)
sol_LMC(1,j) = sol_LMC(1,j) + 0.42 * LMF * resnew
!LMNF = sol_LMN(1,j)/(sol_LM(1,j) + 1.E-5)
!update no3 and nh3 in soil
sol_no3(1,j) = sol_no3(1,j) * (1-sf)
sol_nh3(1,j) = sol_nh3(1,j) * (1-sf)
end if
!!insert new biomss by zhang
!!===============================
!! allocate dead roots, N, P to soil layers
do l=1, sol_nly(j)
sol_rsd(l,j) = sol_rsd(l,j) + rtfr(l) * rtresnew
sol_fon(l,j) = sol_fon(l,j) + rtfr(l) * plantn(j) * rwt(j)
sol_fop(l,j) = sol_fop(l,j) + rtfr(l) * plantp(j) * rwt(j)
!!insert new biomss by zhang
!!==============================
if (cswat == 2) then
!!all the lignin from STD is assigned to LSL,
!!add STDL calculation
!!
!sol_LSL(k,ihru) = sol_STDL(k,ihru)
!CLG=BLG(3,JJK)*HUI(JJK)/(HUI(JJK)+EXP(BLG(1,JJK)-BLG(2,JJK)*&HUI(JJK))
! 52 BLG1 = LIGNIN FRACTION IN PLANT AT .5 MATURITY
! 53 BLG2 = LIGNIN FRACTION IN PLANT AT MATURITY
!CROPCOM.dat BLG1 = 0.01 BLG2 = 0.10
!SUBROUTINE ASCRV(X1,X2,X3,X4)
!EPIC0810
!THIS SUBPROGRAM COMPUTES S CURVE PARMS GIVEN 2 (X,Y) POINTS.
!USE PARM
!XX=LOG(X3/X1-X3)
!X2=(XX-LOG(X4/X2-X4))/(X4-X3)
!X1=XX+X3*X2
!RETURN
!END
!HUI(JJK)=HU(JJK)/XPHU
BLG1 = 0.01/0.10
BLG2 = 0.99
BLG3 = 0.10
XX = log(0.5/BLG1-0.5)
BLG2 = (XX -log(1./BLG2-1.))/(1.-0.5)
BLG1 = XX + 0.5*BLG2
CLG=BLG3*phuacc(j)/(phuacc(j)+EXP(BLG1-BLG2*phuacc(j)))
if (l == 1) then
sf = 0.05
else
sf = 0.1
end if
!kg/ha
sol_min_n = 0.
sol_min_n = (sol_no3(l,j)+sol_nh3(l,j))
resnew = rtfr(l) * rtresnew
resnew_n = rtfr(l) *ff2 * (plantn(j) - yieldn)
resnew_ne = resnew_n + sf * sol_min_n
!Not sure 1000 should be here or not!
!RLN = 1000*(resnew * CLG/(resnew_n+1.E-5))
RLN = (resnew * CLG/(resnew_n+1.E-5))
RLR = MIN(.8, resnew * CLG/1000/(resnew/1000+1.E-5))
LMF = 0.85 - 0.018 * RLN
if (LMF <0.01) then
LMF = 0.01
else
if (LMF >0.7) then
LMF = 0.7
end if
end if
!if ((resnew * CLG/(resnew_n+1.E-5)) < 47.22) then
! LMF = 0.85 - 0.018 * (resnew * CLG/(resnew_n+1.E-5))
!else
! LMF = 0.
!end if
LSF = 1 - LMF
sol_LM(l,j) = sol_LM(l,j) + LMF * resnew
sol_LS(l,j) = sol_LS(l,j) + LSF * resnew
!here a simplified assumption of 0.5 LSL
!LSLF = 0.0
!LSLF = CLG
sol_LSL(l,j) = sol_LSL(l,j) + RLR*resnew
sol_LSC(l,j) = sol_LSC(l,j) + 0.42*LSF * resnew
sol_LSLC(l,j) = sol_LSLC(l,j) + RLR*0.42*resnew
sol_LSLNC(l,j) = sol_LSC(l,j) - sol_LSLC(l,j)
!X3 = MIN(X6,0.42*LSF * resnew/150)
if (resnew_ne >= (0.42 * LSF * resnew /150)) then
sol_LSN(l,j) = sol_LSN(l,j) + 0.42 * LSF * resnew / 150
sol_LMN(l,j) = sol_LMN(l,j) + resnew_ne -
& (0.42 * LSF * resnew / 150) + 1.E-25
else
sol_LSN(l,j) = sol_LSN(l,j) + resnew_ne
sol_LMN(l,j) = sol_LMN(l,j) + 1.E-25
end if
!LSNF = sol_LSN(l,j)/(sol_LS(l,j)+1.E-5)
sol_LMC(l,j) = sol_LMC(l,j) + 0.42 * LMF * resnew
!LMNF = sol_LMN(l,j)/(sol_LM(l,j) + 1.E-5)
!update no3 and nh3 in soil
sol_no3(l,j) = sol_no3(l,j) * (1-sf)
sol_nh3(l,j) = sol_nh3(l,j) * (1-sf)
end if
!!insert new biomss by zhang
!!===============================
end do
if (hrupest(j) == 1) then
do k = 1, npmx
sol_pst(k,j,1) = sol_pst(k,j,1) + plt_pst(k,j)
plt_pst(k,j) = 0.
end do
end if
bio_hv(icr(j),j) = bio_ms(j) + bio_hv(icr(j),j)
!bio_yrms(j) = bio_yrms(j) + bio_ms(j) / 1000.
!! reset variables
igro(j) = 0
idorm(j) = 0
bio_ms(j) = 0.
rwt(j) = 0.
plantn(j) = 0.
plantp(j) = 0.
strsw(j) = 1.
laiday(j) = 0.
hvstiadj(j) = 0.
phuacc(j) = 0.
! phubase(j) = 0.
rtfr = 0. ! Resetting roots fraction per layer array
return
end