-
Notifications
You must be signed in to change notification settings - Fork 1
/
DEMAND.FOR
1292 lines (1218 loc) · 60.8 KB
/
DEMAND.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
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
!=======================================================================
! DEMAND, Subroutine, J.W. Jones and G. Hoogenboom.
!-----------------------------------------------------------------------
! Calculates potential demand for C and N based upon new growth and
! existing N deficiency in old tissue.
!-----------------------------------------------------------------------
! REVISION HISTORY
! 01/01/1990 JWJ Written.
! 02/01/1993 GH Revised.
! 04/24/1994 NBP Changed TAIRHR to TGRO.
! 08/22/1995 GH Added seed composition routine from KJB & ELPiper
! 04/02/1996 JWJ Modified partitioning during early growth
! 01/10/1997 GH Added TURFAC effect on seed growth and pod addition
! 09/15/1998 CHP Modified for modular format
! 05/10/1999 GH Incorporated in CROPGRO
!-----------------------------------------------------------------------
! Called by: PLANT
! Calls: SDCOMP, IPDMND
!=======================================================================
SUBROUTINE DEMAND(DYNAMIC, CONTROL,
& AGRLF, AGRRT, AGRSH2, AGRSTM, CROP, DRPP, DXR57, !Input
& FILECC, FILEGC, FILEIO, FNINSH, FRACDN, LAGSD, !Input
& LNGPEG, NDLEAF, NSTRES, PAR, PCNL, PCNRT, PCNST, !Input
& PGAVL, PUNCSD, PUNCTR, PLTPOP, RPROAV, RTWT, !Input
& SDDES, SDNO, SDVAR, SHELN, SHVAR, STMWT, SWFAC, !Input
& TAVG, TDUMX, TDUMX2, TGRO, TURFAC, VSTAGE, WCRLF, !Input
& WCRRT, WCRST, WNRLF, WNRRT, WNRSH, WNRST, WTLF, !Input
& WTSD, WTSHE, XPOD, NVEG0, NR1, NR2, NR5, NR7, !Input
& AGRSD1, AGRSD2, AGRVG, AGRVG2, CDMREP, F, FNINL, !Output
& FNINR, FNINS, FNINSD, FRLF, FRRT, FRSTM, GDMSD, !Output
& GRRAT1, NDMNEW, NDMOLD, NDMREP, NDMSDR, NDMTOT, !Output
& NDMVEG, NMINEP, NMOBR, PHTIM, PNTIM, POTCAR, !Output
& POTLIP, SDGR, TURADD, XFRT, YREND) !Output
!-----------------------------------------------------------------------
USE ModuleDefs
USE ModuleData
IMPLICIT NONE
SAVE
CHARACTER*2 CROP
CHARACTER*3 TYPSDT
CHARACTER*6 ERRKEY
PARAMETER (ERRKEY = 'DEMAND')
CHARACTER*30 FILEIO
CHARACTER*78 MSG(2)
CHARACTER*92 FILECC, FILEGC
INTEGER DYNAMIC !, TIMDIF
INTEGER NPP, I, NAGE, DAS
INTEGER NDLEAF, NR1, NR2, NR5, NR7, NVEG0, YREND
REAL FRLFM, FRSTMM, YY, XX, TMPFAC
REAL REDPUN,TMPFCS,PAGE,REDSHL,SDMAX,CDMSH,GDMSH,ADDSHL
REAL TEMXFR,CAVTOT,GDMSDO,CNOLD
REAL NVSTL,NVSTS,NVSTR,FRNLFT
REAL TABEX,CURV
REAL POTLIP, POTCAR
REAL TPHFAC,PARSLA,FFVEG
REAL GROYES,GAINNW,GAINWT
REAL SLAVAR, SLAREF, FINREF
REAL SLAMAX, SLAMIN, THRESH
REAL AGRSH2, AGRRT, AGRSTM, FRLFF, FRSTMF
REAL CARMIN, LIPOPT, LIPTB, SLOSUM
REAL AGRLF, AGRSD1, AGRSD2, AGRVG, AGRVG2,
& CDMREP, CDMSD, CDMSDR, CDMTOT,
& CDMVEG, DRPP, DUMFAC, DXR57, F,
& FNINL, FNINR, FNINS, FNINSD, FNINSH,
& FRACDN, FRLF, FRLFMX,
& FRRT, FRSTM, FVEG,
& GDMSD, GDMSDR,
& GROMAX, GRRAT1, LAGSD, LNGPEG, LNGSH,
& NDMNEW, NDMOLD, NDMREP,
& NDMSD, NDMSDR, NDMSH, NDMTOT, NDMVEG,
& NMINEP, NMOBMX, NMOBR, NRCVR, NSTRES,
& NVSMOB,
& PAR, PCNL, PCNRT, PCNST,
& PGAVL, PLIGSD, PLTPOP, PMINSD, POASD,
& PROLFF, PROLFI,
& PRORTF, PRORTI, PROSTF, PROSTI, RCH2O,
& RLIG, RLIP, RMIN, RNO3C,
& ROA, RPRO, RPROAV, RTWT, SDGR,
& SDLIP, SDPRO, SDVAR, SHLAG, SHVAR,
& SIZELF, SIZREF, SLAMN, SLAMX, SLAPAR,
& SRMAX, STMWT, SWFAC, TAVG, TDUMX,
& SIZRAT, TDUMX2,
& TURADD, TURFAC, TURSLA, TURXFR,
& VSSINK, VSTAGE, WCRLF, WCRRT, WCRST, WNRLF,
& WNRRT, WNRSH, WNRST, WTLF, XFRMAX,
& XFRT, XFRUIT, XPOD
REAL FNSDT(4)
REAL XVGROW(6), YVGROW(6), YVREF(6)
REAL XSLATM(10), YSLATM(10), XTRFAC(10), YTRFAC(10),
& XXFTEM(10), YXFTEM(10)
REAL XLEAF(25), YLEAF(25), YSTEM(25)
REAL TGRO(TS)
REAL SDDES(NCOHORTS), SDNO(NCOHORTS), SHELN(NCOHORTS)
REAL WTSD(NCOHORTS), WTSHE(NCOHORTS)
REAL PHTIM(NCOHORTS), PNTIM(NCOHORTS)
REAL TURFSL
!CHP - puncture variables, not functional
REAL PUNCSD, PUNCTR, RPRPUN
TYPE (ControlType) CONTROL
!***********************************************************************
!***********************************************************************
! Run Initialization - Called once per simulation
!***********************************************************************
IF (DYNAMIC .EQ. RUNINIT) THEN
!-----------------------------------------------------------------------
CALL IPDMND(
& FILECC, FILEGC, FILEIO, !Input
& CARMIN, FINREF, FNSDT, FRLFF, FRLFMX, !Output
& FRSTMF, LIPOPT, LIPTB, LNGSH, NMOBMX, !Output
& NRCVR, NVSMOB, PLIGSD, PMINSD, POASD, !Output
& PROLFF, PROLFI, PRORTF, PRORTI, PROSTF, PROSTI, !Output
& RCH2O, RLIG, RLIP, RMIN, RNO3C, ROA, !Output
& RPRO, SDLIP, SDPRO, SHLAG, SLAMAX, SLAMIN, !Output
& SLAPAR, SLAREF, SLAVAR, SLOSUM, SIZELF, SIZREF, !Output
& SRMAX, THRESH, TURSLA, TYPSDT, VSSINK, XFRMAX, !Output
& XFRUIT, XLEAF, XSLATM, XTRFAC, XVGROW, XXFTEM, !Output
& YLEAF, YSLATM, YSTEM, YTRFAC, YVREF, YXFTEM) !Output
!***********************************************************************
!***********************************************************************
! Seasonal initialization - run once per season
!***********************************************************************
ELSEIF (DYNAMIC .EQ. SEASINIT) THEN
!-----------------------------------------------------------------------
CDMSDR = 0.0
GDMSDR = 0.0
FNINSD = 0.0
NDMNEW = 0.0
NDMREP = 0.0
NDMSD = 0.0
NDMSH = 0.0
NDMSDR = 0.0
NDMVEG = 0.0
NMOBR = 0.0
SDGR = 0.0
FNINL = 0.0
FNINS = 0.0
FNINR = 0.0
NMINEP = 0.0
RPRPUN = 1.0
TMPFAC = 1.0
!-----------------------------------------------------------------------
! SET VARIETY SPECIFIC LEAF PARAMETERS
!-----------------------------------------------------------------------
IF (CROP .NE. 'FA') THEN
DUMFAC = SLAVAR / SLAREF
F = DUMFAC * FINREF
FVEG = DUMFAC * SLAMAX
SLAMN = DUMFAC * SLAMIN
SLAMX = DUMFAC * SLAMAX
GROMAX = 0.0
SIZRAT = SIZELF / SIZREF
DO I = 1,6
YVGROW(I) = SIZRAT * YVREF(I)
ENDDO
!-----------------------------------------------------------------------
! INITIALIZE PARTITIONING PARAMETERS
!-----------------------------------------------------------------------
FRLF = TABEX(YLEAF,XLEAF,0.0,8)
FRSTM = TABEX(YSTEM,XLEAF,0.0,8)
FRRT = 1.0 - FRLF - FRSTM
ENDIF
!***********************************************************************
!***********************************************************************
! EMERGENCE CALCULATIONS - Performed once per season upon emergence
! or transplanting of plants
!***********************************************************************
ELSEIF (DYNAMIC .EQ. EMERG) THEN
!-----------------------------------------------------------------------
XFRT = XFRUIT
ADDSHL = 0.0
TURXFR = 0.0
GDMSD = 0.0
CDMSD = 0.0
NDMSD = 0.0
GDMSDR = 0.0
CDMSDR = 0.0
NDMSDR = 0.0
CDMREP = 0.0
NAGE = 0
DO NPP = 1,NCOHORTS
PHTIM(NPP) = 0.
PNTIM(NPP) = 0.
END DO
FNINSD = SDPRO * 0.16
FNINL = PROLFI * 0.16
FNINS = PROSTI * 0.16
FNINR = PRORTI * 0.16
!***********************************************************************
!***********************************************************************
! DAILY RATE/INTEGRATION
!***********************************************************************
ELSEIF (DYNAMIC .EQ. INTEGR) THEN
!-----------------------------------------------------------------------
! DAS = MAX(0,TIMDIF(YRSIM,YRDOY))
CALL GET(CONTROL)
DAS = CONTROL % DAS
!-----------------------------------------------------------------------
! Compute max N mining, NMINEP, based on stage-dependent mining
! rate, NMOBR
!-----------------------------------------------------------------------
! Assume that a Maximum Fraction (NMOBMX) of N can be Mobilized per Day
! NVSMOB is the relative N mobil rate in veg stage, rel to reprod. stage
!-----------------------------------------------------------------------
! 9/27/95 ACCELERATE N MOBILIZATION AFTER R5, FUNCTION OF (1-SWFAC)
! ALLOWS ACCELERATING BY 50% IF MAX DEFICIT.
! 2/6/96 SOMETIMES SEEDS FILL, XPOD IS LOW, THEN N MOBILIZATION SLOWS
! I DON'T REALLY WANT THAT, LATE IN CYCLE. KJB
! NOW, DXR57 HITS CLOSE TO 1 AT MATURITY AND PREVENTS THAT
!-----------------------------------------------------------------------
NMOBR = NVSMOB * NMOBMX * TDUMX
IF (DAS .GT. NR5) THEN
NMOBR = NMOBMX * TDUMX2 * (1.0 + 0.5*(1.0 - SWFAC))
& * (1.0 + 0.3*(1.0 - NSTRES)) * (NVSMOB + (1. - NVSMOB)
& * MAX(XPOD,DXR57**2.))
ENDIF
NMINEP = NMOBR * (WNRLF + WNRST + WNRRT + WNRSH)
!-----------------------------------------------------------------------
IF (DAS .GE. NR1) THEN
!-----------------------------------------------------------------------
! Accumulate physiological age of flower (PNTIM) and pod (PHTIM) cohorts
!-----------------------------------------------------------------------
IF (DAS - NR1 + 1 > NCOHORTS) THEN
WRITE(MSG(1),'(A,I5)')
& 'Number of flower cohorts exceeds maximum limit of',NCOHORTS
CALL WARNING(1,ERRKEY,MSG)
CALL ErrorCode(CONTROL, 100, ERRKEY, YREND)
RETURN
ENDIF
IF (DAS .EQ. NR1) THEN
PNTIM(1) = 0.0
ELSE
PNTIM(DAS - NR1 + 1) = PNTIM(DAS - NR1) + TDUMX
ENDIF
IF (DAS .LE. NR2) THEN
PHTIM(1) = 0.0
ELSE
PHTIM(DAS - NR2 + 1) = PHTIM(DAS - NR2) + TDUMX
ENDIF
!-----------------------------------------------------------------------
! Calculate function for modifying seed growth rate with temperature
!-----------------------------------------------------------------------
TMPFAC = 0.
TMPFCS = 0.
DO I = 1,24
TMPFAC =CURV(TYPSDT,FNSDT(1),FNSDT(2),FNSDT(3),FNSDT(4),
& TGRO(I))
TMPFCS = TMPFCS + TMPFAC
ENDDO
TMPFAC = TMPFCS / 24.
!-----------------------------------------------------------------------
! Calculate reduction in seed growth due to insect punctures
!-----------------------------------------------------------------------
IF (PUNCSD .GT. 0.001) THEN
REDPUN = 1.0 - (PUNCTR/PUNCSD) * RPRPUN
REDPUN = MAX(0.0,REDPUN)
ELSE
REDPUN = 1.0
ENDIF
!-----------------------------------------------------------------------
! Water stress factor (TURADD) effect on reproductive growth and
! pod addition. Stress is defined to INCREASE growth and addition.
!-----------------------------------------------------------------------
TURADD = TABEX (YTRFAC,XTRFAC,TURFAC,4)
!-----------------------------------------------------------------------
! Calculate maximum growth per seed based on temp and seed punctures
!-----------------------------------------------------------------------
SDGR = SDVAR * TMPFAC * REDPUN * (1.-(1.-DRPP)*SRMAX) *
& (1. + TURADD)
!-----------------------------------------------------------------------
! Initialize Seed Growth Demands and CH2O and N required for seed
! growth
!-----------------------------------------------------------------------
GDMSD = 0.0
CDMSD = 0.0
NDMSD = 0.0
GDMSDR = 0.0
CDMSDR = 0.0
NDMSDR = 0.0
!-----------------------------------------------------------------------
IF (DAS .GT. NR2) THEN
DO NPP = 1, DAS - NR2
!-----------------------------------------------------------------------
! Calculate physiol age of seed cohort. Do not allow seed to grow
! until shells are greater than LAGSD physiol age.
!-----------------------------------------------------------------------
PAGE = PHTIM(DAS - NR2 + 1) - PHTIM(NPP)
IF (PAGE .GE. LAGSD) THEN
!-----------------------------------------------------------------------
! Allow cohort growth until threshing limit (seed wt./pod wt) occurs
! taking into account damage by pests to seed and shells
!-----------------------------------------------------------------------
REDSHL = 0
IF (SDDES(NPP).GT.0) THEN
REDSHL = WTSHE(NPP)*SDDES(NPP)/(SDDES(NPP)+SDNO(NPP))
ENDIF
SDMAX = (WTSHE(NPP)-REDSHL)*THRESH/(100.-THRESH)-WTSD(NPP)
SDMAX = MAX(0.0,SDMAX)
!-----------------------------------------------------------------------
! Compute Seed Growth Demand, GDMSD, and N required for seed, NDMSD
!-----------------------------------------------------------------------
GDMSD = GDMSD + MIN(SDGR*SDNO(NPP)*REDPUN, SDMAX)
ENDIF
ENDDO
!-----------------------------------------------------------------------
! Call seed composition routine
!-----------------------------------------------------------------------
CALL SDCOMP(
& CARMIN, LIPOPT, LIPTB, PLIGSD, PMINSD, POASD, !Input
& RCH2O, RLIG, RLIP, RMIN, RNO3C, ROA, SDLIP, !Input
& SDPRO, SLOSUM, TAVG, !Input
& AGRSD1, AGRSD2, FNINSD, POTCAR, POTLIP) !Output
NDMSD = FNINSD * GDMSD
!-----------------------------------------------------------------------
! Calculate Amount of Mobilized N Which Can be Used for Seed Growth,
! NDMSDR, potential seed growth from this source of N, GDMSDR,
! and CH2O required for this seed growth from mobilized N, CDMSDR
!-----------------------------------------------------------------------
IF (NDMSD .GT. NMINEP) THEN
NDMSDR = NMINEP
ELSE
NDMSDR = NDMSD
ENDIF
GDMSDR = NDMSDR/FNINSD
CDMSDR = GDMSDR * (AGRSD1 + FNINSD*6.25 * RPRO)
!-----------------------------------------------------------------------
! Compute Total CH2O Demand to Grow GDMSD g Tissue
!-----------------------------------------------------------------------
CDMSD = (MAX(0.0,(GDMSD - GDMSDR))) * AGRSD2 + CDMSDR
ENDIF
ENDIF
!-----------------------------------------------------------------------
! Compute max growth per shell, depending on temp, daylength
!-----------------------------------------------------------------------
GRRAT1 = SHVAR * TMPFAC * (1.- (1.-DRPP) * SRMAX)
& * (1.0 + TURADD)
!-----------------------------------------------------------------------
! Initialize Shell Growth Demand, N (NDMSH) and C (CDMSH) needed for growth
!-----------------------------------------------------------------------
GDMSH = 0.0
NDMSH = 0.0
CDMSH = 0.0
!-----------------------------------------------------------------------
! Compute growth demand for shells, GDMSH, allowing slow growth
! until LNGPEG age, then potential growth until LNGSH
!-----------------------------------------------------------------------
IF (DAS .GT. NR2) THEN
DO NPP = 1,DAS - NR2
NAGE = DAS - NR2 + 1 - NPP !NAGE not used - chp
PAGE = PHTIM(DAS - NR2 + 1) - PHTIM(NPP)
IF (PAGE .LE. LNGSH .AND. SHELN(NPP) .GE. 0.001 .AND.
& GRRAT1 .GE. 0.001) THEN
IF (PAGE .GE. LNGPEG) THEN
!Shells between LNGPEG and LNGSH
ADDSHL = GRRAT1 * SHELN(NPP)
ELSE
!Shells < LNGPEG
ADDSHL = GRRAT1 * SHELN(NPP) * SHLAG
ENDIF
ENDIF
GDMSH = GDMSH + ADDSHL
ENDDO
!-----------------------------------------------------------------------
! Compute CH2O required for the potential shell growth
!-----------------------------------------------------------------------
CDMSH = GDMSH * AGRSH2
ENDIF
!-----------------------------------------------------------------------
! Compute TEMXFR, the temp effect on partitioning to pods
! High temp would increase fraction growth to vegetative tissue
!-----------------------------------------------------------------------
TEMXFR = 0.
DO I = 1,24
TEMXFR = TEMXFR + TABEX(YXFTEM,XXFTEM,TGRO(I),6)
ENDDO
TEMXFR = TEMXFR/24.
!-----------------------------------------------------------------------
! Partitioning to pods is increased under drought stress conditions
! depending on XFRMAX, an input parameter
!-----------------------------------------------------------------------
TURXFR = XFRMAX * (1. - TURFAC)
TURXFR = MIN(TURXFR,1.0)
TURXFR = MAX(TURXFR,0.0)
!-----------------------------------------------------------------------
! Night length and temperature are multiplicative
! but turgor effect adds to the partitioning
!-----------------------------------------------------------------------
XFRT = XFRUIT * TEMXFR + XFRUIT * TURXFR
! XFRT = XFRUIT * RNIT * TEMXFR !NEED TO FIX FOR DAYLENGTH EFFECT
XFRT = MIN(XFRT,1.0)
XFRT = MAX(XFRT,0.0)
!-----------------------------------------------------------------------
! Total Potential Available CH2O for Reprod Growth (CAVTOT)
! and total CH2O needed for potential reproductive growth (CDMREP)
!-----------------------------------------------------------------------
CAVTOT = PGAVL * XFRT
CDMREP = CDMSH + CDMSD
!-----------------------------------------------------------------------
! Adjust C-Demand for New Growth if C-Available is Less than C Demand
! Also adjust tissue growth demand for seeds and shells
!-----------------------------------------------------------------------
GDMSDO = GDMSD
IF (CDMREP .GT. CAVTOT) THEN
IF (CDMSD .GT. CAVTOT) THEN
CDMSH = 0.0
GDMSH = 0.0
CDMSD = CAVTOT
IF (CDMSDR .GT. CAVTOT) THEN
CDMSDR = CAVTOT
ENDIF
GDMSD = (MAX(0.0,(CDMSD-CDMSDR)))/AGRSD2 +
& CDMSDR/(AGRSD1+FNINSD*6.25*RPRO)
NDMSDR = GDMSDR * FNINSD
ELSE
CDMSH = CAVTOT - CDMSD
GDMSH = CDMSH/AGRSH2
ENDIF
CDMREP = CDMSD + CDMSH
ENDIF
!-----------------------------------------------------------------------
! Compute N demand for seed, shell, and total reproductive growth
!-----------------------------------------------------------------------
NDMSD = GDMSD * FNINSD
NDMSH = GDMSH * FNINSH
NDMREP = NDMSD + NDMSH
!-----------------------------------------------------------------------
! Vegetative partitioning factors and demand for C and N for new
! growth before VSSINK, assume leaf expansion is fixed, compute
! SLA based on function of light, temp, etc, then compute
! FRLF (leaf partitioning), then FRRT, FRSTM
!-----------------------------------------------------------------------
! Check to See if New Vegetative Tissue Can Be Grown, Using PGAVL
!-----------------------------------------------------------------------
CDMVEG = MAX(0.0,(1.-XFRT)*PGAVL)
NDMVEG = 0.0
CDMVEG = (PGAVL * XFRT - CDMREP) + CDMVEG
!-----------------------------------------------------------------------
! This is from documentation: check no longer needed?? chp
!-----------------------------------------------------------------------
! CDMVEG = MAX(0.0,(1.-XFRT)*PGAVL)
! IF (PGAVL * XFRT .GT. CDMREP) THEN
! IF(N .LE. NDLEAF) CDMVEG = (PGAVL * XFRT - CDMREP) + CDMVEG
! ENDIF
!-----------------------------------------------------------------------
!-----------------------------------------------------------------------
IF (DAS .EQ. NR1) THEN
!-----------------------------------------------------------------------
! Fraction of growth going to leaves and roots decreases
! linearly between R1 and NDLEAF.
!-----------------------------------------------------------------------
FRLFM = TABEX (YLEAF, XLEAF, VSTAGE, 8)
FRSTMM = TABEX (YSTEM, XLEAF, VSTAGE, 8)
YY = FRLFM - FRLFF
XX = FRSTMM - FRSTMF
ENDIF
!-----------------------------------------------------------------------
IF (DAS .LT. NR1) THEN
!-----------------------------------------------------------------------
! Calculate Pattern of Vegetative Partitioning, a function of V-STAGE
!-----------------------------------------------------------------------
FRLF = TABEX(YLEAF,XLEAF,VSTAGE,8)
FRSTM = TABEX(YSTEM,XLEAF,VSTAGE,8)
ELSE
!-----------------------------------------------------------------------
! Partitioning between vegetative tissues depends on development
! as expressed by FRACDN, the relative development between R1 and NDLEAF
!-----------------------------------------------------------------------
FRLF = FRLFM - YY * FRACDN
FRSTM = FRSTMM - XX * FRACDN
IF ( DAS .GE. NDLEAF) THEN
FRLF = FRLFF
FRSTM = FRSTMF
ENDIF
ENDIF
! This is where to modify partitioning for extra root growth:
! check units!!! fraction vs percentage
! FRLF = FRLF - FRLF/(FRLF+FRSTM) * (extra root value)
! FRSTM= FRSTM - FRSTM/(FRLF+FRSTM) * (extra root value)
FRRT = 1. - FRLF - FRSTM
!-----------------------------------------------------------------------
! Compute F, specific leaf area for new leaf weight
!-----------------------------------------------------------------------
TPHFAC = 0.
DO I = 1,24
TPHFAC = TPHFAC + TABEX (YSLATM,XSLATM,TGRO(I),5)
ENDDO
TPHFAC = TPHFAC/24.
!-----------------------------------------------------------------------
PARSLA = (SLAMN+(SLAMX-SLAMN)*EXP(SLAPAR*PAR))/SLAMX
TURFSL = MAX(0.1, (1.0 - (1.0 - TURFAC)*TURSLA))
!-----------------------------------------------------------------------
! Compute overall effect of TMP, PAR, water stress on SLA (F), first
! for veg stages, then transition to rep stage from R1 to end leaf
! effect of PAR on SLA, COX PEANUT SCI. 5:27, 1978
!-----------------------------------------------------------------------
FFVEG = FVEG * TPHFAC * PARSLA * TURFSL
F = FFVEG
IF (XFRT*FRACDN .GE. 0.05) F = FFVEG * (1.0 - XFRT * FRACDN)
!-----------------------------------------------------------------------
! For determinate plants (XFRUIT=1.) leaf expansion stops at NDLEAF
!-----------------------------------------------------------------------
IF (XFRUIT .GT. 0.9999 .AND. DAS .GE. NDLEAF) F = 0.0
!-----------------------------------------------------------------------
! During early vegetative growth, leaf area expansion depends on
! VSTAGE (Prior to VSSINK). This sets FRLF, partitioning of d.m.
! to leaves. FRRT and FRSTM are then computed by left over C. When
! an upper limit of d.m. goes to leaves, leaf area expansion is
! restricted so that F is maintained as computed and minimal amounts
! of C is partitioned to FRSTM and FRRT (JWJ 4/1/96)
!-----------------------------------------------------------------------
IF (VSTAGE .LT. VSSINK) THEN
GROYES = GROMAX
GROMAX = TABEX(YVGROW,XVGROW,VSTAGE,6) * SIZELF/SIZREF
GAINNW = (GROMAX - GROYES) * PLTPOP
!-----------------------------------------------------------------------
! CALCULATE MINIMUM WEIGHT NEEDED TO ADD GAINNW LEAF AREA/M2,
! AND AMOUNT OF LEAF WEIGHT WHICH CAN BE GROWN WITH PG AVAILABLE
!-----------------------------------------------------------------------
IF (F .GT. 1.E-5) THEN
GAINWT = GAINNW/F
ELSE
GAINWT = 0.0
ENDIF
!-----------------------------------------------------------------------
! Compute fraction of C partitioned to leaves, based on F, VSSINK
! Limit leaf pertitioning to FRLFMX (i.e., FRLFMX = 0.7)
!-----------------------------------------------------------------------
FRLF = (AGRLF*GAINWT)/(CDMVEG + 0.0001)
IF (FRLF .GT. FRLFMX) THEN
GAINWT = (CDMVEG/AGRLF) * FRLFMX
GAINNW = GAINWT * F
FRLF = FRLFMX
ENDIF
!-----------------------------------------------------------------------
! Recompute FRSTM and FRRT based on FRLF
!-----------------------------------------------------------------------
FRSTM = (1. - FRLF) * FRSTM / (FRSTM + FRRT)
FRRT = 1. - FRLF - FRSTM
!-----------------------------------------------------------------------
ENDIF
!-----------------------------------------------------------------------
! Compute CH2O cost per g of tissue, excluding cost for protein (AGRVG)
! and total CH2O cost per g of veg tissue (AGRVG2)
!-----------------------------------------------------------------------
AGRVG = AGRLF * FRLF + AGRRT * FRRT + AGRSTM * FRSTM
AGRVG2 = AGRVG + (FRLF*PROLFI+FRRT*PRORTI+FRSTM*PROSTI)*RPROAV
!-----------------------------------------------------------------------
! Compute N Demand for New Tissue, including reproductive and vegetative
!-----------------------------------------------------------------------
NDMVEG = (CDMVEG/AGRVG2) * (FRLF*FNINL+FRSTM*FNINS+
& FRRT*FNINR)
NDMNEW = NDMREP + NDMVEG
!-----------------------------------------------------------------------
! Check to See if Any C is Left After Reproductive Growth for
! Reducing N to Re-Fill Old Tissue, if N Can Be Taken up by Roots
!-----------------------------------------------------------------------
CNOLD = MAX(0.0,PGAVL-CDMREP)
NDMOLD = 0.0
!-----------------------------------------------------------------------
! Nitrogen Demand for Old Tissue
!-----------------------------------------------------------------------
IF (DAS .GT. NVEG0 .AND. DAS .LT. NR7 .AND.
& CNOLD .GT. 0.0) THEN
NVSTL = FNINL
NVSTS = FNINS
NVSTR = FNINR
IF (DXR57 .GT.0.0) THEN
FRNLFT = (NRCVR + (1. - NRCVR) * (1. - DXR57**2))
NVSTL = PROLFF*0.16 + (FNINL-PROLFF*0.16) * FRNLFT
NVSTS = PROSTF*0.16 + (FNINS-PROSTF*0.16) * FRNLFT
NVSTR = PRORTF*0.16 + (FNINR-PRORTF*0.16) * FRNLFT
ENDIF
NDMOLD = (WTLF - WCRLF) * MAX(0.0,(NVSTL - PCNL /100.))
& + (STMWT - WCRST) * MAX(0.0,(NVSTS - PCNST/100.))
& + (RTWT - WCRRT) * MAX(0.0,(NVSTR - PCNRT/100.))
IF (NDMOLD .GT. (CNOLD/RNO3C*0.16)) THEN
NDMOLD = CNOLD/RNO3C*0.16
ENDIF
ENDIF
!-----------------------------------------------------------------------
! Total N Demand
!-----------------------------------------------------------------------
NDMTOT = NDMREP + NDMVEG + NDMOLD
!-----------------------------------------------------------------------
! Compute Total Demand for C, and Max. C that Could be Mined
! CDMTOT not used - chp
!-----------------------------------------------------------------------
CDMTOT = CDMREP + CDMVEG + NDMOLD*RNO3C/0.16
GDMSD = GDMSDO
!-----------------------------------------------------------------------
! At this point, PGAVL will be used entirely, assuming that N can be
! made available in the ratio described.
! Growth Demands : GDMSD, GDMSH
! N-Demands : NDMREP, NDMVEG, NDMOLD, NDMTOT, NDMNEW
! C-Demands : CDMREP, CDMVEG, CDMTOT, CNOLD
!***********************************************************************
!***********************************************************************
! END OF DYNAMIC IF CONSTRUCT
!***********************************************************************
ENDIF
!-----------------------------------------------------------------------
RETURN
END SUBROUTINE DEMAND
!=======================================================================
!=======================================================================
! IPDMND, Subroutine, C.H. Porter
!-----------------------------------------------------------------------
! Reads input data for DEMAND subroutine
!-----------------------------------------------------------------------
! REVISION HISTORY
! 07/04/1998 CHP Written.
! 08/12/2003 CHP Added I/O error checking
! 11/26/2007 CHP THRESH, SDPRO, SDLIP moved from eco to cul file
!-----------------------------------------------------------------------
! Called by: DEMAND
! Calls: FIND, ERROR, IGNORE
!=======================================================================
SUBROUTINE IPDMND(
& FILECC, FILEGC, FILEIO, !Input
& CARMIN, FINREF, FNSDT, FRLFF, FRLFMX, !Output
& FRSTMF, LIPOPT, LIPTB, LNGSH, NMOBMX, !Output
& NRCVR, NVSMOB, PLIGSD, PMINSD, POASD, !Output
& PROLFF, PROLFI, PRORTF, PRORTI, PROSTF, PROSTI, !Output
& RCH2O, RLIG, RLIP, RMIN, RNO3C, ROA, !Output
& RPRO, SDLIP, SDPRO, SHLAG, SLAMAX, SLAMIN, !Output
& SLAPAR, SLAREF, SLAVAR, SLOSUM, SIZELF, SIZREF, !Output
& SRMAX, THRESH, TURSLA, TYPSDT, VSSINK, XFRMAX, !Output
& XFRUIT, XLEAF, XSLATM, XTRFAC, XVGROW, XXFTEM, !Output
& YLEAF, YSLATM, YSTEM, YTRFAC, YVREF, YXFTEM) !Output
!-----------------------------------------------------------------------
IMPLICIT NONE
!-----------------------------------------------------------------------
CHARACTER*3 TYPSDT
CHARACTER*6 ERRKEY
PARAMETER (ERRKEY = 'DEMAND')
CHARACTER*6 SECTION
CHARACTER*6 ECOTYP, ECONO
CHARACTER*30 FILEIO
CHARACTER*80 C80
CHARACTER*92 FILECC, FILEGC
CHARACTER*255 C255
INTEGER LUNCRP, LUNIO, LUNECO, ERR, LINC, LNUM, FOUND, ISECT
INTEGER I, II
REAL CARMIN, FINREF, FRLFF, FRLFMX, FRSTMF,
& LIPOPT, LIPTB, NMOBMX, NRCVR, NVSMOB,
& PLIGSD, PMINSD, POASD, PROLFF,
& PROLFI, PRORTF, PRORTI, PROSTF, PROSTI,
& RCH2O, RLIG, RLIP, RMIN, RNO3C, ROA,
& RPRO, SHLAG, SLAMAX, SLAMIN, SLAPAR,
& SLAREF, SLAVAR, SLOSUM, SIZELF, SIZREF,
& SRMAX, TURSLA, VSSINK, XFRMAX, XFRUIT
REAL LNGSH, THRESH, SDPRO, SDLIP
REAL FNSDT(4)
REAL XVGROW(6), YVREF(6)
REAL XSLATM(10), YSLATM(10), XTRFAC(10), YTRFAC(10),
& XXFTEM(10), YXFTEM(10)
REAL XLEAF(25), YLEAF(25), YSTEM(25)
!-----------------------------------------------------------------------
CALL GETLUN('FILEIO', LUNIO)
OPEN (LUNIO, FILE = FILEIO,STATUS = 'OLD',IOSTAT=ERR)
IF (ERR .NE. 0) CALL ERROR(ERRKEY,ERR,FILEIO,0)
LNUM = 0
!-----------------------------------------------------------------------
! Find and Read Field Section from FILEIO - previously read in IPIBS
! Look for the second section header beginning with '*CULTI'
!-----------------------------------------------------------------------
SECTION = '*CULTI'
CALL FIND(LUNIO, SECTION, LINC, FOUND) ; LNUM = LNUM + LINC
IF (FOUND .EQ. 0) THEN
CALL ERROR(SECTION, 42, FILEIO, LNUM)
ENDIF
CALL FIND(LUNIO, SECTION, LINC, FOUND) ; LNUM = LNUM + LINC
IF (FOUND .EQ. 0) THEN
CALL ERROR(SECTION, 42, FILEIO, LNUM)
ELSE
READ(LUNIO,'(24X,A6,48X,3F6.0,24X,3F6.0)',IOSTAT=ERR)
& ECONO, SLAVAR, SIZELF, XFRUIT, THRESH, SDPRO, SDLIP
LNUM = LNUM + 1
IF (ERR .NE. 0) CALL ERROR(ERRKEY,ERR,FILEIO,LNUM)
ENDIF
CLOSE (LUNIO)
!-----------------------------------------------------------------------
! Read in values from species file
!-----------------------------------------------------------------------
CALL GETLUN('FILEC', LUNCRP)
OPEN (LUNCRP,FILE = FILECC, STATUS = 'OLD',IOSTAT=ERR)
LNUM = 0
IF (ERR .NE. 0) CALL ERROR(ERRKEY,ERR,FILECC,LNUM)
!-----------------------------------------------------------------------
! Find and Read Respiration Section
!-----------------------------------------------------------------------
SECTION = '!*RESP'
CALL FIND(LUNCRP, SECTION, LINC, FOUND) ; LNUM = LNUM + LINC
IF (FOUND .EQ. 0) THEN
CALL ERROR(SECTION, 42, FILECC, LNUM)
ELSE
CALL IGNORE(LUNCRP,LNUM,ISECT,C80)
CALL IGNORE(LUNCRP,LNUM,ISECT,C80)
READ(C80,'(F6.0,6X,F6.0)',IOSTAT=ERR) RNO3C, RPRO
IF (ERR .NE. 0) CALL ERROR(ERRKEY,ERR,FILECC,LNUM)
CALL IGNORE(LUNCRP,LNUM,ISECT,C80)
READ(C80,'(5F6.0)',IOSTAT=ERR)RCH2O,RLIP,RLIG,ROA,RMIN
IF (ERR .NE. 0) CALL ERROR(ERRKEY,ERR,FILECC,LNUM)
ENDIF
!-----------------------------------------------------------------------
! Find and Read Plant Composition Section
!-----------------------------------------------------------------------
SECTION = '!*PLAN'
CALL FIND(LUNCRP, SECTION, LINC, FOUND) ; LNUM = LNUM + LINC
IF (FOUND .EQ. 0) THEN
CALL ERROR(SECTION, 42, FILECC, LNUM)
ELSE
CALL IGNORE(LUNCRP,LNUM,ISECT,C80)
READ(C80,'(F6.0,6X,2F6.0,6X,F6.0)',IOSTAT=ERR)
& PROLFI, PROLFF, PROSTI, PROSTF
IF (ERR .NE. 0) CALL ERROR(ERRKEY,ERR,FILECC,LNUM)
CALL IGNORE(LUNCRP,LNUM,ISECT,C80)
READ(C80,'(F6.0,6X,F6.0)',IOSTAT=ERR) PRORTI, PRORTF
IF (ERR .NE. 0) CALL ERROR(ERRKEY,ERR,FILECC,LNUM)
CALL IGNORE(LUNCRP,LNUM,ISECT,C80)
CALL IGNORE(LUNCRP,LNUM,ISECT,C80)
CALL IGNORE(LUNCRP,LNUM,ISECT,C80)
CALL IGNORE(LUNCRP,LNUM,ISECT,C80)
READ(C80,'(24X,F6.0)',IOSTAT=ERR) PLIGSD
IF (ERR .NE. 0) CALL ERROR(ERRKEY,ERR,FILECC,LNUM)
CALL IGNORE(LUNCRP,LNUM,ISECT,C80)
READ(C80,'(24X,F6.0)',IOSTAT=ERR) POASD
IF (ERR .NE. 0) CALL ERROR(ERRKEY,ERR,FILECC,LNUM)
CALL IGNORE(LUNCRP,LNUM,ISECT,C80)
READ(C80,'(24X,F6.0)',IOSTAT=ERR) PMINSD
IF (ERR .NE. 0) CALL ERROR(ERRKEY,ERR,FILECC,LNUM)
ENDIF
!-----------------------------------------------------------------------
! Find and Read Seed Composition Section
!-----------------------------------------------------------------------
SECTION = '!*SEED'
CALL FIND(LUNCRP, SECTION, LINC, FOUND) ; LNUM = LNUM + LINC
IF (FOUND .EQ. 0) THEN
CALL ERROR(SECTION, 42, FILECC, LNUM)
ELSE
CALL IGNORE(LUNCRP,LNUM,ISECT,C80)
READ(C80,'(4F6.0)',IOSTAT=ERR) LIPTB, LIPOPT, SLOSUM, CARMIN
IF (ERR .NE. 0) CALL ERROR(ERRKEY,ERR,FILECC,LNUM)
SLOSUM = SLOSUM / 100.0
ENDIF
!-----------------------------------------------------------------------
! Find and Read Carbon and Nitrogen Mining Section
!-----------------------------------------------------------------------
SECTION = '!*CARB'
CALL FIND(LUNCRP, SECTION, LINC, FOUND) ; LNUM = LNUM + LINC
IF (FOUND .EQ. 0) THEN
CALL ERROR(SECTION, 42, FILECC, LNUM)
ELSE
CALL IGNORE(LUNCRP,LNUM,ISECT,C80)
READ(C80,'(18X,3F6.0)',IOSTAT=ERR) NMOBMX, NVSMOB, NRCVR
IF (ERR .NE. 0) CALL ERROR(ERRKEY,ERR,FILECC,LNUM)
ENDIF
!-----------------------------------------------------------------------
! Find and Read Vegetative Partitioning Section
!-----------------------------------------------------------------------
SECTION = '!*VEGE'
CALL FIND(LUNCRP, SECTION, LINC, FOUND) ; LNUM = LNUM + LINC
IF (FOUND .EQ. 0) THEN
CALL ERROR(SECTION, 42, FILECC, LNUM)
ELSE
CALL IGNORE(LUNCRP,LNUM,ISECT,C80)
READ(C80,'(8F6.0)',IOSTAT=ERR)(XLEAF(II),II=1,8)
IF (ERR .NE. 0) CALL ERROR(ERRKEY,ERR,FILECC,LNUM)
CALL IGNORE(LUNCRP,LNUM,ISECT,C80)
READ(C80,'(8F6.0)',IOSTAT=ERR)(YLEAF(II),II=1,8)
IF (ERR .NE. 0) CALL ERROR(ERRKEY,ERR,FILECC,LNUM)
CALL IGNORE(LUNCRP,LNUM,ISECT,C80)
READ(C80,'(8F6.0)',IOSTAT=ERR)(YSTEM(II),II=1,8)
IF (ERR .NE. 0) CALL ERROR(ERRKEY,ERR,FILECC,LNUM)
CALL IGNORE(LUNCRP,LNUM,ISECT,C80)
READ(C80,'(12X,2F6.0)',IOSTAT=ERR) FRSTMF, FRLFF
IF (ERR .NE. 0) CALL ERROR(ERRKEY,ERR,FILECC,LNUM)
CALL IGNORE(LUNCRP,LNUM,ISECT,C80)
READ(C80,'(F6.0)',IOSTAT=ERR) FRLFMX
IF (ERR .NE. 0) CALL ERROR(ERRKEY,ERR,FILECC,LNUM)
ENDIF
!-----------------------------------------------------------------------
! Find and Read Leaf Growth Section
!-----------------------------------------------------------------------
SECTION = '!*LEAF'
CALL FIND(LUNCRP, SECTION, LINC, FOUND) ; LNUM = LNUM + LINC
IF (FOUND .EQ. 0) THEN
CALL ERROR(SECTION, 42, FILECC, LNUM)
ELSE
CALL IGNORE(LUNCRP,LNUM,ISECT,C80)
READ(C80,'(4F6.0)',IOSTAT=ERR) FINREF, SLAREF, SIZREF, VSSINK
IF (ERR .NE. 0) CALL ERROR(ERRKEY,ERR,FILECC,LNUM)
CALL IGNORE(LUNCRP,LNUM,ISECT,C80)
READ(C80,'(4F6.0)',IOSTAT=ERR) SLAMAX, SLAMIN, SLAPAR, TURSLA
IF (ERR .NE. 0) CALL ERROR(ERRKEY,ERR,FILECC,LNUM)
CALL IGNORE(LUNCRP,LNUM,ISECT,C80)
READ(C80,'(6F6.0)',IOSTAT=ERR)(XVGROW(II),II=1,6)
IF (ERR .NE. 0) CALL ERROR(ERRKEY,ERR,FILECC,LNUM)
CALL IGNORE(LUNCRP,LNUM,ISECT,C80)
READ(C80,'(6F6.0)',IOSTAT=ERR)(YVREF(II),II=1,6)
IF (ERR .NE. 0) CALL ERROR(ERRKEY,ERR,FILECC,LNUM)
CALL IGNORE(LUNCRP,LNUM,ISECT,C80)
READ(C80,'(5F6.0)',IOSTAT=ERR)(XSLATM(II),II = 1,5)
IF (ERR .NE. 0) CALL ERROR(ERRKEY,ERR,FILECC,LNUM)
CALL IGNORE(LUNCRP,LNUM,ISECT,C80)
READ(C80,'(5F6.0)',IOSTAT=ERR)(YSLATM(II),II = 1,5)
IF (ERR .NE. 0) CALL ERROR(ERRKEY,ERR,FILECC,LNUM)
ENDIF
!-----------------------------------------------------------------------
! Find and Read Seed and Shell Growth Section
!-----------------------------------------------------------------------
SECTION = '!*SEED'
CALL FIND(LUNCRP, SECTION, LINC, FOUND) ; LNUM = LNUM + LINC
IF (FOUND .EQ. 0) THEN
CALL ERROR(SECTION, 42, FILECC, LNUM)
ELSE
CALL IGNORE(LUNCRP,LNUM,ISECT,C80)
READ(C80,'(6X,F6.0)',IOSTAT=ERR) SRMAX
IF (ERR .NE. 0) CALL ERROR(ERRKEY,ERR,FILECC,LNUM)
CALL IGNORE(LUNCRP,LNUM,ISECT,C80)
READ(C80,'(6X,2F6.0)',IOSTAT=ERR) XFRMAX, SHLAG
IF (ERR .NE. 0) CALL ERROR(ERRKEY,ERR,FILECC,LNUM)
CALL IGNORE(LUNCRP,LNUM,ISECT,C80)
CALL IGNORE(LUNCRP,LNUM,ISECT,C80)
READ(C80,'(4(1X,F5.2),3X,A3)',IOSTAT=ERR)
& (FNSDT(II),II=1,4), TYPSDT
IF (ERR .NE. 0) CALL ERROR(ERRKEY,ERR,FILECC,LNUM)
CALL IGNORE(LUNCRP,LNUM,ISECT,C80)
READ(C80,'(6F6.0)',IOSTAT=ERR)(XXFTEM(II),II = 1,6)
IF (ERR .NE. 0) CALL ERROR(ERRKEY,ERR,FILECC,LNUM)
CALL IGNORE(LUNCRP,LNUM,ISECT,C80)
READ(C80,'(6F6.0)',IOSTAT=ERR)(YXFTEM(II),II = 1,6)
IF (ERR .NE. 0) CALL ERROR(ERRKEY,ERR,FILECC,LNUM)
DO I=1,5
CALL IGNORE(LUNCRP,LNUM,ISECT,C80)
ENDDO
READ(C80,'(4F6.0)',IOSTAT=ERR)(XTRFAC(II),II = 1,4)
IF (ERR .NE. 0) CALL ERROR(ERRKEY,ERR,FILECC,LNUM)
CALL IGNORE(LUNCRP,LNUM,ISECT,C80)
READ(C80,'(4F6.0)',IOSTAT=ERR)(YTRFAC(II),II = 1,4)
IF (ERR .NE. 0) CALL ERROR(ERRKEY,ERR,FILECC,LNUM)
ENDIF
!-----------------------------------------------------------------------
CLOSE(LUNCRP)
!-----------------------------------------------------------------------
! Read Ecotype Parameter File
!-----------------------------------------------------------------------
CALL GETLUN('FILEE', LUNECO)
OPEN (LUNECO,FILE = FILEGC,STATUS = 'OLD',IOSTAT=ERR)
IF (ERR .NE. 0) CALL ERROR(ERRKEY,ERR,FILEGC,0)
ECOTYP = ' '
LNUM = 0
DO WHILE (ECOTYP .NE. ECONO)
CALL IGNORE(LUNECO, LNUM, ISECT, C255)
IF ((ISECT .EQ. 1) .AND. (C255(1:1) .NE. ' ') .AND.
& (C255(1:1) .NE. '*')) THEN
! READ (C255,'(A6,66X,F6.0,30X,3F6.0)',IOSTAT=ERR)
! & ECOTYP, LNGSH, THRESH, SDPRO, SDLIP
READ (C255,'(A6,66X,F6.0,30X)',IOSTAT=ERR) ECOTYP, LNGSH
IF (ERR .NE. 0) CALL ERROR(ERRKEY,ERR,FILEGC,LNUM)
IF (ECOTYP .EQ. ECONO) THEN
EXIT
ENDIF
ELSE IF (ISECT .EQ. 0) THEN
IF (ECONO .EQ. 'DFAULT') CALL ERROR(ERRKEY,35,FILEGC,LNUM)
ECONO = 'DFAULT'
REWIND(LUNECO)
LNUM = 0
ENDIF
ENDDO
CLOSE (LUNECO)
!-----------------------------------------------------------------------
RETURN
!-----------------------------------------------------------------------
END SUBROUTINE IPDMND
!=======================================================================
!=======================================================================
! Variable definitions for DEMAND and IPDMND
! Updated 25 Feb 2004
!-----------------------------------------------------------------------
! ADDSHL Today's growth demand for shells of age NPP (g[shell] / m2 / d)
! AGRLF Mass of CH2O required for new leaf growth (g[CH2O] / g[leaf])
! AGRRT Mass of CH2O required for new root growth (g[CH2O] / g[root])
! AGRSD1 CH2O requirement for seed growth, excluding cost for protein
! content (g[CH2O] / g[seed])
! AGRSD2 CH2O requirement for seed growth, including cost for protein
! content (g[CH2O] / g[seed])
! AGRSH2 CH2O requirement for shell growth, including cost for protein
! content (g[CH2O] / g[shell])
! AGRSTM Mass of CH2O required for new stem growth (g[CH2O] / g[stem])
! AGRVG Mass of CH2O required for vegetative tissue growth including
! stoichiometry and respiration (g[CH2O] / g[tissue])
! AGRVG2 Total mass of CH2O required for vegetative tissue growth
! (g[CH2O] / g[tissue])
! C255 255-character record read from file
! C80 80-character record read from file
! CARMIN Minimum carbohydrate fraction
! CAVTOT Total potential available CH2O for reproductive growth
! (g[CH2O] / m2)
! CDMREP Total CH2O needed for potential reproductive growth
! (g[CH2O] / m2 / d)
! CDMSD Total CH2O demand to grow seed demand (GDMSD)
! (g[CH2O] / m2 / d)
! CDMSDR CH2O required for seed growth from mobilized N
! (g[CH2O] / m2 / d)
! CDMSH Total CH2O demand to grow shell demand (GDMSH)
! (g[CH2O] / m2 / d)
! CDMTOT Total CH2O demand (g[CH2O] / m2 / d)
! CDMVEG Carbon demand for vegetative growth (g[CH2O] / m2 / d)
! CNOLD Available CH2O after reproductive growth (g[CH2O] / m2 / d)
! CROP Crop identification code
! DAS Days after start of simulation (d)
! DRPP Photoperiod days which occur in a real day
! (photoperiod days / day)
! DXR57 Relative time between first seed (NR5) and physiological
! maturity (NR7) (fraction)
! ECONO Ecotype code - used to match ECOTYP in .ECO file
! ECOTYP Ecotype code for this simulation
! ERR Error code for file operation
! F Specific leaf area of new leaf tissue growth, including N
! (cm2[leaf] / g[leaf])
! FFVEG Specific leaf area of new leaf tissue growth (interim value)
! (cm2[leaf] / g[leaf])
! FILECC Path plus filename for species file (*.spe)
! FILEGC Pathname plus filename for ECO file
! FINREF Specific leaf area (SLA) of leaves of standard crop cultivar
! when plants emerge (cm2[leaf] / g[leaf])