-
Notifications
You must be signed in to change notification settings - Fork 1
/
LAND.FOR
673 lines (620 loc) · 33.1 KB
/
LAND.FOR
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
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
C=======================================================================
C COPYRIGHT 1998-2010 The University of Georgia, Griffin, Georgia
C University of Florida, Gainesville, Florida
C Iowa State University, Ames, Iowa
C International Center for Soil Fertility and
C Agricultural Development, Muscle Shoals, Alabama
C University of Guelph, Guelph, Ontario
C ALL RIGHTS RESERVED
C=======================================================================
C=======================================================================
C LAND UNIT Module. G.Hoogenboom, J.W.Jones, C.Porter
C-----------------------------------------------------------------------
C Land Unit Module. Provides the interface between soil, weather
C and crops. Based on the original CROPGRO routine
C=======================================================================
C REVISION HISTORY
C 12/01/2001 CHP Written.
C 12/12/2001 GH Rename to Land
! 10/24/2005 CHP Put weather variables in constructed variable.
! 02/28/2006 CHP Rename Alt_Plant to Plant, move call to CROPGRO there
! 03/03/2006 CHP Added tillage (A.Andales & WDBatchelor).
! 03/21/2006 CHP Added mulch effects
! 10/31/2007 CHP Added simple K model.
C=======================================================================
C-----------------------------------------------------------------------
C CROP should be modified when model versions change
C or when a crop specific model is created.
C
C CROP = CR Generic CRopgro model Version 3.90 (2002)
C CROP = BN for CROPGRO - DRY BEAN Version 3.9 (2002)
C CROP = PN for CROPGRO - PEANUT Version 3.9 (2002)
C CROP = SB for CROPGRO - SOYBEAN Version 3.9 (2002)
C CROP = FA for CROPGRO - FALLOW Version 3.9 (2002)
C CROP = TM for CROPGRO - TOMATO Version 3.9 (2002)
C CROP = PR for CROPGRO - PEPPER Version 3.9 (2002)
C CROP = PE for CROPGRO - PEA Version 3.9 (2002)
C CROP = CH for CROPGRO - CHICKPEA Version 3.9 (2002)
C CROP = PP for CROPGRO - PIGEONPEA Version 3.9 (2002)
C CROP = C3 for CROPGRO - C4 CROPS Version 3.9 (2002)
C CROP = C4 for CROPGRO - C3 CROPS Version 3.9 (2002)
C CROP = G0 for CROPGRO - GRASS-0 Version 3.9 (2002)
C CROP = G1 for CROPGRO - GRASS-1 Version 3.9 (2002)
C CROP = G2 for CROPGRO - GRASS-2 Version 3.9 (2002)
C CROP = G3 for CROPGRO - GRASS-3 Version 3.9 (2002)
C CROP = G4 for CROPGRO - GRASS-4 Version 3.9 (2002)
C CROP = G5 for CROPGRO - GRASS-5 Version 3.9 (2002)
C CROP = G6 for CROPGRO - GRASS-6 Version 3.9 (2002)
C CROP = G7 for CROPGRO - GRASS-7 Version 3.9 (2002)
C CROP = G8 for CROPGRO - GRASS-8 Version 3.9 (2002)
C CROP = BR for CROPGRO - Brachiaria
C decumbens Version 3.9 (2002)
C CROP = VB for CROPGRO - VELVETBEAN Version 3.9 (2002)
C CROP = FB for CROPGRO - FABA BEAN Version 3.9 (2002)
C CROP = NP for CROPGRO - Napier grassVersion 3.9 (2002)
C CROP = GB for CROPGRO - Green Bean Version 3.9 (2002)
C CROP = PE for CROPGRO - Pea Version 3.9 (2002)
C
C-GH Need to add other DSSAT-CSM crops
C CROP = BA for CSCERES - BARLEY Version 3.9 (2002)
C CROP = CB for CROPGRO - CABBAGE Version 3.9 (2002)
C CROP = CS for CSSIM - CASSAVA Version 3.9 (2002)
C CROP = CO for CROPGRO - COTTON Version 3.9 (2002)
C CROP = CP for CROPGRO - COWPEA Version 3.9 (2002)
C CROP = CT for CROPGRO - CITRUS Version 3.9 (2002)
C CROP = MZ for GECER - MAIZE Version 3.9 (2002)
C CROP = ML for GECER - MILLET Version 3.9 (2002)
C CROP = PI for PIAL - PINEAPPLE Version 3.9 (2002)
C CROP = PT for SUBSTOR - POTATO Version 3.9 (2002)
C CROP = RI for RICER - RICE Version 3.9 (2002)
C CROP = SC for SCCAN - SUGARCANE Version 3.9 (2002)
C CROP = SG for GECER - SORGHUM Version 3.9 (2002)
C CROP = SU for SUOIL - SUNFLOWER Version 3.9 (2002)
C CROP = TM for CROPGRO - TOMATO Version 3.9 (2002)
C CROP = TN for ARGRO - TANIER Version 3.9 (2002)
C CROP = TR for ARGRO - TARO Version 3.9 (2002)
C CROP = WH for CSCERES - WHEAT Version 3.9 (2002)
C=======================================================================
SUBROUTINE LAND(CONTROL, ISWITCH,
& YRPLT, MDATE, YREND)
C-----------------------------------------------------------------------
USE ModuleDefs
USE FloodModule
USE Cells_2D
IMPLICIT NONE
SAVE
C-----------------------------------------------------------------------
C Crop, Experiment, Command line Variables
C-----------------------------------------------------------------------
CHARACTER*2 CROP
CHARACTER*6 ERRKEY
PARAMETER (ERRKEY = 'LAND ')
CHARACTER*8 MODEL
CHARACTER*30 FILEIO
C-----------------------------------------------------------------------
C Date / Timing / Sequencing Variables
C-----------------------------------------------------------------------
INTEGER DYNAMIC, YRSIM, YRDOY
C-----------------------------------------------------------------------
C Input and Output Handling
C-----------------------------------------------------------------------
CHARACTER*1 IDETS, IPLTI
CHARACTER*78 MSG(2)
C-----------------------------------------------------------------------
C Weather module Variables
C-----------------------------------------------------------------------
TYPE (WeatherType) WEATHER
C-----------------------------------------------------------------------
C Soil Processes Module Variables
C-----------------------------------------------------------------------
REAL SNOW, WINF
REAL, DIMENSION(NL) :: NH4, NO3, SPi_Avail, SKi_Avail, ST
REAL, DIMENSION(NL) :: SW, SWDELTS, UPFLOW
TYPE (SoilType) SOILPROP, SoilProp_Furrow
TYPE (FloodWatType) FLOODWAT
TYPE (FloodNType) FloodN
TYPE (MulchType) MULCH
Type (CellType) Cells(MaxRows,MaxCols)
C-----------------------------------------------------------------------
C Soil - Plant - Atmosphere Module Variables
C-----------------------------------------------------------------------
REAL EO, EOP, ES, SRFTEMP, TRWUP
REAL SWDELTU(NL), SWDELTX(NL) !, RWU(NL)
! Needed for CaneGro_SA
REAL EOS, EP, TRWU
! Water stress factors computed in SPAM now for variable time step
! root water uptake model
REAL SWFAC, TURFAC
C-----------------------------------------------------------------------
C PLANT Module Variables
C-----------------------------------------------------------------------
INTEGER MDATE
INTEGER STGDOY(20)
REAL CANHT, EORATIO, NSTRES
REAL XHLAI, XLAI
REAL KSEVAP, KTRANS
REAL, Dimension(NL) :: PUptake, RLV, FracRts, UNH4, UNO3, KUptake
Type (ResidueType) HARVRES !type defined in ModuleDefs
Type (ResidueType) SENESCE
C-----------------------------------------------------------------------
C Operations Management Module Variables
C-----------------------------------------------------------------------
TYPE (TillType) TILLVALS
INTEGER YREND, YRPLT
REAL IRRAMT
REAL, DIMENSION(2) :: HARVFRAC !Harvest & byproduct fractions
TYPE (FertType) FERTDATA !Fertilizer application
TYPE (OrgMatAppType)OMAData !Organic matter application
C-----------------------------------------------------------------------
!! Temporary timer function
!! Date / time variables
! INTEGER DATE_TIME(8)
!! date_time(1) The 4-digit year
!! date_time(2) The month of the year
!! date_time(3) The day of the month
!! date_time(4) The time difference with respect to Coordinated Universal Time (UTC) in minutes
!! date_time(5) The hour of the day (range 0 to 23) - local time
!! date_time(6) The minutes of the hour (range 0 to 59) - local time
!! date_time(7) The seconds of the minute (range 0 to 59) - local time
!! date_time(8) The milliseconds of the second (range 0 to 999) - local time
! REAL TIME0, TIME1, TIME_START DELTA_TIME
C-----------------------------------------------------------------------
C Define constructed variable types based on definitions in
C ModuleDefs.for.
TYPE (ControlType) CONTROL
TYPE (SwitchType) ISWITCH
C Transfer values from constructed data types into local variables.
CROP = CONTROL % CROP
DYNAMIC = CONTROL % DYNAMIC
FILEIO = CONTROL % FILEIO
MODEL = CONTROL % MODEL
YRDOY = CONTROL % YRDOY
YRSIM = CONTROL % YRSIM
IPLTI = ISWITCH % IPLTI
C***********************************************************************
C***********************************************************************
C Run Initialization - Called once per simulation
C***********************************************************************
IF (DYNAMIC .EQ. RUNINIT) THEN
C-----------------------------------------------------------------------
!! Temporary timer function
! !Get initial time
! CALL DATE_AND_TIME (VALUES=DATE_TIME)
!! Convert time to seconds
! TIME0 = DATE_TIME(7)
! & + DATE_TIME(8) / 1000.
! & + DATE_TIME(6) * 60.
! & + DATE_TIME(5) * 3600.
! TIME_START = TIME0
C-----------------------------------------------------------------------
C Read switches from FILEIO
C-----------------------------------------------------------------------
CALL IPIBS (CONTROL, ISWITCH, CROP, IDETS, MODEL)
C-----------------------------------------------------------------------
C Read input parameters for weather routines
C-----------------------------------------------------------------------
CALL WEATHR(CONTROL, ISWITCH, WEATHER, YREND)
CALL MGMTOPS(CONTROL, ISWITCH,
& FLOODWAT, HARVRES, NSTRES, SOILPROP, ST, !Input
& STGDOY, SW, WEATHER, !Input
& YREND, FERTDATA, HARVFRAC, IRRAMT, !Output
& MDATE, OMADATA, TILLVALS, YRPLT) !Output
C-----------------------------------------------------------------------
C Read initial soil data
C-----------------------------------------------------------------------
CALL SOIL(CONTROL, ISWITCH,
& EOP, ES, FERTDATA, HARVRES, IRRAMT, KTRANS, !Input
& KUptake, OMAData, PUptake, SENESCE, SRFTEMP, ST,!Input
& FracRts, SWDELTX,TILLVALS, UNH4, UNO3, UPFLOW, !Input
& WEATHER, XHLAI, FLOODN, FLOODWAT, MULCH, !I/O
& NH4, NO3, SKi_AVAIL, SNOW, SPi_AVAIL, SOILPROP, !Output
& SOILPROP_furrow, SW, SWDELTS, SWDELTU, SWFAC, !Output
& TRWU, TRWUP, TURFAC, WINF, Cells, YREND) !Output
C-----------------------------------------------------------------------
C Read initial soil-plant-atmosphere data
C-----------------------------------------------------------------------
SELECT CASE(ISWITCH%MEHYD)
CASE ('G','C')
CALL SPAM_2D(CONTROL, ISWITCH,
& CELLS, CANHT, EORATIO, KSEVAP, KTRANS, !Input
& RLV, SOILPROP, SoilProp_Furrow, SW, !Input
& TRWU, WEATHER, XHLAI, XLAI, !Input
& FLOODWAT, !I/O
& EO, EOP, EOS, EP, ES, SRFTEMP, ST, !Output
& SWDELTX) !Output
CASE DEFAULT
CALL SPAM(CONTROL, ISWITCH,
& CANHT, EORATIO, KSEVAP, KTRANS, MULCH, !Input
& RLV, SOILPROP, SW, SWDELTS, WEATHER, !Input
& WINF, XHLAI, XLAI, !Input
& FLOODWAT, SWDELTU, !I/O
& EO, EOP, EOS, EP, ES, SRFTEMP, ST, SWDELTX, !Output
& SWFAC, TRWU, TRWUP, TURFAC, UPFLOW) !Output
END SELECT
C-----------------------------------------------------------------------
C Read initial plant module data
C-----------------------------------------------------------------------
CALL PLANT(CONTROL, ISWITCH,
& CELLS, EO, EOP, EOS, EP, ES, FLOODWAT, !Input
& HARVFRAC,NH4, NO3, SKi_Avail, SPi_AVAIL, !Input
& SNOW, SOILPROP, SRFTEMP, ST, SW, SWFAC, TRWU, !Input
& TRWUP, TURFAC, WEATHER, YREND, YRPLT, !Input
& FLOODN, !I/O
& CANHT, EORATIO, HARVRES, KSEVAP, KTRANS, !Output
& KUptake, MDATE, NSTRES, PUptake, RLV, SENESCE, !Output
& STGDOY, FracRts, UNH4, UNO3, XHLAI, XLAI) !Output
C-----------------------------------------------------------------------
C Initialize summary.out information
C-----------------------------------------------------------------------
CALL OPSUM (CONTROL, ISWITCH, YRPLT)
C***********************************************************************
C***********************************************************************
C SEASONAL INITIALIZATION
C***********************************************************************
ELSEIF (DYNAMIC .EQ. SEASINIT) THEN
C-----------------------------------------------------------------------
C Call WEATHR for initialization - reads first day of weather
C data for use in soil N and soil temp initialization.
C-----------------------------------------------------------------------
CALL WEATHR(CONTROL, ISWITCH, WEATHER, YREND)
C-----------------------------------------------------------------------
C Set planting date, adjust operations dates for seasonal or
C sequenced runs.
C-----------------------------------------------------------------------
CALL MGMTOPS(CONTROL, ISWITCH,
& FLOODWAT, HARVRES, NSTRES, SOILPROP, ST, !Input
& STGDOY, SW, WEATHER, !Input
& YREND, FERTDATA, HARVFRAC, IRRAMT, !Output
& MDATE, OMADATA, TILLVALS, YRPLT) !Output
C-----------------------------------------------------------------------
IF (YRPLT < YRSIM .AND. CROP /= 'FA' .AND. IPLTI /= 'A') THEN
IF ((CONTROL % RNMODE .EQ. "P") .AND. CONTROL % RUN .GT. 1)
& go to 1000 !JZW add this condition
CALL ERROR(ERRKEY,2,' ',0)
ENDIF
C-----------------------------------------------------------------------
C Seasonal initialization for soil-plant-atmosphere processes
! chp moved this before SOIL, so soil temp is available
C-----------------------------------------------------------------------
1000 SELECT CASE(ISWITCH%MEHYD)
CASE ('G','C')
CALL SPAM_2D(CONTROL, ISWITCH,
& CELLS, CANHT, EORATIO, KSEVAP, KTRANS, !Input
& RLV, SOILPROP, SoilProp_Furrow, SW, !Input
& TRWU, WEATHER, XHLAI, XLAI, !Input
& FLOODWAT, !I/O
& EO, EOP, EOS, EP, ES, SRFTEMP, ST, !Output
& SWDELTX) !Output
CASE DEFAULT
CALL SPAM(CONTROL, ISWITCH,
& CANHT, EORATIO, KSEVAP, KTRANS, MULCH, !Input
& RLV, SOILPROP, SW, SWDELTS, WEATHER, !Input
& WINF, XHLAI, XLAI, !Input
& FLOODWAT, SWDELTU, !I/O
& EO, EOP, EOS, EP, ES, SRFTEMP, ST, SWDELTX, !Output
& SWFAC, TRWU, TRWUP, TURFAC, UPFLOW) !Output
END SELECT
C-----------------------------------------------------------------------
C Seasonal initialization for soil processes
C-----------------------------------------------------------------------
CALL SOIL(CONTROL, ISWITCH,
& EOP, ES, FERTDATA, HARVRES, IRRAMT, KTRANS, !Input
& KUptake, OMAData, PUptake, SENESCE, SRFTEMP, ST,!Input
& FracRts, SWDELTX,TILLVALS, UNH4, UNO3, UPFLOW, !Input
& WEATHER, XHLAI, FLOODN, FLOODWAT, MULCH, !I/O
& NH4, NO3, SKi_AVAIL, SNOW, SPi_AVAIL, SOILPROP, !Output
& SOILPROP_furrow, SW, SWDELTS, SWDELTU, SWFAC, !Output
& TRWU, TRWUP, TURFAC, WINF, Cells, YREND) !Output
C-----------------------------------------------------------------------
C Initialize PLANT routines (including phenology and pest)
C-----------------------------------------------------------------------
CALL PLANT(CONTROL, ISWITCH,
& CELLS, EO, EOP, EOS, EP, ES, FLOODWAT, !Input
& HARVFRAC,NH4, NO3, SKi_Avail, SPi_AVAIL, !Input
& SNOW, SOILPROP, SRFTEMP, ST, SW, SWFAC, TRWU, !Input
& TRWUP, TURFAC, WEATHER, YREND, YRPLT, !Input
& FLOODN, !I/O
& CANHT, EORATIO, HARVRES, KSEVAP, KTRANS, !Output
& KUptake, MDATE, NSTRES, PUptake, RLV, SENESCE, !Output
& STGDOY, FracRts, UNH4, UNO3, XHLAI, XLAI) !Output
C-----------------------------------------------------------------------
C Initialize summary output file - possible output from
C various modules.
C-----------------------------------------------------------------------
IF (IDETS .EQ. 'Y' .OR. IDETS .EQ. 'A') THEN
CALL OPSUM (CONTROL, ISWITCH, YRPLT)
ENDIF
C***********************************************************************
C***********************************************************************
C DAILY RATE CALCULATIONS
C***********************************************************************
ELSE IF (DYNAMIC .EQ. RATE) THEN
C-----------------------------------------------------------------------
C Call WEATHER Subroutine to input weather data and to
C calculate hourly radiation and air temperature values
C Note: First day of weather has already been read by
C initialization call to WEATHR.
C-----------------------------------------------------------------------
CALL WEATHR(CONTROL, ISWITCH, WEATHER, YREND)
C-----------------------------------------------------------------------
C Call Operations Management module to determine today's
C applications of irrigation, tillage, etc.
C-----------------------------------------------------------------------
CALL MGMTOPS(CONTROL, ISWITCH,
& FLOODWAT, HARVRES, NSTRES, SOILPROP, ST, !Input
& STGDOY, SW, WEATHER, !Input
& YREND, FERTDATA, HARVFRAC, IRRAMT, !Output
& MDATE, OMADATA, TILLVALS, YRPLT) !Output
!-----------------------------------------------------------------------
! For 2D model, SPAM must be called before WATBAL
! Call Soil-plant-atmosphere module to determine today's
! rates of evapotranspiration.
!-----------------------------------------------------------------------
IF (INDEX('GC',ISWITCH%MEHYD) > 0) THEN
CALL SPAM_2D(CONTROL, ISWITCH,
& CELLS, CANHT, EORATIO, KSEVAP, KTRANS, !Input
& RLV, SOILPROP, SoilProp_Furrow, SW, !Input
& TRWU, WEATHER, XHLAI, XLAI, !Input
& FLOODWAT, !I/O
& EO, EOP, EOS, EP, ES, SRFTEMP, ST, !Output
& SWDELTX) !Output
ENDIF
C-----------------------------------------------------------------------
C Call Soil processes module to determine today's rates of
C change of soil properties.
C-----------------------------------------------------------------------
CALL SOIL(CONTROL, ISWITCH,
& EOP, ES, FERTDATA, HARVRES, IRRAMT, KTRANS, !Input
& KUptake, OMAData, PUptake, SENESCE, SRFTEMP, ST,!Input
& FracRts, SWDELTX,TILLVALS, UNH4, UNO3, UPFLOW, !Input
& WEATHER, XHLAI, FLOODN, FLOODWAT, MULCH, !I/O
& NH4, NO3, SKi_AVAIL, SNOW, SPi_AVAIL, SOILPROP, !Output
& SOILPROP_furrow, SW, SWDELTS, SWDELTU, SWFAC, !Output
& TRWU, TRWUP, TURFAC, WINF, Cells, YREND) !Output
C-----------------------------------------------------------------------
C Call Soil-plant-atmosphere module to determine today's
C rates of evapotranspiration.
C-----------------------------------------------------------------------
IF (INDEX('GC',ISWITCH%MEHYD) == 0) THEN
CALL SPAM(CONTROL, ISWITCH,
& CANHT, EORATIO, KSEVAP, KTRANS, MULCH, !Input
& RLV, SOILPROP, SW, SWDELTS, WEATHER, !Input
& WINF, XHLAI, XLAI, !Input
& FLOODWAT, SWDELTU, !I/O
& EO, EOP, EOS, EP, ES, SRFTEMP, ST, SWDELTX, !Output
& SWFAC, TRWU, TRWUP, TURFAC, UPFLOW) !Output
ENDIF
C-----------------------------------------------------------------------
C Call PLANT Subroutine to calculate crop growth and
C development rates.
C Skip plant growth and development routines for fallow runs
C-----------------------------------------------------------------------
IF (CROP .NE. 'FA' .AND.
& YRDOY .GE. YRPLT .AND. YRPLT .NE. -99) THEN
CALL PLANT(CONTROL, ISWITCH,
& CELLS, EO, EOP, EOS, EP, ES, FLOODWAT, !Input
& HARVFRAC,NH4, NO3, SKi_Avail, SPi_AVAIL, !Input
& SNOW, SOILPROP, SRFTEMP, ST, SW, SWFAC, TRWU, !Input
& TRWUP, TURFAC, WEATHER, YREND, YRPLT, !Input
& FLOODN, !I/O
& CANHT, EORATIO, HARVRES, KSEVAP, KTRANS, !Output
& KUptake, MDATE, NSTRES, PUptake, RLV, SENESCE, !Output
& STGDOY, FracRts, UNH4, UNO3, XHLAI, XLAI) !Output
ENDIF
C***********************************************************************
C DAILY INTEGRATION
C***********************************************************************
ELSE IF (DYNAMIC .EQ. INTEGR) THEN
C***********************************************************************
C Integrate soil state variables
C-----------------------------------------------------------------------
CALL SOIL(CONTROL, ISWITCH,
& EOP, ES, FERTDATA, HARVRES, IRRAMT, KTRANS, !Input
& KUptake, OMAData, PUptake, SENESCE, SRFTEMP, ST,!Input
& FracRts, SWDELTX,TILLVALS, UNH4, UNO3, UPFLOW, !Input
& WEATHER, XHLAI, FLOODN, FLOODWAT, MULCH, !I/O
& NH4, NO3, SKi_AVAIL, SNOW, SPi_AVAIL, SOILPROP, !Output
& SOILPROP_furrow, SW, SWDELTS, SWDELTU, SWFAC, !Output
& TRWU, TRWUP, TURFAC, WINF, Cells, YREND) !Output
C-----------------------------------------------------------------------
C Compute cumulative totals for soil-plant-atmosphere processes
C-----------------------------------------------------------------------
SELECT CASE(ISWITCH%MEHYD)
CASE ('G','C')
CALL SPAM_2D(CONTROL, ISWITCH,
& CELLS, CANHT, EORATIO, KSEVAP, KTRANS, !Input
& RLV, SOILPROP, SoilProp_Furrow, SW, !Input
& TRWU, WEATHER, XHLAI, XLAI, !Input
& FLOODWAT, !I/O
& EO, EOP, EOS, EP, ES, SRFTEMP, ST, !Output
& SWDELTX) !Output
CASE DEFAULT
CALL SPAM(CONTROL, ISWITCH,
& CANHT, EORATIO, KSEVAP, KTRANS, MULCH, !Input
& RLV, SOILPROP, SW, SWDELTS, WEATHER, !Input
& WINF, XHLAI, XLAI, !Input
& FLOODWAT, SWDELTU, !I/O
& EO, EOP, EOS, EP, ES, SRFTEMP, ST, SWDELTX, !Output
& SWFAC, TRWU, TRWUP, TURFAC, UPFLOW) !Output
END SELECT
C-----------------------------------------------------------------------
C Call Plant module to integrate daily plant processes and update
C plant state variables.
C-----------------------------------------------------------------------
IF (CROP .NE. 'FA' .AND.
& YRDOY .GE. YRPLT .AND. YRPLT .NE. -99) THEN
CALL PLANT(CONTROL, ISWITCH,
& CELLS, EO, EOP, EOS, EP, ES, FLOODWAT, !Input
& HARVFRAC,NH4, NO3, SKi_Avail, SPi_AVAIL, !Input
& SNOW, SOILPROP, SRFTEMP, ST, SW, SWFAC, TRWU, !Input
& TRWUP, TURFAC, WEATHER, YREND, YRPLT, !Input
& FLOODN, !I/O
& CANHT, EORATIO, HARVRES, KSEVAP, KTRANS, !Output
& KUptake, MDATE, NSTRES, PUptake, RLV, SENESCE, !Output
& STGDOY, FracRts, UNH4, UNO3, XHLAI, XLAI) !Output
ENDIF
C-----------------------------------------------------------------------
C Call Operations Management module to check for harvest end,
C accumulate variables.
C-----------------------------------------------------------------------
CALL MGMTOPS(CONTROL, ISWITCH,
& FLOODWAT, HARVRES, NSTRES, SOILPROP, ST, !Input
& STGDOY, SW, WEATHER, !Input
& YREND, FERTDATA, HARVFRAC, IRRAMT, !Output
& MDATE, OMADATA, TILLVALS, YRPLT) !Output
C***********************************************************************
C***********************************************************************
C Daily Output
C***********************************************************************
ELSE IF (DYNAMIC .EQ. OUTPUT) THEN
CALL WEATHR(CONTROL, ISWITCH, WEATHER, YREND)
CALL SOIL(CONTROL, ISWITCH,
& EOP, ES, FERTDATA, HARVRES, IRRAMT, KTRANS, !Input
& KUptake, OMAData, PUptake, SENESCE, SRFTEMP, ST,!Input
& FracRts, SWDELTX,TILLVALS, UNH4, UNO3, UPFLOW, !Input
& WEATHER, XHLAI, FLOODN, FLOODWAT, MULCH, !I/O
& NH4, NO3, SKi_AVAIL, SNOW, SPi_AVAIL, SOILPROP, !Output
& SOILPROP_furrow, SW, SWDELTS, SWDELTU, SWFAC, !Output
& TRWU, TRWUP, TURFAC, WINF, Cells, YREND) !Output
SELECT CASE(ISWITCH%MEHYD)
CASE ('G','C')
CALL SPAM_2D(CONTROL, ISWITCH,
& CELLS, CANHT, EORATIO, KSEVAP, KTRANS, !Input
& RLV, SOILPROP, SoilProp_Furrow, SW, !Input
& TRWU, WEATHER, XHLAI, XLAI, !Input
& FLOODWAT, !I/O
& EO, EOP, EOS, EP, ES, SRFTEMP, ST, !Output
& SWDELTX) !Output
CASE DEFAULT
CALL SPAM(CONTROL, ISWITCH,
& CANHT, EORATIO, KSEVAP, KTRANS, MULCH, !Input
& RLV, SOILPROP, SW, SWDELTS, WEATHER, !Input
& WINF, XHLAI, XLAI, !Input
& FLOODWAT, SWDELTU, !I/O
& EO, EOP, EOS, EP, ES, SRFTEMP, ST, SWDELTX, !Output
& SWFAC, TRWU, TRWUP, TURFAC, UPFLOW) !Output
END SELECT
C-----------------------------------------------------------------------
C Call plant module for daily printout.
C-----------------------------------------------------------------------
IF (CROP .NE. 'FA') THEN
CALL PLANT(CONTROL, ISWITCH,
& CELLS, EO, EOP, EOS, EP, ES, FLOODWAT, !Input
& HARVFRAC,NH4, NO3, SKi_Avail, SPi_AVAIL, !Input
& SNOW, SOILPROP, SRFTEMP, ST, SW, SWFAC, TRWU, !Input
& TRWUP, TURFAC, WEATHER, YREND, YRPLT, !Input
& FLOODN, !I/O
& CANHT, EORATIO, HARVRES, KSEVAP, KTRANS, !Output
& KUptake, MDATE, NSTRES, PUptake, RLV, SENESCE, !Output
& STGDOY, FracRts, UNH4, UNO3, XHLAI, XLAI) !Output
ENDIF
CALL MGMTOPS(CONTROL, ISWITCH,
& FLOODWAT, HARVRES, NSTRES, SOILPROP, ST, !Input
& STGDOY, SW, WEATHER, !Input
& YREND, FERTDATA, HARVFRAC, IRRAMT, !Output
& MDATE, OMADATA, TILLVALS, YRPLT) !Output
C***********************************************************************
C***********************************************************************
C Seasonal Output
C***********************************************************************
ELSE IF (DYNAMIC .EQ. SEASEND) THEN
C Call WEATHER module to close current weather file
CALL WEATHR(CONTROL, ISWITCH, WEATHER, YREND)
C Print seasonal summaries and close files.
CALL SOIL(CONTROL, ISWITCH,
& EOP, ES, FERTDATA, HARVRES, IRRAMT, KTRANS, !Input
& KUptake, OMAData, PUptake, SENESCE, SRFTEMP, ST,!Input
& FracRts, SWDELTX,TILLVALS, UNH4, UNO3, UPFLOW, !Input
& WEATHER, XHLAI, FLOODN, FLOODWAT, MULCH, !I/O
& NH4, NO3, SKi_AVAIL, SNOW, SPi_AVAIL, SOILPROP, !Output
& SOILPROP_furrow, SW, SWDELTS, SWDELTU, SWFAC, !Output
& TRWU, TRWUP, TURFAC, WINF, Cells, YREND) !Output
SELECT CASE(ISWITCH%MEHYD)
CASE ('G','C')
CALL SPAM_2D(CONTROL, ISWITCH,
& CELLS, CANHT, EORATIO, KSEVAP, KTRANS, !Input
& RLV, SOILPROP, SoilProp_Furrow, SW, !Input
& TRWU, WEATHER, XHLAI, XLAI, !Input
& FLOODWAT, !I/O
& EO, EOP, EOS, EP, ES, SRFTEMP, ST, !Output
& SWDELTX) !Output
CASE DEFAULT
CALL SPAM(CONTROL, ISWITCH,
& CANHT, EORATIO, KSEVAP, KTRANS, MULCH, !Input
& RLV, SOILPROP, SW, SWDELTS, WEATHER, !Input
& WINF, XHLAI, XLAI, !Input
& FLOODWAT, SWDELTU, !I/O
& EO, EOP, EOS, EP, ES, SRFTEMP, ST, SWDELTX, !Output
& SWFAC, TRWU, TRWUP, TURFAC, UPFLOW) !Output
END SELECT
CALL PLANT(CONTROL, ISWITCH,
& CELLS, EO, EOP, EOS, EP, ES, FLOODWAT, !Input
& HARVFRAC,NH4, NO3, SKi_Avail, SPi_AVAIL, !Input
& SNOW, SOILPROP, SRFTEMP, ST, SW, SWFAC, TRWU, !Input
& TRWUP, TURFAC, WEATHER, YREND, YRPLT, !Input
& FLOODN, !I/O
& CANHT, EORATIO, HARVRES, KSEVAP, KTRANS, !Output
& KUptake, MDATE, NSTRES, PUptake, RLV, SENESCE, !Output
& STGDOY, FracRts, UNH4, UNO3, XHLAI, XLAI) !Output
C Call management operations module for seasonal printout.
CALL MGMTOPS(CONTROL, ISWITCH,
& FLOODWAT, HARVRES, NSTRES, SOILPROP, ST, !Input
& STGDOY, SW, WEATHER, !Input
& YREND, FERTDATA, HARVFRAC, IRRAMT, !Output
& MDATE, OMADATA, TILLVALS, YRPLT) !Output
C-----------------------------------------------------------------------
C Seasonal Output
C Call end of season and summary output subroutines
C-----------------------------------------------------------------------
CALL OPSUM (CONTROL, ISWITCH, YRPLT)
!! Temporary timer function
! CALL DATE_AND_TIME (VALUES=DATE_TIME)
!
!! Convert time to seconds
! TIME1 = DATE_TIME(7)
! & + DATE_TIME(8) / 1000.
! & + DATE_TIME(6) * 60.
! & + DATE_TIME(5) * 3600.
! DELTA_TIME = TIME1 - TIME0
! WRITE(200,'(1X,"RUN ",I3,3X,F10.3)') RUN, DELTA_TIME
! TIME0 = TIME1
WRITE(MSG(1),'(A,I8)') "End of run ", CONTROL % RUN
IF (CONTROL % ERRCODE > 0) THEN
WRITE(MSG(2),'("Simulation ended with error code ",I3)')
& CONTROL % ERRCODE
CALL WARNING(2,'ENDRUN',MSG)
CALL INFO(2,'ENDRUN',MSG)
ELSE
CALL WARNING(0,'ENDRUN',MSG)
CALL INFO(1,'ENDRUN',MSG)
ENDIF
C***********************************************************************
C***********************************************************************
C End of Run
C***********************************************************************
ELSE IF (DYNAMIC .EQ. ENDRUN) THEN
CALL SOIL(CONTROL, ISWITCH,
& EOP, ES, FERTDATA, HARVRES, IRRAMT, KTRANS, !Input
& KUptake, OMAData, PUptake, SENESCE, SRFTEMP, ST,!Input
& FracRts, SWDELTX,TILLVALS, UNH4, UNO3, UPFLOW, !Input
& WEATHER, XHLAI, FLOODN, FLOODWAT, MULCH, !I/O
& NH4, NO3, SKi_AVAIL, SNOW, SPi_AVAIL, SOILPROP, !Output
& SOILPROP_furrow, SW, SWDELTS, SWDELTU, SWFAC, !Output
& TRWU, TRWUP, TURFAC, WINF, Cells, YREND) !Output
!! Temporary timer function
! CALL DATE_AND_TIME (VALUES=DATE_TIME)
!
!! Convert time to seconds
! TIME1 = DATE_TIME(7)
! & + DATE_TIME(8) / 1000.
! & + DATE_TIME(6) * 60.
! & + DATE_TIME(5) * 3600.
! DELTA_TIME = TIME1 - TIME_START
! WRITE(200,'(/," Total Time",F10.3)') RUN, DELTA_TIME
!***********************************************************************
!***********************************************************************
! END OF DYNAMIC IF CONSTRUCT
!***********************************************************************
ENDIF
RETURN
END SUBROUTINE LAND