-
Notifications
You must be signed in to change notification settings - Fork 1
/
CSP_PHOTO.for
1238 lines (998 loc) · 50.1 KB
/
CSP_PHOTO.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
C CSP_PHOTO, Subroutine, based on PHOTO Subroutine by
C K.J.Boote, J.W.Jones, G. Hoogenboom
C Compute daily photosynthetic using canopy (C) method.
C-----------------------------------------------------------------------
C REVISION HISTORY
C 01/01/1989 KJB Written.
C 06/02/1993 NBP Made into subroutine.
C 02/11/1994 NBP Corrected dimension (15) for XPGSLW, YPGSLW
C 04/24/1994 NBP Replaced TAIRHR, TAVG with TGRO, TGROAV.
C 09/25/1995 KJB Light interception for ET the same for canopy and leaf
C models
C 11/11/1999 CHP Modified for modular format
C 01/13/2000 NBP Added SWFAC effect on PG
C 06/11/2002 GH Modified for Y2K
C 08/12/2003 CHP Added I/O error checking
C 10/09/2003 FSR Modified for O.H. Daza CASUPRO sugarcane model
C 08/17/2004 FV Modified PTSMAX photosynthesis calculation
C 09/02/2004 CHP Added KC_SLOPE to SPE file and KC_ECO to ECO file.
C 10/04/2005 FSR Implemented stalk-level phosynthesis.
!-----------------------------------------------------------------------
! Called from: CSP_CASUPRO
! Calls: CSP_PHOTIP
C=======================================================================
SUBROUTINE CSP_PHOTO(CONTROL,FILEIO,
& CANHT, CanLmtFac, CANWH, CO2, ECONO, EXCESS, !Input
& DeltaLeafArea, DeltaLeafNum, FILECC, !Input
& DeltaLeafArealost, FILEGC, FRACSH, FRSHV, !Input
& KCAN, LeafArea,LeafAreaPlant, LeafNum, !Input
& LfShdFac, PAR, !Input
& PStres2, RNITP, SLAREF, SLAAD, !Input
& SLPF, Smax, StalkState, StkHt, SWFAC, TAVG, !Input
& TURFAC, WEATHER, XHLAI, !Input
& AGEFAC, LeafDist, LI, LITOTAL, PGT, PgRatio, !Output
& PLTPOP, StkPG) !Output
!-----------------------------------------------------------------------
USE ModuleDefs !Definitions of constructed variable types,
USE ModuleData
IMPLICIT NONE
SAVE
CHARACTER*3 TYPPGN, TYPPGT
CHARACTER*4 StalkState(NumOfStalks,10)
CHARACTER*6 ECONO
CHARACTER*30 FILEIO
CHARACTER*92 FILECC, FILEGC
INTEGER DAS, DYNAMIC, H, PLUN, Smax, YRDOY, YRSIM, Zone
REAL AGEFAC, AGEFCC, A0, BETN, CANHT, CanLmtFac, CANWH,
& CCEFF, CCK, CCMAX, CCMP, CO2, COLDSTR, CUMSTR, CURV,
& E_FAC, FRACSH, FRSHAV, FRSHV, KCAN, LAITH1,
& LAITH2, LAsun, LAshd, LAgnd, LIsun, LaiAllZone, LAI2, LIalt,
& LaiSunZone, LaiShdZone, LaiGndZone, LfShdFac, LIshd,
& LIsunAvl, LIshdAvl, LIgndAvl, LNREF, PAR, PARMAX, PG,
& LI, LIallZone, LITOTAL, SLPF, PGT,
& PGLFMX, PGREF, PGSLW, PHTMAX, PLTPOP, PRATIO,
& PStres2, PTSMAX, RNITP, ROWSPC, SHLAI, SLAREF, SLAAD,
& SLW, SNDN, SNUP, SWFAC, TABEX,
& TGRO(TS), TLI, TURFAC, XHLAI, XLAI
REAL PlantLeafAreaTmp, temp
INTEGER OpenStatus, Stalk
INTEGER GP1, GP2, GP3, Sun, Shade, Ground
! INTEGER, PARAMETER :: Sun=1, Shade=2, Ground=3, CanopyLayers=3
INTEGER, PARAMETER :: CanopyLayers=3
REAL FNPGN(4), FNPGT(4)
REAL TAVG, PG_b, XPGSLW(15), YPGSLW(15)
REAL, DIMENSION(0:NumOfDays) :: LeafAreaPlant, LAtmp, LAItmp
REAL, DIMENSION(1:NumOfStalks) :: EXCESS, PgRatio,
& StkHt, TotalPG
REAL, DIMENSION(0:NumOfDays,NumOfStalks) :: LeafArea, LeafNum,
& DeltaLeafArea, DeltaLeafArealost, DeltaLeafNum
REAL, DIMENSION(1:NumOfStalks,CanopyLayers) :: LeafDist, StkLI,
& StkPG
TYPE (WeatherType) WEATHER
!-----------------------------------------------------------------------
! Define constructed variable types based on definitions in
! ModuleDefs.for.
! The variable "CONTROL" is of type "ControlType".
TYPE (ControlType) CONTROL
TYPE (SwitchType) ISWITCH
! Transfer values from constructed data types into local variables.
DAS = CONTROL % DAS
DYNAMIC = CONTROL % DYNAMIC
FILEIO = CONTROL % FILEIO
YRDOY = CONTROL % YRDOY
YRSIM = CONTROL % YRSIM
SNDN = WEATHER % SNDN
SNUP = WEATHER % SNUP
C***********************************************************************
C***********************************************************************
C Run Initialization - Called once per simulation
C***********************************************************************
IF (DYNAMIC .EQ. RUNINIT) THEN
C-----------------------------------------------------------------------
CALL CSP_PHOTIP(FILEIO,
& CCEFF, CCMAX, CCMP, FNPGN, FNPGT, LIsun, !, KCAN
& LIshd, LNREF, PARMAX, PGREF, !, LMXSTD, PHTHRS10
& PHTMAX, PLTPOP, ROWSPC, TYPPGN, TYPPGT, XPGSLW,
& YPGSLW)
C-----------------------------------------------------------------------
C Adjust canopy photosynthesis for GENETIC input value of
C maximum leaf photosynthesis (LMXSTD). Exponential curve from
C from the hedgerow photosynthesis model (Boote et al, 199?).
! This needs be revised in case of use.
C-----------------------------------------------------------------------
! Copied from CSP_GROW FSR
!-----------------------------------------------------------------------
!! ROWSPC = ROWSPC / 100.
!! IF (ROWSPC .GT. 0.0 .AND. PLTPOP .GT. 0.0) THEN
!! BETN = 1./(ROWSPC*PLTPOP)
!! ELSE
!! BETN = 0.
!! ENDIF
Sun=1
Shade=2
Ground=3
C-----------------------------------------------------------------------
CALL CSP_CANOPY(CONTROL,
& DAS, DeltaLeafNum, ECONO, FILECC, !Input
& FILEGC, FRACSH, FRSHV, KCAN, !Input
& LeafNum, PAR, ROWSPC, Smax, !Input
& StalkState, TGRO, TURFAC, WEATHER, XHLAI, !Input
& CANHT, CANWH, FRSHAV, H, StkHt) !Output
C-----------------------------------------------------------------------
! LMXSTD Maximum leaf photosyntheses for standard cultivar. No apparent
! source for this in CASUPRO files. Had been using M1 from
! CUL file, but that was an apparent legacy from CropGro.
! PGREF Reference value for leaf level photosynthesis used in canopy
! light response curve (µmol[CO2] / m2-s)
! chp 2/9/2007 remove LMXSTD, no value available.
! IF (PGREF .GT. 0.0 .AND. LMXSTD .GT. 0.0) THEN
! PGLFMX = (1. - EXP(-1.6 * LMXSTD)) / (1. - EXP(-1.6 * PGREF))
! ELSE
PGLFMX = 1.0
! ENDIF
C***********************************************************************
C***********************************************************************
C Seasonal initialization - run once per season
C***********************************************************************
ELSEIF (DYNAMIC .EQ. SEASINIT) THEN
C-----------------------------------------------------------------------
! Open file to write results from CSP_PHOTO.FOR
CALL GET(ISWITCH)
IF (INDEX('Y' ,ISWITCH%IDETG) > 0 .AND.
& INDEX('YDA',ISWITCH%IDETL) > 0) THEN
CALL GETLUN('CSP_PHOTO',PLUN)
OPEN(UNIT = PLUN, FILE = "CSP_PHOTO.OUT", STATUS = "UNKNOWN",
& ACTION = "WRITE", POSITION = "REWIND", IOSTAT = OpenStatus)
WRITE(PLUN,'(1X,"RESULTS FROM CSP_PHOTO.FOR")')
WRITE(PLUN,'(90X,"LeafArea m2")')
WRITE(PLUN,'(1X," YRDOY DAS XHLAI LAIAZ SHLAI FRSHA
&LIalt LI LITOT LIsun LIshd LIgnd PG PGTOT GP1 GP2
& GP3 EXCESS
& PAR RNITP SLAAD SWFAC TAVG AGEFAC PTSMAX SLPF
&TLI AGEFCC PGSLW PRATIO PGLFMX")',
& ADVANCE="NO")
!!! DO Stalk = 1, Smax
!!! WRITE(PLUN,'(" LI",I2)',ADVANCE="NO") Stalk
!!! END DO
DO Stalk = 1,Smax
WRITE(PLUN,'(" PG",I2.2)',ADVANCE="NO") Stalk
END DO
ENDIF
C-----------------------------------------------------------------------
AGEFAC = 0.0
CUMSTR = 0.0
COLDSTR = 0.0
LaiSunZone = 0.0
LaiShdZone = 0.0
LaiGndZone = 0.0
LaiAllZone = 0.0
LIsunAvl = 0.0
LIshdAvl = 0.0
LIgndAvl = 0.0
!************ new ************
FRACSH = 0.0
PGT = 0.0
LAsun = 0.0 ! Daily leaf area, stalks in pseudo-zone 1
LAshd = 0.0 ! Daily leaf area, stalks in pseudo-zone 2
LAgnd = 0.0 ! Daily leaf area, stalks in pseudo-zone 3
LITOTAL = 0.0 ! Sum of stalk Light Interception
GP1 = 0
GP2 = 0
GP3 = 0
LAI2 = 0.
DO Stalk = 1,Smax
DO Zone = 1,3
LeafDist(Stalk,Zone) = 0.0
StkPG(Stalk,Zone) = 0.0
StkLI(Stalk,Zone) = 0.0
END DO ! Zone
END DO ! Stalk
!************ end ************
! LAItmp = 0.0
PG = 0.0
DO Stalk = 1,Smax
!!! DO Zone = 1,3
!!! StkPG(Stalk,Zone) = 0.0
!!! StkLI(Stalk,Zone) = 0.0
!!! END DO ! Zone
PgRatio(Stalk) = 0.0
TotalPG(Stalk) = 0.0
StalkState(Stalk,3) = ' '
END DO ! Stalk
C-----------------------------------------------------------------------
! Calculate the fraction of ground area shaded prior to canopy closing.
CALL CSP_CANOPY(CONTROL,
& DAS, DeltaLeafNum, ECONO, FILECC, !Input
& FILEGC, FRACSH, FRSHV, KCAN, !Input
& LeafNum, PAR, ROWSPC, Smax, !Input
& StalkState, TGRO, TURFAC, WEATHER, XHLAI, !Input
& CANHT, CANWH, FRSHAV, H, StkHt) !Output
C-----------------------------------------------------------------------
LAITH1 = (1/(-KCAN)) * log(1-LIsun) !chp for portability
LAITH2 = (1/(-KCAN)) * log(1-LIshd)
C***********************************************************************
C***********************************************************************
C Daily rate calculations
C***********************************************************************
ELSEIF (DYNAMIC .EQ. RATE) THEN
C-----------------------------------------------------------------------
GP1 = 0
GP2 = 0
GP3 = 0
DO Stalk = 1,Smax
DO Zone = 1,3
StkPG(Stalk,Zone) = 0.0
StkLI(Stalk,Zone) = 0.0
END DO ! Zone
END DO ! Stalk
! CanopyLayers
! Sun = 1
! Shade = 2
! Ground = 3
C-----------------------------------------------------------------------
C Calculate maximum photosynthesis as function of PAR, g CH2O/m2
C-----------------------------------------------------------------------
PGT = 0.0
LAsun = 0.0 ! Daily leaf area, stalks in pseudo-zone 1
LAshd = 0.0 ! Daily leaf area, stalks in pseudo-zone 2
LAgnd = 0.0 ! Daily leaf area, stalks in pseudo-zone 3
LITOTAL = 0.0 ! Sum of stalk Light Interception
PTSMAX = PHTMAX * (1.0 - EXP(-(1.0 / PARMAX) * PAR))
! Use this equation for the time being. Maximum photosynthesis without
! any correction (See correction factors in equation above).
! Calculations taken from paper of Goudriaan and van Laar ()
!Fernando Villegas changed 8/17/2004
! PTSMAX = -0.0035 * PAR ** 2 + 1.068 * PAR
PG_b = PTSMAX
C-----------------------------------------------------------------------
C Calculate reduction in photosynthesis due to incomplete canopy.
C-----------------------------------------------------------------------
! LI - Light Interception
!
! Ignore KCANR for stalk-based photosynthesis - JWJ
!! IF (BETN .LE. ROWSPC) THEN
!! SPACNG = BETN / ROWSPC
!! ELSE
!! SPACNG = ROWSPC / BETN
!! ENDIF
!! PGFAC = 1. - EXP(-KCANR * XHLAI)
LI = 1. - EXP(-KCAN * XHLAI)
C-----------------------------------------------------------------------
C Compute reduction in PG based on the average daylight temperature.
!
TLI = CURV(TYPPGT,FNPGT(1),FNPGT(2),FNPGT(3),FNPGT(4),TAVG)
C-----------------------------------------------------------------------
C Compute reduction in PG as a function of leaf N concentration.
! Until N stress is restored, temporarily replaced following lines so
! that AGEFCC = approx 1 FSR
!
! AGEFAC = CURV(TYPPGN,FNPGN(1),FNPGN(2),FNPGN(3),FNPGN(4),RNITP)
! AGEREF = CURV(TYPPGN,FNPGN(1),FNPGN(2),FNPGN(3),FNPGN(4),LNREF)
! AGEFAC = AGEFAC / AGEREF
AGEFAC = 1.028571
C-----------------------------------------------------------------------
C 9/24/95 KJB,JWJ Decrease sensitivity of canopy PG to N function
C to mimic behavior of leaf version. AGEFAC corresponds to leaf
C PG vs. leaf N. Function does not act strongly on QE, thus, we
C need to scale effect back on daily canopy version.
C-----------------------------------------------------------------------
AGEFCC = (1.0 - EXP(-2.0 * AGEFAC)) / (1. - EXP(-2.0 * 1.0))
C-----------------------------------------------------------------------
C Compute canopy PG response to changes in specific leaf weight.
C (Dornhoff and Shibles, 197?).
C-----------------------------------------------------------------------
IF (SLAAD .GT. 0.0) THEN
SLW = 1. / SLAAD
ELSE IF (SLAREF .GT. 0.0) THEN
SLW = 1. / SLAREF
ELSE
SLW = 0.0099
ENDIF
PGSLW = TABEX(YPGSLW, XPGSLW, SLW, 10)
C-----------------------------------------------------------------------
C Adjust canopy photosynthesis for CO2 concentration assuming a
C reference value of CO2 of 330 ppmv.
C-----------------------------------------------------------------------
CCK = CCEFF / CCMAX
A0 = -CCMAX * (1. - EXP(-CCK * CCMP))
PRATIO = A0 + CCMAX * (1. - EXP(-CCK * CO2))
!***********************************************************************
!***********************************************************************
! Daily integration
!***********************************************************************
ELSEIF (DYNAMIC .EQ. INTEGR) THEN
!-----------------------------------------------------------------------
! 09-14-2007 FSR restored the INTEGR section which had been commented
! out in the CSP_PHOTO module. This was done to be more consistent
! the CSP_GROW_CANE module, since CSP_PHOTO shares several variables
! with CSP_GROW_CANE in order to distribute each stalk's leaf area
! across three canopy zones. These functions of CSP_PHOTO are more
! integrative than rate-calculating.
!
C Effect of daylength on daily gross PG, computed by KJB with
C stand alone model, and used by Ernie Piper in his dissertation
C see page 127 for the equation and conditions. Nornalized to
C about 13 hours where the function is 1.00. Actually
C normalized to a bit higher between 13 and 14 hours.
C
C DLFAC = 1.0 + 0.6128 - 0.01786*DAYL + 0.006875*DAYL*DAYL
C & - 0.000247*DAYL*DAYL*DAYL
C
C-----------------------------------------------------------------------
! AGEFAC Relative effect of current leaf N on canopy photosynthesis (0-1)
! (fraction)
! AGEFCC Effect of AGEFAC on photosynthesis
! AGEREF Reference value calculated at reference leaf N value to
! normalize the effect of N for different plant species
! LI Multiplier to compute daily canopy PG as a function of leaf area
! index (LAI)
! PGLFMX Multiplier for daily canopy photosynthesis to account for
! cultivar differences in leaf photosynthesis capabilities
! PGREF Reference value for leaf level photosynthesis used in canopy
! light response curve (µmol[CO2] / m2-s)
! PGSLW Relative effect of leaf thickness (SLW) on daily canopy PG
! PRATIO Relative effect of CO2 on canopy PG, for multiplying by PG
! computed for 330 vpm
! PTSMAX Potential amount of CH20 which can be produced at the specified
! PAR for full canopy (LAI>8), all other factors optimal
! (g[CH2O]/m2-d)
! SLPF Empirical multiplier to adjust daily canopy PG due to unknown
! soil or environmental factors that persist in a given location
! SWFAC Effect of soil-water stress on photosynthesis, 1.0=no stress,
! 0.0=max stress
! TLI Reduction in specific leaf area due to daytime temperature
! being less than optimal (0-1)
! --------------------- temp for checking output -----------------------
C Compute daily gross photosynthesis (g CH2O/m2/d)
! Phosphorus stress
! Following CropGro photo.for (CHP 05/07/2004)
! AGEFCC can be > 1.0, so don't want to use minimum of PSTRES2 and AGEFCC
! (PSTRES2 is always 1.0 or below).
IF (AGEFCC .GE. 1.0) THEN
E_FAC = AGEFCC * PSTRES2
ELSE
E_FAC = MIN(AGEFCC, PSTRES2)
ENDIF
!-----------------------------------------------------------------------
! Calculate the fraction of ground area shaded prior to canopy closing.
CALL CSP_CANOPY(CONTROL,
& DAS, DeltaLeafNum, ECONO, FILECC, !Input
& FILEGC, FRACSH, FRSHV, KCAN, !Input
& LeafNum, PAR, ROWSPC, Smax, !Input
& StalkState, TGRO, TURFAC, WEATHER, XHLAI, !Input
& CANHT, CANWH, FRSHAV, H, StkHt) !Output
C-----------------------------------------------------------------------
! Compute daily gross canopy photosynthesis (g CH2O/stalk/d)
!!
!! PG = PTSMAX * SLPF * LI * TLI * E_FAC * PGSLW
!! & * PRATIO * PGLFMX * SWFAC
!-----------------------------------------------------------------------
! FRSHAV - Avg of FRACSH; hourly daylight shaded area
! SHLAI - Shaded LAI; > XHLAI prior to canopy closing
! FRSHV - Vertical sun shadow fraction
! FRACSH - Hourly daylight shadow fraction of ground area
FRSHAV = MAX(FRSHAV, 3.0E-05)
SHLAI = XHLAI * 1 / FRSHAV
LIalt = (1. - EXP(-KCAN * (XHLAI/FRSHAV))) * FRSHAV
!-----------------------------------------------------------------------
! Compute daily gross canopy photosynthesis (g[CH2O]/m2-d)
! (this function is now used only for checking against sum of stalk PG)
PG = PTSMAX * SLPF * LIalt * TLI * E_FAC * PGSLW
& * PRATIO * PGLFMX * SWFAC
!-----------------------------------------------------------------------
!**********************************************************************
!----------------BEGIN STALK-BASED PHOTOSYNTHESIS METHOD----------------
!-----------------------------------------------------------------------
! Remove DEAD stalk leaf area.
DO Stalk = 1,Smax
IF (StalkState(Stalk,1) .EQ. 'DEAD') THEN
LAsun = LAsun - LeafDist(Stalk,Sun)
LeafDist(Stalk,Sun) = 0.
LAsun = MAX(LAsun,0.)
LAshd = LAshd - LeafDist(Stalk,Shade)
LeafDist(Stalk,Shade) = 0.
LAshd = MAX(LAshd,0.)
LAgnd = LAgnd - LeafDist(Stalk,Ground)
LeafDist(Stalk,Ground) = 0.
LAgnd = MAX(LAgnd,0.)
END IF ! (StalkState(Stalk,1) .EQ. 'DEAD')
END DO ! Stalk = 1,Smax
!-----------------------------------------------------------------------
! Remove senesced leaf area beginning with lowest leaves.
DO Stalk = 1,Smax
IF (StalkState(Stalk,1) .EQ. 'LIVE' .AND.
& DeltaLeafArealost(DAS,Stalk) > 0.) THEN
temp = DeltaLeafArealost(DAS,Stalk)
IF (LeafDist(Stalk,Ground) > 0.) THEN
LeafDist(Stalk,Ground) = LeafDist(Stalk,Ground)- temp
temp = 0.
IF (LeafDist(Stalk,Ground) < 0.) THEN
temp = -LeafDist(Stalk,Ground)
LeafDist(Stalk,Ground) = 0.
END IF ! (LeafDist(Stalk,Ground) < 0.)
END IF ! (LeafDist(Stalk,Ground) > 0.)
IF (LeafDist(Stalk,Shade) > 0. .AND. temp > 0.) THEN
LeafDist(Stalk,Shade) = LeafDist(Stalk,Shade)- temp
temp = 0.
IF (LeafDist(Stalk,Shade) < 0.) THEN
temp = -LeafDist(Stalk,Shade)
LeafDist(Stalk,Shade) = 0.
END IF ! (LeafDist(Stalk,Shade) < 0.)
END IF ! (LeafDist(Stalk,Shade) > 0.)
IF (LeafDist(Stalk,Sun) > 0. .AND. temp > 0.) THEN
LeafDist(Stalk,Sun) = LeafDist(Stalk,Sun) - temp
temp = 0.
IF (LeafDist(Stalk,Sun) < 0.) THEN
temp = -LeafDist(Stalk,Sun)
LeafDist(Stalk,Sun) = 0.
LaiSunZone = 0.
END IF ! (LeafDist(Stalk,Sun) < 0.)
END IF ! (LeafDist(Stalk,Ground) > 0.)
END IF ! (StalkState(Stalk,1) .EQ. 'LIVE')
temp = 0.
END DO !Stalk = 1,Smax
!-----------------------------------------------------------------------
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
!-----------------------------------------------------------------------
! Assign leaf area on each stalk to canopy zones based on available space
! in each canopy zone. Each stalk may have leaf area in each zone.
! This section corresponds to the period before the leaf canopy closes.
PlantLeafAreaTmp = 0. ! for de-bugging FSR
IF (FRSHAV < 1.0) THEN ! Canopy has not closed
DO Stalk = 1,Smax
IF (StalkState(Stalk,1) .EQ. 'LIVE') THEN
IF (LaiSunZone <= LAITH1) THEN
LeafDist(Stalk, Sun) = LeafDist(Stalk,Sun)
& + DeltaLeafArea(DAS,Stalk)
ELSE IF (LaiSunZone + LaiShdZone <= LAITH2) THEN
LeafDist(Stalk,Shade) = LeafDist(Stalk,Shade)
& + DeltaLeafArea(DAS,Stalk) !DAS-1
ELSE
LeafDist(Stalk,Ground) = LeafDist(Stalk,Ground)
& + DeltaLeafArea(DAS,Stalk) !DAS-1
END IF !
END IF !
END DO !Stalk = 1,Smax
ELSE ! (FRSHAV = 1.0 means canopy has closed)
! After closing, new leaf area is allocated to highest canopy zone where
! a stalk has previously-existing leaf area. Since the canopy has closed,
! the canopy zone is generally filled (LaiSunZone >= LAITH1), and new
! leaf area displaces existing leaf area, both same-stalk and other stalk,
! which are moved down a zone.
DO Stalk = 1,Smax
IF (LeafDist(Stalk,Sun) > 0.) THEN
LeafDist(Stalk,Sun) = LeafDist(Stalk,Sun)
& + LfShdFac * DeltaLeafArea(DAS,Stalk)
LeafDist(Stalk,Shade) = LeafDist(Stalk,Shade)
& + (1 - LfShdFac) * DeltaLeafArea(DAS,Stalk)
ELSE IF (LeafDist(Stalk,Shade) > 0.) THEN
LeafDist(Stalk,Shade) = LeafDist(Stalk,Shade)
& + LfShdFac * DeltaLeafArea(DAS,Stalk)
LeafDist(Stalk,Ground) = LeafDist(Stalk,Ground)
& + (1 - LfShdFac) * DeltaLeafArea(DAS,Stalk)
ELSE
LeafDist(Stalk,Ground) = LeafDist(Stalk,Ground)
& + DeltaLeafArea(DAS,Stalk)
END IF
END DO
END IF !(FRSHAV < 1.0)
!-----------------------------------------------------------------------
! Calculate cumulative leaf area in each canopy pseudo-zone
! IF (LeafAreaPlant(DAS-1) > 0) THEN
DO Stalk = 1,Smax
LAsun = LAsun + LeafDist(Stalk,Sun)
LAshd = LAshd + LeafDist(Stalk,Shade)
LAgnd = LAgnd + LeafDist(Stalk,Ground)
PlantLeafAreaTmp = PlantLeafAreaTmp !for debugging FSR
& + LeafDist(Stalk,Sun)
& + LeafDist(Stalk,Shade)
& + LeafDist(Stalk,Ground)
END DO !Stalk = 1,Smax
LAtmp(DAS) = LAsun + LAshd + LAgnd !FSR-temporary debug check
!-----------------------------------------------------------------------
! Calculate LAI for each canopy pseudo-zone
LaiSunZone = LAsun * PLTPOP * 0.0001 * 1 / FRSHAV
LaiShdZone = LAshd * PLTPOP * 0.0001 * 1 / FRSHAV
LaiGndZone = LAgnd * PLTPOP * 0.0001 * 1 / FRSHAV
!-----------------------------------------------------------------------
! Check whether canopy zones are over-filled, and if so move leaf area
! down a zone, beginning with newer (higher number) stalks.
Stalk = Smax + 1
DO WHILE ((LaiSunZone > LAITH1) .AND. (Stalk > 1.))
Stalk = Stalk - 1
IF (LeafDist(Stalk,Sun) > 0.) THEN
LeafDist(Stalk,Shade) = LeafDist(Stalk,Shade)
& + CanLmtFac * LeafDist(Stalk,Sun)
LeafDist(Stalk,Sun) = (1 - CanLmtFac) * LeafDist(Stalk,Sun)
LAsun = LAsun - CanLmtFac * LeafDist(Stalk,Sun)
LAshd = LAshd + CanLmtFac * LeafDist(Stalk,Sun)
LaiSunZone = LAsun * PLTPOP * 0.0001 * 1 / FRSHAV
LaiShdZone = LAshd * PLTPOP * 0.0001 * 1 / FRSHAV
END IF
END DO
!------------------------
Stalk = Smax +1
DO WHILE (LaiSunZone + LaiShdZone > LAITH2 .AND. Stalk > 1.)
Stalk = Stalk - 1
IF (LeafDist(Stalk,Shade) > 0.) THEN
LeafDist(Stalk,Ground) = LeafDist(Stalk,Ground)
& + CanLmtFac * LeafDist(Stalk,Shade)
LeafDist(Stalk,Shade)=(1-CanLmtFac) * LeafDist(Stalk,Shade)
LAshd = LAshd - CanLmtFac * LeafDist(Stalk,Shade)
LaiShdZone = LAshd * PLTPOP * 0.0001 * 1 / FRSHAV
END IF
END DO
!-----------------------------------------------------------------------
! Re-calculate cumulative leaf area in each canopy pseudo-zone
! IF (LeafAreaPlant(DAS-1) > 0) THEN
LAsun = 0.
LAshd = 0.
LAgnd = 0.
PlantLeafAreaTmp = 0.
DO Stalk = 1,Smax
LAsun = LAsun + LeafDist(Stalk,Sun)
LAshd = LAshd + LeafDist(Stalk,Shade)
LAgnd = LAgnd + LeafDist(Stalk,Ground)
PlantLeafAreaTmp = PlantLeafAreaTmp !for debugging FSR
& + LeafDist(Stalk,Sun)
& + LeafDist(Stalk,Shade)
& + LeafDist(Stalk,Ground)
END DO !Stalk = 1,Smax
!-----------------------------------------------------------------------
! Re-calculate LAI for each canopy pseudo-zone
!! DO Stalk = 1,Smax
LaiSunZone = LAsun * PLTPOP * 0.0001 * 1 / FRSHAV
LaiShdZone = LAshd * PLTPOP * 0.0001 * 1 / FRSHAV
LaiGndZone = LAgnd * PLTPOP * 0.0001 * 1 / FRSHAV
!! END DO ! Stalk = 1,Smax
!-----------------------------------------------------------------------
! Check whether canopy zones are under-filled, and if so move leaf area
! up a zone, beginning with older (lower number) stalks.
DO Stalk = 1,Smax
IF (LaiSunZone <= LAITH1 .AND.
& LeafDist(Stalk,Shade) > 0.) THEN
LeafDist(Stalk,Sun) = LeafDist(Stalk,Sun)
& + CanLmtFac * LeafDist(Stalk,Shade)
LeafDist(Stalk,Shade) = (1 - CanLmtFac)
& * LeafDist(Stalk,Shade)
LAsun = LAsun + CanLmtFac * LeafDist(Stalk,Shade)
LAshd = LAshd - CanLmtFac * LeafDist(Stalk,Shade)
LaiSunZone = LAsun * PLTPOP * 0.0001 * 1 / FRSHAV
LaiShdZone = LAshd * PLTPOP * 0.0001 * 1 / FRSHAV
ELSE IF (LaiSunZone + LaiShdZone <= LAITH2 .AND.
& LeafDist(Stalk,Ground) > 0.) THEN
LeafDist(Stalk,Shade) = LeafDist(Stalk,Shade)
& + CanLmtFac * LeafDist(Stalk,Ground)
LeafDist(Stalk,Ground) = (1 - CanLmtFac)
& * LeafDist(Stalk,Ground)
LAshd = LAshd + CanLmtFac * LeafDist(Stalk,Ground)
LAgnd = LAgnd - CanLmtFac * LeafDist(Stalk,Ground)
LaiShdZone = LAshd * PLTPOP * 0.0001 * 1 / FRSHAV
END IF
END DO
LAtmp(DAS) = LAsun + LAshd + LAgnd !FSR-temporary debug check
!-----------------------------------------------------------------------
! FSR-temporary debug check Was here
!-----------------------------------------------------------------------
! Calculate LI for each canopy pseudo-zone
IF (LAsun > 0) THEN
LIsunAvl = (1. - EXP(-KCAN * LaiSunZone))* FRSHAV
ELSE
LIsunAvl = 0.
END IF ! (LAsun > 0)
!--------
IF (LAshd > 0) THEN
LIshdAvl = ((1. - EXP(-KCAN*(LaiSunZone+LaiShdZone)))*FRSHAV)
& - LIsunAvl
ELSE
LIshdAvl = 0.
END IF ! (LAshd > 0)
!--------
IF (LAgnd > 0) THEN
!!! LIgndAvl = (LI - (LIsunAvl + LIshdAvl))* FRSHAV
LIgndAvl
& = ((1.- EXP(-KCAN*(LaiSunZone+LaiShdZone+LaiGndZone)))
& * FRSHAV)
& - (LIsunAvl+LIshdAvl)
!! LIgndAvl = (LIalt - (LIsunAvl + LIshdAvl))
LIgndAvl = MAX(LIgndAvl,0.)
ELSE
LIgndAvl = 0.
END IF ! (LAgnd > 0)
!-----------------------------------------------------------------------
! Distribute LI among stalks according to canopy zone and stalk
! leaf area.
IF (LeafAreaPlant(DAS-1) > 0) THEN !DAS-1 since DAS not calculated
!until CSP_Grow_Cane is called
DO Stalk = 1,Smax
! StkLI(Stalk) = 0.0 !Initialize daily to zero
! StkPG(Stalk) = 0.0
IF (LeafDist(Stalk,Sun) > 0) THEN
StkLI(Stalk,Sun) = LIsunAvl * 1/PLTPOP
& * LeafDist(Stalk,Sun)/LAsun
END IF !(LeafDist(Stalk,Sun) .GT. 0)
IF (LeafDist(Stalk,Shade) > 0) THEN
StkLI(Stalk,Shade) = LIshdAvl * 1/PLTPOP
& * LeafDist(Stalk,Shade)/LAshd
END IF !(LeafDist(Stalk,Shade) .GT. 0)
IF (LeafDist(Stalk,Ground) > 0) THEN
StkLI(Stalk,Ground) = LIgndAvl * 1/PLTPOP
& * LeafDist(Stalk,Ground)/LAgnd
END IF !(LeafDist(Stalk,Ground) .GT. 0)
DO Zone = 1,3
StkPG(Stalk,Zone) = PTSMAX * SLPF * StkLI(Stalk,Zone)
& * TLI * E_FAC * PGSLW * PRATIO * PGLFMX * SWFAC
LITOTAL = LITOTAL + StkLI(Stalk,Zone) * PLTPOP!Tmp for debug
PGT = PGT + StkPG(Stalk,Zone) * PLTPOP
END DO ! Zone = 1,Ground
END DO ! Stalk = 1,Smax
LIallZone = LIsunAvl + LIshdAvl + LIgndAvl
! PGT = 0.
END IF ! (LeafAreaPlant(DAS-1) > 0)
!-----------------------------------------------------------------------
! FSR-temporary debug check
! The following two LAI calculations will not be equal:
! XHLAI is equal to LAI2 at this point in the program, but
! equals LAI after a call to CSP_GROW_CANE). LI is
! calculated from XHLAI (input) and LITOTAL from StkLI
! (output)
LAI2 = PLTPOP * LeafAreaPlant(DAS-1) / 10000
LaiAllZone = (LaiSunZone + LaiShdZone + LaiGndZone)
LAItmp(DAS) = LAtmp(DAS) * PLTPOP * 0.0001 ! LaiAllZone
! LAItmp(DAS) = LaiAllZone
XLAI = LAtmp(DAS-1) * PLTPOP * 0.0001 / FRSHAV
!-----------------------------------------------------------------------
! Eliminate the production of CH2O while stalk is very small.
!!! IF (LeafNum(DAS,Stalk) <= 2) THEN !DAS-1
!!! StkPG(Stalk) = 0.0 !Not applied to PG calculation
!!! END IF !(LeafNum(DAS,Stalk) <= 2)
! For PG to equal sum of StkPG(Stalk), must eliminate EXCESS factor
! (below), as well as the code above which stops production of CH2O when
! stalks are very young. Neither of these are applied to PG, since
! EXCESS is now a (Stalk) array, and StkPG(j) = 0.0 was not applied
! to PG. To test the equivalence of PG and PGT, these two lines must be
! deactiviated. (Compare PG to PGT in CSP_PHOTO.OUT.) FSR
!
!!! StkPG(Stalk) = StkPG(Stalk) * EXCESS(Stalk)!Not applied to PG
! EXCESS deactivated. If it is to be restored, it needs to accomodate
! canopy zones. This may involve applying it only to the zone which is
! most likely to cause excess production, Zone 1. On the other hand, maybe
! the photosynthesis calculation should be refined, instead of EXCESS.
!
!-----------------------------------------------------------------------
C-----------------------------------------------------------------------
! Calculate ratio for assigning shoot carbon costs to existing stalks
DO Stalk = 1,Smax
TotalPG(stalk) = 0.
DO Zone = 1,3
TotalPG(stalk) = TotalPG(stalk) + StkPG(Stalk,Zone)
END DO ! Zone = 1,Ground
IF (TotalPG(stalk) > 0 .AND. PGT > 0) THEN
PgRatio(stalk) = TotalPG(Stalk) / (PGT/PLTPOP)
ELSE
PgRatio(Stalk) = 0.0
ENDIF ! (StkPG(Stalk) > 0 .AND. PGT >0)
END DO ! Stalk = 1,Smax
!---------------END STALK-BASED PHOTOSYNTHESIS METHOD---------------
!***********************************************************************
IF (INDEX('Y' ,ISWITCH%IDETG) > 0 .AND.
& INDEX('YDA',ISWITCH%IDETL) > 0) THEN
WRITE(PLUN,'(/1X,I7,1X,I4,10(1X,F5.2),2(1X,F6.2),3(1X,F4.1),
& 2(1X,F6.2),4(1X,F5.2),1X,F6.2,7(1X,F6.2))',
& ADVANCE="NO"),
& YRDOY, DAS, XHLAI, LaiAllZone, SHLAI, FRSHAV, LIalt,
& LI, LITOTAL, LIsunAvl, LIshdAvl,
& LIgndAvl,PG, PGT, LAsun/10000, LAshd/10000, LAgnd/10000,
& EXCESS(1), PAR, RNITP, SLAAD, SWFAC, TAVG, AGEFAC, PTSMAX,
& SLPF, TLI, AGEFCC, PGSLW, PRATIO, PGLFMX
!!! DO Stalk = 1,Smax
!!! WRITE(PLUN,'(2X,F4.2)', ADVANCE="NO") StkLI(Stalk)
!!! END DO
DO Stalk = 1,Smax
WRITE(PLUN,'(2X,F4.1)', ADVANCE="NO") TotalPG(Stalk)
END DO
ENDIF
! PG = PG * EXCESS ! EXCESS is now an array (Stalk)
! ENDIF !(DYNAMIC .EQ. INTEGR)
!***********************************************************************
!***********************************************************************
! END OF DYNAMIC IF CONSTRUCT
!***********************************************************************
!!! LITOTAL = 0.0 ! Temporary for debugging
ENDIF
!***********************************************************************
RETURN
END !SUBROUTINE CSP_PHOTO
C=======================================================================
C CSP_PHOTIP, Subroutine, N.B. Pickering
C Read input parameters for daily photosynthesis.
C-----------------------------------------------------------------------
C REVISION HISTORY
C 09/25/99 Written.
!-----------------------------------------------------------------------
C Output:
C Local :
!-----------------------------------------------------------------------
! Called from: CSP_PHOTO
! Calls : None
C=======================================================================
SUBROUTINE CSP_PHOTIP(FILEIO,
& CCEFF, CCMAX, CCMP, FNPGN, FNPGT, LIsun, !, KCAN
& LIshd, LNREF, PARMAX, PGREF, !, LMXSTD, PHTHRS10
& PHTMAX, PLTPOP, ROWSPC, TYPPGN, TYPPGT, XPGSLW,
& YPGSLW)
!-----------------------------------------------------------------------
IMPLICIT NONE
CHARACTER*1 BLANK
CHARACTER*3 TYPPGN, TYPPGT
CHARACTER*6 ERRKEY, SECTION
CHARACTER*12 FILEC
CHARACTER*30 FILEIO
CHARACTER*80 PATHCR,CHAR
CHARACTER*92 FILECC
INTEGER LUNIO, LINC, LNUM, FOUND
INTEGER II, PATHL, LUNCRP, ERR, ISECT
REAL CCEFF, CCMAX, CCMP, LIshd, LIsun, !, KCAN
& LNREF, PARMAX, PGREF, PHTMAX, !LMXSTD, PHTHRS10,
& PLTPOP, ROWSPC, XPGSLW(15) !, SLPF
REAL FNPGN(4),FNPGT(4)
REAL YPGSLW(15)
PARAMETER (BLANK = ' ')
PARAMETER (ERRKEY = 'PHOTIP')
!-----------------------------------------------------------------------
! Open and read FILEIO (DSSAT45.INP)
!-----------------------------------------------------------------------
CALL GETLUN('FILEIO', LUNIO)
OPEN (LUNIO, FILE = FILEIO,STATUS = 'OLD',IOSTAT=ERR)
IF (ERR .NE. 0) CALL ERROR(ERRKEY,ERR,FILEIO,0)
!-----------------------------------------------------------------------
READ(LUNIO,50,IOSTAT=ERR) FILEC, PATHCR; LNUM = 7
50 FORMAT(//////,15X,A12,1X,A80)
IF (ERR .NE. 0) CALL ERROR(ERRKEY,ERR,FILEIO,LNUM)
!-----------------------------------------------------------------------
C Read Planting Details Section
!-----------------------------------------------------------------------
SECTION = '*PLANT'
CALL FIND(LUNIO, SECTION, LINC, FOUND) ; LNUM = LNUM + LINC
IF (FOUND .EQ. 0) THEN
CALL ERROR(SECTION, 42, FILEIO, LNUM)
ELSE
READ(LUNIO,'(24X,F6.1,12X,F6.0)',IOSTAT=ERR)
& PLTPOP, ROWSPC ; LNUM = LNUM + 1
IF (ERR .NE. 0) CALL ERROR(ERRKEY,ERR,FILEIO,LNUM)
ENDIF
!-----------------------------------------------------------------------
C Read Cultivars Section
!-----------------------------------------------------------------------
SECTION = '*CULTI'
CALL FIND(LUNIO, SECTION, LINC, FOUND) ; LNUM = LNUM + LINC
IF (FOUND .EQ. 0) THEN
CALL ERROR(SECTION, 42, FILEIO, LNUM)
ELSE
READ(LUNIO,'(36X,F6.0,60X,2F6.3)',IOSTAT=ERR) PHTMAX, LIsun,
& LIshd
LNUM = LNUM + 1
IF (ERR .NE. 0) CALL ERROR(ERRKEY,ERR,FILEIO,LNUM)
ENDIF