/
PhotosynthesisMod.F90
4975 lines (4326 loc) · 265 KB
/
PhotosynthesisMod.F90
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
module PhotosynthesisMod
#include "shr_assert.h"
!------------------------------------------------------------------------------
! !DESCRIPTION:
! Leaf photosynthesis and stomatal conductance calculation as described by
! Bonan et al (2011) JGR, 116, doi:10.1029/2010JG001593 and extended to
! a multi-layer canopy
!
! !USES:
use shr_sys_mod , only : shr_sys_flush
use shr_kind_mod , only : r8 => shr_kind_r8
use shr_log_mod , only : errMsg => shr_log_errMsg
use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=)
use abortutils , only : endrun
use clm_varctl , only : use_c13, use_c14, use_cn, use_cndv, use_fates, use_luna, use_hydrstress
use clm_varctl , only : iulog
use clm_varpar , only : nlevcan, nvegwcs, mxpft
use clm_varcon , only : c14ratio, spval, isecspday
use decompMod , only : bounds_type, subgrid_level_patch
use QuadraticMod , only : quadratic
use pftconMod , only : pftcon
use CIsoAtmTimeseriesMod, only : C14BombSpike, use_c14_bombspike, C13TimeSeries, use_c13_timeseries, nsectors_c14
use atm2lndType , only : atm2lnd_type
use CanopyStateType , only : canopystate_type
use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type
use WaterFluxBulkType , only : waterfluxbulk_type
use SoilStateType , only : soilstate_type
use TemperatureType , only : temperature_type
use SolarAbsorbedType , only : solarabs_type
use SurfaceAlbedoType , only : surfalb_type
use OzoneBaseMod , only : ozone_base_type
use LandunitType , only : lun
use PatchType , only : patch
use GridcellType , only : grc
!
implicit none
private
!
! !PUBLIC MEMBER FUNCTIONS:
public :: Photosynthesis ! Leaf stomatal resistance and leaf photosynthesis
public :: PhotosynthesisTotal ! Determine of total photosynthesis
public :: Fractionation ! C13 fractionation during photosynthesis
! For plant hydraulics approach
public :: PhotosynthesisHydraulicStress ! Leaf stomatal resistance and leaf photosynthesis
! Simultaneous solution of sunlit/shaded per Pierre
! Gentine/Daniel Kennedy plant hydraulic stress method
public :: plc ! Return value of vulnerability curve at x
! !PRIVATE MEMBER FUNCTIONS:
private :: hybrid ! hybrid solver for ci
private :: ci_func ! ci function
private :: brent ! brent solver for root of a single variable function
private :: ft ! photosynthesis temperature response
private :: fth ! photosynthesis temperature inhibition
private :: fth25 ! scaling factor for photosynthesis temperature inhibition
! For plant hydraulics approach
private :: hybrid_PHS ! hybrid solver for ci
private :: ci_func_PHS ! ci function
private :: brent_PHS ! brent solver for root of a single variable function
private :: calcstress ! compute the root water stress
private :: getvegwp ! calculate vegetation water potential (sun, sha, xylem, root)
private :: getqflx ! calculate sunlit and shaded transpiration
private :: spacF ! flux divergence across each vegetation segment
private :: spacA ! the inverse Jacobian matrix relating delta(vegwp) to f, d(vegwp)=A*f
private :: d1plc ! compute 1st deriv of conductance attenuation for each segment
! !PRIVATE DATA:
integer, parameter, private :: leafresp_mtd_ryan1991 = 1 ! Ryan 1991 method for lmr25top
integer, parameter, private :: leafresp_mtd_atkin2015 = 2 ! Atkin 2015 method for lmr25top
integer, parameter, private :: sun=1 ! index for sunlit
integer, parameter, private :: sha=2 ! index for shaded
integer, parameter, private :: xyl=3 ! index for xylem
integer, parameter, private :: root=4 ! index for root
integer, parameter, private :: veg=0 ! index for vegetation
integer, parameter, private :: soil=1 ! index for soil
integer, parameter, private :: stomatalcond_mtd_bb1987 = 1 ! Ball-Berry 1987 method for photosynthesis
integer, parameter, private :: stomatalcond_mtd_medlyn2011 = 2 ! Medlyn 2011 method for photosynthesis
! !PUBLIC VARIABLES:
type :: photo_params_type
real(r8) :: act25 ! Rubisco activity at 25 C (umol CO2/gRubisco/s)
real(r8) :: fnr ! Mass ratio of total Rubisco molecular mass to nitrogen in Rubisco (gRubisco/gN in Rubisco)
real(r8) :: cp25_yr2000 ! CO2 compensation point at 25°C at present day O2 (mol/mol)
real(r8) :: kc25_coef ! Michaelis-Menten const. at 25°C for CO2 (unitless)
real(r8) :: ko25_coef ! Michaelis-Menten const. at 25°C for O2 (unitless)
real(r8) :: fnps ! Fraction of light absorbed by non-photosynthetic pigment (unitless)
real(r8) :: theta_psii ! Empirical curvature parameter for electron transport rate (unitless)
real(r8) :: theta_ip ! Empirical curvature parameter for ap photosynthesis co-limitation (unitless)
real(r8) :: vcmaxha ! Activation energy for vcmax (J/mol)
real(r8) :: jmaxha ! Activation energy for jmax (J/mol)
real(r8) :: tpuha ! Activation energy for tpu (J/mol)
real(r8) :: lmrha ! Activation energy for lmr (J/mol)
real(r8) :: kcha ! Activation energy for kc (J/mol)
real(r8) :: koha ! Activation energy for ko (J/mol)
real(r8) :: cpha ! Activation energy for cp (J/mol)
real(r8) :: vcmaxhd ! Deactivation energy for vcmax (J/mol)
real(r8) :: jmaxhd ! Deactivation energy for jmax (J/mol)
real(r8) :: tpuhd ! Deactivation energy for tpu (J/mol)
real(r8) :: lmrhd ! Deactivation energy for lmr (J/mol)
real(r8) :: lmrse ! Entropy term for lmr (J/mol/K)
real(r8) :: tpu25ratio ! Ratio of tpu25top to vcmax25top (unitless)
real(r8) :: kp25ratio ! Ratio of kp25top to vcmax25top (unitless)
real(r8), allocatable, public :: krmax (:)
real(r8), allocatable, private :: kmax (:,:)
real(r8), allocatable, private :: psi50 (:,:)
real(r8), allocatable, private :: ck (:,:)
real(r8), allocatable, private :: lmr_intercept_atkin(:)
real(r8), allocatable, private :: theta_cj (:) ! Empirical curvature parameter for ac, aj photosynthesis co-limitation (unitless)
contains
procedure, private :: allocParams
end type photo_params_type
!
type(photo_params_type), public, protected :: params_inst ! params_inst is populated in readParamsMod
type, public :: photosyns_type
logical , pointer, private :: c3flag_patch (:) ! patch true if C3 and false if C4
! Plant hydraulic stress specific variables
real(r8), pointer, private :: ac_phs_patch (:,:,:) ! patch Rubisco-limited gross photosynthesis (umol CO2/m**2/s)
real(r8), pointer, private :: aj_phs_patch (:,:,:) ! patch RuBP-limited gross photosynthesis (umol CO2/m**2/s)
real(r8), pointer, private :: ap_phs_patch (:,:,:) ! patch product-limited (C3) or CO2-limited (C4) gross photosynthesis (umol CO2/m**2/s)
real(r8), pointer, private :: ag_phs_patch (:,:,:) ! patch co-limited gross leaf photosynthesis (umol CO2/m**2/s)
real(r8), pointer, private :: an_sun_patch (:,:) ! patch sunlit net leaf photosynthesis (umol CO2/m**2/s)
real(r8), pointer, private :: an_sha_patch (:,:) ! patch shaded net leaf photosynthesis (umol CO2/m**2/s)
real(r8), pointer, private :: vcmax_z_phs_patch (:,:,:) ! patch maximum rate of carboxylation (umol co2/m**2/s)
real(r8), pointer, private :: kp_z_phs_patch (:,:,:) ! patch initial slope of CO2 response curve (C4 plants)
real(r8), pointer, private :: tpu_z_phs_patch (:,:,:) ! patch triose phosphate utilization rate (umol CO2/m**2/s)
real(r8), pointer, private :: gs_mol_sun_patch (:,:) ! patch sunlit leaf stomatal conductance (umol H2O/m**2/s)
real(r8), pointer, private :: gs_mol_sha_patch (:,:) ! patch shaded leaf stomatal conductance (umol H2O/m**2/s)
real(r8), pointer, private :: gs_mol_sun_ln_patch (:,:) ! patch sunlit leaf stomatal conductance averaged over 1 hour before to 1 hour after local noon (umol H2O/m**2/s)
real(r8), pointer, private :: gs_mol_sha_ln_patch (:,:) ! patch shaded leaf stomatal conductance averaged over 1 hour before to 1 hour after local noon (umol H2O/m**2/s)
real(r8), pointer, private :: ac_patch (:,:) ! patch Rubisco-limited gross photosynthesis (umol CO2/m**2/s)
real(r8), pointer, private :: aj_patch (:,:) ! patch RuBP-limited gross photosynthesis (umol CO2/m**2/s)
real(r8), pointer, private :: ap_patch (:,:) ! patch product-limited (C3) or CO2-limited (C4) gross photosynthesis (umol CO2/m**2/s)
real(r8), pointer, private :: ag_patch (:,:) ! patch co-limited gross leaf photosynthesis (umol CO2/m**2/s)
real(r8), pointer, private :: an_patch (:,:) ! patch net leaf photosynthesis (umol CO2/m**2/s)
real(r8), pointer, private :: vcmax_z_patch (:,:) ! patch maximum rate of carboxylation (umol co2/m**2/s)
real(r8), pointer, private :: cp_patch (:) ! patch CO2 compensation point (Pa)
real(r8), pointer, private :: kc_patch (:) ! patch Michaelis-Menten constant for CO2 (Pa)
real(r8), pointer, private :: ko_patch (:) ! patch Michaelis-Menten constant for O2 (Pa)
real(r8), pointer, private :: qe_patch (:) ! patch quantum efficiency, used only for C4 (mol CO2 / mol photons)
real(r8), pointer, private :: tpu_z_patch (:,:) ! patch triose phosphate utilization rate (umol CO2/m**2/s)
real(r8), pointer, private :: kp_z_patch (:,:) ! patch initial slope of CO2 response curve (C4 plants)
real(r8), pointer, private :: bbb_patch (:) ! patch Ball-Berry minimum leaf conductance (umol H2O/m**2/s)
real(r8), pointer, private :: mbb_patch (:) ! patch Ball-Berry slope of conductance-photosynthesis relationship
real(r8), pointer, private :: gs_mol_patch (:,:) ! patch leaf stomatal conductance (umol H2O/m**2/s)
real(r8), pointer, private :: gb_mol_patch (:) ! patch leaf boundary layer conductance (umol H2O/m**2/s)
real(r8), pointer, private :: rh_leaf_patch (:) ! patch fractional humidity at leaf surface (dimensionless)
real(r8), pointer, private :: vpd_can_patch (:) ! patch canopy vapor pressure deficit (kPa)
real(r8), pointer, private :: alphapsnsun_patch (:) ! patch sunlit 13c fractionation ([])
real(r8), pointer, private :: alphapsnsha_patch (:) ! patch shaded 13c fractionation ([])
real(r8), pointer, public :: rc13_canair_patch (:) ! patch C13O2/C12O2 in canopy air
real(r8), pointer, public :: rc13_psnsun_patch (:) ! patch C13O2/C12O2 in sunlit canopy psn flux
real(r8), pointer, public :: rc13_psnsha_patch (:) ! patch C13O2/C12O2 in shaded canopy psn flux
real(r8), pointer, public :: psnsun_patch (:) ! patch sunlit leaf photosynthesis (umol CO2/m**2/s)
real(r8), pointer, public :: psnsha_patch (:) ! patch shaded leaf photosynthesis (umol CO2/m**2/s)
real(r8), pointer, public :: c13_psnsun_patch (:) ! patch c13 sunlit leaf photosynthesis (umol 13CO2/m**2/s)
real(r8), pointer, public :: c13_psnsha_patch (:) ! patch c13 shaded leaf photosynthesis (umol 13CO2/m**2/s)
real(r8), pointer, public :: c14_psnsun_patch (:) ! patch c14 sunlit leaf photosynthesis (umol 14CO2/m**2/s)
real(r8), pointer, public :: c14_psnsha_patch (:) ! patch c14 shaded leaf photosynthesis (umol 14CO2/m**2/s)
real(r8), pointer, private :: psnsun_z_patch (:,:) ! patch canopy layer: sunlit leaf photosynthesis (umol CO2/m**2/s)
real(r8), pointer, private :: psnsha_z_patch (:,:) ! patch canopy layer: shaded leaf photosynthesis (umol CO2/m**2/s)
real(r8), pointer, private :: psnsun_wc_patch (:) ! patch Rubsico-limited sunlit leaf photosynthesis (umol CO2/m**2/s)
real(r8), pointer, private :: psnsha_wc_patch (:) ! patch Rubsico-limited shaded leaf photosynthesis (umol CO2/m**2/s)
real(r8), pointer, private :: psnsun_wj_patch (:) ! patch RuBP-limited sunlit leaf photosynthesis (umol CO2/m**2/s)
real(r8), pointer, private :: psnsha_wj_patch (:) ! patch RuBP-limited shaded leaf photosynthesis (umol CO2/m**2/s)
real(r8), pointer, private :: psnsun_wp_patch (:) ! patch product-limited sunlit leaf photosynthesis (umol CO2/m**2/s)
real(r8), pointer, private :: psnsha_wp_patch (:) ! patch product-limited shaded leaf photosynthesis (umol CO2/m**2/s)
real(r8), pointer, public :: fpsn_patch (:) ! patch photosynthesis (umol CO2/m**2 ground/s)
real(r8), pointer, private :: fpsn_wc_patch (:) ! patch Rubisco-limited photosynthesis (umol CO2/m**2 ground/s)
real(r8), pointer, private :: fpsn_wj_patch (:) ! patch RuBP-limited photosynthesis (umol CO2/m**2 ground/s)
real(r8), pointer, private :: fpsn_wp_patch (:) ! patch product-limited photosynthesis (umol CO2/m**2 ground/s)
real(r8), pointer, public :: lnca_patch (:) ! top leaf layer leaf N concentration (gN leaf/m^2)
real(r8), pointer, public :: lmrsun_patch (:) ! patch sunlit leaf maintenance respiration rate (umol CO2/m**2/s)
real(r8), pointer, public :: lmrsha_patch (:) ! patch shaded leaf maintenance respiration rate (umol CO2/m**2/s)
real(r8), pointer, private :: lmrsun_z_patch (:,:) ! patch canopy layer: sunlit leaf maintenance respiration rate (umol CO2/m**2/s)
real(r8), pointer, private :: lmrsha_z_patch (:,:) ! patch canopy layer: shaded leaf maintenance respiration rate (umol CO2/m**2/s)
real(r8), pointer, public :: cisun_z_patch (:,:) ! patch intracellular sunlit leaf CO2 (Pa)
real(r8), pointer, public :: cisha_z_patch (:,:) ! patch intracellular shaded leaf CO2 (Pa)
real(r8), pointer, private :: rssun_z_patch (:,:) ! patch canopy layer: sunlit leaf stomatal resistance (s/m)
real(r8), pointer, private :: rssha_z_patch (:,:) ! patch canopy layer: shaded leaf stomatal resistance (s/m)
real(r8), pointer, public :: rssun_patch (:) ! patch sunlit stomatal resistance (s/m)
real(r8), pointer, public :: rssha_patch (:) ! patch shaded stomatal resistance (s/m)
real(r8), pointer, public :: luvcmax25top_patch (:) ! vcmax25 ! (umol/m2/s)
real(r8), pointer, public :: lujmax25top_patch (:) ! vcmax25 (umol/m2/s)
real(r8), pointer, public :: lutpu25top_patch (:) ! vcmax25 (umol/m2/s)
!!
! LUNA specific variables
real(r8), pointer, public :: vcmx25_z_patch (:,:) ! patch leaf Vc,max25 (umol CO2/m**2/s) for canopy layer
real(r8), pointer, public :: jmx25_z_patch (:,:) ! patch leaf Jmax25 (umol electron/m**2/s) for canopy layer
real(r8), pointer, public :: vcmx25_z_last_valid_patch (:,:) ! patch leaf Vc,max25 at the end of the growing season for the previous year
real(r8), pointer, public :: jmx25_z_last_valid_patch (:,:) ! patch leaf Jmax25 at the end of the growing season for the previous year
real(r8), pointer, public :: pnlc_z_patch (:,:) ! patch proportion of leaf nitrogen allocated for light capture for canopy layer
real(r8), pointer, public :: enzs_z_patch (:,:) ! enzyme decay status 1.0-fully active; 0-all decayed during stress
real(r8), pointer, public :: fpsn24_patch (:) ! 24 hour mean patch photosynthesis (umol CO2/m**2 ground/day)
! Logical switches for different options
logical, public :: rootstem_acc ! Respiratory acclimation for roots and stems
logical, private :: light_inhibit ! If light should inhibit respiration
integer, private :: leafresp_method ! leaf maintencence respiration at 25C for canopy top method to use
integer, private :: stomatalcond_mtd ! Stomatal conduction method type
logical, private :: modifyphoto_and_lmr_forcrop ! Modify photosynthesis and LMR for crop
contains
! Public procedures
procedure, public :: Init
procedure, public :: Restart
procedure, public :: ReadNML
procedure, public :: ReadParams
procedure, public :: TimeStepInit
procedure, public :: NewPatchInit
! Private procedures
procedure, private :: InitAllocate
procedure, private :: InitHistory
procedure, private :: InitCold
end type photosyns_type
character(len=*), parameter, private :: sourcefile = &
__FILE__
!------------------------------------------------------------------------
contains
!------------------------------------------------------------------------
subroutine Init(this, bounds)
class(photosyns_type) :: this
type(bounds_type), intent(in) :: bounds
call this%InitAllocate (bounds)
call this%InitHistory (bounds)
call this%InitCold (bounds)
end subroutine Init
!------------------------------------------------------------------------
subroutine InitAllocate(this, bounds)
!
! !ARGUMENTS:
class(photosyns_type) :: this
type(bounds_type), intent(in) :: bounds
!
! !LOCAL VARIABLES:
integer :: begp, endp
integer :: begc, endc
!------------------------------------------------------------------------
begp = bounds%begp; endp= bounds%endp
begc = bounds%begc; endc= bounds%endc
allocate(this%c3flag_patch (begp:endp)) ; this%c3flag_patch (:) =.false.
allocate(this%ac_phs_patch (begp:endp,2,1:nlevcan)) ; this%ac_phs_patch (:,:,:) = nan
allocate(this%aj_phs_patch (begp:endp,2,1:nlevcan)) ; this%aj_phs_patch (:,:,:) = nan
allocate(this%ap_phs_patch (begp:endp,2,1:nlevcan)) ; this%ap_phs_patch (:,:,:) = nan
allocate(this%ag_phs_patch (begp:endp,2,1:nlevcan)) ; this%ag_phs_patch (:,:,:) = nan
allocate(this%an_sun_patch (begp:endp,1:nlevcan)) ; this%an_sun_patch (:,:) = nan
allocate(this%an_sha_patch (begp:endp,1:nlevcan)) ; this%an_sha_patch (:,:) = nan
allocate(this%vcmax_z_phs_patch (begp:endp,2,1:nlevcan)) ; this%vcmax_z_phs_patch (:,:,:) = nan
allocate(this%tpu_z_phs_patch (begp:endp,2,1:nlevcan)) ; this%tpu_z_phs_patch (:,:,:) = nan
allocate(this%kp_z_phs_patch (begp:endp,2,1:nlevcan)) ; this%kp_z_phs_patch (:,:,:) = nan
allocate(this%gs_mol_sun_patch (begp:endp,1:nlevcan)) ; this%gs_mol_sun_patch (:,:) = nan
allocate(this%gs_mol_sha_patch (begp:endp,1:nlevcan)) ; this%gs_mol_sha_patch (:,:) = nan
allocate(this%gs_mol_sun_ln_patch (begp:endp,1:nlevcan)) ; this%gs_mol_sun_ln_patch (:,:) = nan
allocate(this%gs_mol_sha_ln_patch (begp:endp,1:nlevcan)) ; this%gs_mol_sha_ln_patch (:,:) = nan
allocate(this%ac_patch (begp:endp,1:nlevcan)) ; this%ac_patch (:,:) = nan
allocate(this%aj_patch (begp:endp,1:nlevcan)) ; this%aj_patch (:,:) = nan
allocate(this%ap_patch (begp:endp,1:nlevcan)) ; this%ap_patch (:,:) = nan
allocate(this%ag_patch (begp:endp,1:nlevcan)) ; this%ag_patch (:,:) = nan
allocate(this%an_patch (begp:endp,1:nlevcan)) ; this%an_patch (:,:) = nan
allocate(this%vcmax_z_patch (begp:endp,1:nlevcan)) ; this%vcmax_z_patch (:,:) = nan
allocate(this%tpu_z_patch (begp:endp,1:nlevcan)) ; this%tpu_z_patch (:,:) = nan
allocate(this%kp_z_patch (begp:endp,1:nlevcan)) ; this%kp_z_patch (:,:) = nan
allocate(this%gs_mol_patch (begp:endp,1:nlevcan)) ; this%gs_mol_patch (:,:) = nan
allocate(this%cp_patch (begp:endp)) ; this%cp_patch (:) = nan
allocate(this%kc_patch (begp:endp)) ; this%kc_patch (:) = nan
allocate(this%ko_patch (begp:endp)) ; this%ko_patch (:) = nan
allocate(this%qe_patch (begp:endp)) ; this%qe_patch (:) = nan
allocate(this%bbb_patch (begp:endp)) ; this%bbb_patch (:) = nan
allocate(this%mbb_patch (begp:endp)) ; this%mbb_patch (:) = nan
allocate(this%gb_mol_patch (begp:endp)) ; this%gb_mol_patch (:) = nan
allocate(this%rh_leaf_patch (begp:endp)) ; this%rh_leaf_patch (:) = nan
allocate(this%vpd_can_patch (begp:endp)) ; this%vpd_can_patch (:) = nan
allocate(this%psnsun_patch (begp:endp)) ; this%psnsun_patch (:) = nan
allocate(this%psnsha_patch (begp:endp)) ; this%psnsha_patch (:) = nan
allocate(this%c13_psnsun_patch (begp:endp)) ; this%c13_psnsun_patch (:) = nan
allocate(this%c13_psnsha_patch (begp:endp)) ; this%c13_psnsha_patch (:) = nan
allocate(this%c14_psnsun_patch (begp:endp)) ; this%c14_psnsun_patch (:) = nan
allocate(this%c14_psnsha_patch (begp:endp)) ; this%c14_psnsha_patch (:) = nan
allocate(this%psnsun_z_patch (begp:endp,1:nlevcan)) ; this%psnsun_z_patch (:,:) = nan
allocate(this%psnsha_z_patch (begp:endp,1:nlevcan)) ; this%psnsha_z_patch (:,:) = nan
allocate(this%psnsun_wc_patch (begp:endp)) ; this%psnsun_wc_patch (:) = nan
allocate(this%psnsha_wc_patch (begp:endp)) ; this%psnsha_wc_patch (:) = nan
allocate(this%psnsun_wj_patch (begp:endp)) ; this%psnsun_wj_patch (:) = nan
allocate(this%psnsha_wj_patch (begp:endp)) ; this%psnsha_wj_patch (:) = nan
allocate(this%psnsun_wp_patch (begp:endp)) ; this%psnsun_wp_patch (:) = nan
allocate(this%psnsha_wp_patch (begp:endp)) ; this%psnsha_wp_patch (:) = nan
allocate(this%fpsn_patch (begp:endp)) ; this%fpsn_patch (:) = nan
allocate(this%fpsn_wc_patch (begp:endp)) ; this%fpsn_wc_patch (:) = nan
allocate(this%fpsn_wj_patch (begp:endp)) ; this%fpsn_wj_patch (:) = nan
allocate(this%fpsn_wp_patch (begp:endp)) ; this%fpsn_wp_patch (:) = nan
allocate(this%lnca_patch (begp:endp)) ; this%lnca_patch (:) = nan
allocate(this%lmrsun_z_patch (begp:endp,1:nlevcan)) ; this%lmrsun_z_patch (:,:) = nan
allocate(this%lmrsha_z_patch (begp:endp,1:nlevcan)) ; this%lmrsha_z_patch (:,:) = nan
allocate(this%lmrsun_patch (begp:endp)) ; this%lmrsun_patch (:) = nan
allocate(this%lmrsha_patch (begp:endp)) ; this%lmrsha_patch (:) = nan
allocate(this%alphapsnsun_patch (begp:endp)) ; this%alphapsnsun_patch (:) = nan
allocate(this%alphapsnsha_patch (begp:endp)) ; this%alphapsnsha_patch (:) = nan
allocate(this%rc13_canair_patch (begp:endp)) ; this%rc13_canair_patch (:) = nan
allocate(this%rc13_psnsun_patch (begp:endp)) ; this%rc13_psnsun_patch (:) = nan
allocate(this%rc13_psnsha_patch (begp:endp)) ; this%rc13_psnsha_patch (:) = nan
allocate(this%cisun_z_patch (begp:endp,1:nlevcan)) ; this%cisun_z_patch (:,:) = nan
allocate(this%cisha_z_patch (begp:endp,1:nlevcan)) ; this%cisha_z_patch (:,:) = nan
allocate(this%rssun_z_patch (begp:endp,1:nlevcan)) ; this%rssun_z_patch (:,:) = nan
allocate(this%rssha_z_patch (begp:endp,1:nlevcan)) ; this%rssha_z_patch (:,:) = nan
allocate(this%rssun_patch (begp:endp)) ; this%rssun_patch (:) = nan
allocate(this%rssha_patch (begp:endp)) ; this%rssha_patch (:) = nan
allocate(this%luvcmax25top_patch(begp:endp)) ; this%luvcmax25top_patch(:) = nan
allocate(this%lujmax25top_patch (begp:endp)) ; this%lujmax25top_patch(:) = nan
allocate(this%lutpu25top_patch (begp:endp)) ; this%lutpu25top_patch(:) = nan
!!
! allocate(this%psncanopy_patch (begp:endp)) ; this%psncanopy_patch (:) = nan
! allocate(this%lmrcanopy_patch (begp:endp)) ; this%lmrcanopy_patch (:) = nan
if(use_luna)then
! NOTE(bja, 2015-09) because these variables are only allocated
! when luna is turned on, they can not be placed into associate
! statements.
allocate(this%vcmx25_z_patch (begp:endp,1:nlevcan)) ; this%vcmx25_z_patch (:,:) = 30._r8
allocate(this%jmx25_z_patch (begp:endp,1:nlevcan)) ; this%jmx25_z_patch (:,:) = 60._r8
allocate(this%vcmx25_z_last_valid_patch (begp:endp,1:nlevcan)) ; this%vcmx25_z_last_valid_patch (:,:) = 30._r8
allocate(this%jmx25_z_last_valid_patch (begp:endp,1:nlevcan)) ; this%jmx25_z_last_valid_patch (:,:) = 60._r8
allocate(this%pnlc_z_patch (begp:endp,1:nlevcan)) ; this%pnlc_z_patch (:,:) = 0.01_r8
allocate(this%fpsn24_patch (begp:endp)) ; this%fpsn24_patch (:) = nan
allocate(this%enzs_z_patch (begp:endp,1:nlevcan)) ; this%enzs_z_patch (:,:) = 1._r8
endif
end subroutine InitAllocate
!-----------------------------------------------------------------------
subroutine InitHistory(this, bounds)
!
! !USES:
use histFileMod , only: hist_addfld1d, hist_addfld2d
!
! !ARGUMENTS:
class(photosyns_type) :: this
type(bounds_type), intent(in) :: bounds
real(r8), pointer :: ptr_1d(:) ! pointer to 1d patch array
!
! !LOCAL VARIABLES:
integer :: begp, endp
!---------------------------------------------------------------------
begp = bounds%begp; endp= bounds%endp
this%rh_leaf_patch(begp:endp) = spval
call hist_addfld1d (fname='RH_LEAF', units='fraction', &
avgflag='A', long_name='fractional humidity at leaf surface', &
ptr_patch=this%rh_leaf_patch, set_spec=spval, default='inactive')
this%vpd_can_patch(begp:endp) = spval
call hist_addfld1d (fname='VPD_CAN', units='kPa', &
avgflag='A', long_name='canopy vapor pressure deficit', &
ptr_patch=this%vpd_can_patch, set_spec=spval, default='active')
this%lnca_patch(begp:endp) = spval
call hist_addfld1d (fname='LNC', units='gN leaf/m^2', &
avgflag='A', long_name='leaf N concentration', &
ptr_patch=this%lnca_patch, set_spec=spval)
! Don't output photosynthesis variables when FATES is on as they aren't calculated
if (.not. use_fates) then
this%fpsn_patch(begp:endp) = spval
call hist_addfld1d (fname='FPSN', units='umol m-2 s-1', &
avgflag='A', long_name='photosynthesis', &
ptr_patch=this%fpsn_patch, set_lake=0._r8, set_urb=0._r8)
! Don't by default output this rate limiting step as only makes sense if you are outputing
! the others each time-step
this%fpsn_wc_patch(begp:endp) = spval
call hist_addfld1d (fname='FPSN_WC', units='umol m-2 s-1', &
avgflag='I', long_name='Rubisco-limited photosynthesis', &
ptr_patch=this%fpsn_wc_patch, set_lake=0._r8, set_urb=0._r8, &
default='inactive')
! Don't by default output this rate limiting step as only makes sense if you are outputing
! the others each time-step
this%fpsn_wj_patch(begp:endp) = spval
call hist_addfld1d (fname='FPSN_WJ', units='umol m-2 s-1', &
avgflag='I', long_name='RuBP-limited photosynthesis', &
ptr_patch=this%fpsn_wj_patch, set_lake=0._r8, set_urb=0._r8, &
default='inactive')
! Don't by default output this rate limiting step as only makes sense if you are outputing
! the others each time-step
this%fpsn_wp_patch(begp:endp) = spval
call hist_addfld1d (fname='FPSN_WP', units='umol m-2 s-1', &
avgflag='I', long_name='Product-limited photosynthesis', &
ptr_patch=this%fpsn_wp_patch, set_lake=0._r8, set_urb=0._r8, &
default='inactive')
end if
if (use_cn) then
this%psnsun_patch(begp:endp) = spval
call hist_addfld1d (fname='PSNSUN', units='umolCO2/m^2/s', &
avgflag='A', long_name='sunlit leaf photosynthesis', &
ptr_patch=this%psnsun_patch)
this%psnsha_patch(begp:endp) = spval
call hist_addfld1d (fname='PSNSHA', units='umolCO2/m^2/s', &
avgflag='A', long_name='shaded leaf photosynthesis', &
ptr_patch=this%psnsha_patch)
end if
if ( use_c13 ) then
this%c13_psnsun_patch(begp:endp) = spval
call hist_addfld1d (fname='C13_PSNSUN', units='umolCO2/m^2/s', &
avgflag='A', long_name='C13 sunlit leaf photosynthesis', &
ptr_patch=this%c13_psnsun_patch, default='inactive')
this%c13_psnsha_patch(begp:endp) = spval
call hist_addfld1d (fname='C13_PSNSHA', units='umolCO2/m^2/s', &
avgflag='A', long_name='C13 shaded leaf photosynthesis', &
ptr_patch=this%c13_psnsha_patch, default='inactive')
end if
if ( use_c14 ) then
this%c14_psnsun_patch(begp:endp) = spval
call hist_addfld1d (fname='C14_PSNSUN', units='umolCO2/m^2/s', &
avgflag='A', long_name='C14 sunlit leaf photosynthesis', &
ptr_patch=this%c14_psnsun_patch, default='inactive')
this%c14_psnsha_patch(begp:endp) = spval
call hist_addfld1d (fname='C14_PSNSHA', units='umolCO2/m^2/s', &
avgflag='A', long_name='C14 shaded leaf photosynthesis', &
ptr_patch=this%c14_psnsha_patch, default='inactive')
end if
if ( use_c13 ) then
this%rc13_canair_patch(begp:endp) = spval
call hist_addfld1d (fname='RC13_CANAIR', units='proportion', &
avgflag='A', long_name='C13/C(12+13) for canopy air', &
ptr_patch=this%rc13_canair_patch, default='inactive')
this%rc13_psnsun_patch(begp:endp) = spval
call hist_addfld1d (fname='RC13_PSNSUN', units='proportion', &
avgflag='A', long_name='C13/C(12+13) for sunlit photosynthesis', &
ptr_patch=this%rc13_psnsun_patch, default='inactive')
this%rc13_psnsha_patch(begp:endp) = spval
call hist_addfld1d (fname='RC13_PSNSHA', units='proportion', &
avgflag='A', long_name='C13/C(12+13) for shaded photosynthesis', &
ptr_patch=this%rc13_psnsha_patch, default='inactive')
endif
! Canopy physiology
if ( use_c13 ) then
this%alphapsnsun_patch(begp:endp) = spval
call hist_addfld1d (fname='ALPHAPSNSUN', units='proportion', &
avgflag='A', long_name='sunlit c13 fractionation', &
ptr_patch=this%alphapsnsun_patch, default='inactive')
this%alphapsnsha_patch(begp:endp) = spval
call hist_addfld1d (fname='ALPHAPSNSHA', units='proportion', &
avgflag='A', long_name='shaded c13 fractionation', &
ptr_patch=this%alphapsnsha_patch, default='inactive')
endif
this%rssun_patch(begp:endp) = spval
call hist_addfld1d (fname='RSSUN', units='s/m', &
avgflag='M', long_name='sunlit leaf stomatal resistance', &
ptr_patch=this%rssun_patch, l2g_scale_type='veg')
this%rssha_patch(begp:endp) = spval
call hist_addfld1d (fname='RSSHA', units='s/m', &
avgflag='M', long_name='shaded leaf stomatal resistance', &
ptr_patch=this%rssha_patch, l2g_scale_type='veg')
this%gs_mol_sun_patch(begp:endp,:) = spval
this%gs_mol_sha_patch(begp:endp,:) = spval
if (nlevcan>1) then
call hist_addfld2d (fname='GSSUN', units='umol H20/m2/s', type2d='nlevcan', &
avgflag='A', long_name='sunlit leaf stomatal conductance', &
ptr_patch=this%gs_mol_sun_patch, set_lake=spval, set_urb=spval)
call hist_addfld2d (fname='GSSHA', units='umol H20/m2/s', type2d='nlevcan', &
avgflag='A', long_name='shaded leaf stomatal conductance', &
ptr_patch=this%gs_mol_sha_patch, set_lake=spval, set_urb=spval)
else
ptr_1d => this%gs_mol_sun_patch(begp:endp,1)
call hist_addfld1d (fname='GSSUN', units='umol H20/m2/s', &
avgflag='A', long_name='sunlit leaf stomatal conductance', &
ptr_patch=ptr_1d)
ptr_1d => this%gs_mol_sha_patch(begp:endp,1)
call hist_addfld1d (fname='GSSHA', units='umol H20/m2/s', &
avgflag='A', long_name='shaded leaf stomatal conductance', &
ptr_patch=ptr_1d)
endif
this%gs_mol_sun_ln_patch(begp:endp,:) = spval
this%gs_mol_sha_ln_patch(begp:endp,:) = spval
if (nlevcan>1) then
call hist_addfld2d (fname='GSSUNLN', units='umol H20/m2/s', type2d='nlevcan', &
avgflag='A', long_name='sunlit leaf stomatal conductance averaged over 1 hour before to 1 hour after local noon', &
ptr_patch=this%gs_mol_sun_ln_patch, set_lake=spval, set_urb=spval)
call hist_addfld2d (fname='GSSHALN', units='umol H20/m2/s', type2d='nlevcan', &
avgflag='A', long_name='shaded leaf stomatal conductance averaged over 1 hour before to 1 hour after local noon', &
ptr_patch=this%gs_mol_sha_ln_patch, set_lake=spval, set_urb=spval)
else
ptr_1d => this%gs_mol_sun_ln_patch(begp:endp,1)
call hist_addfld1d (fname='GSSUNLN', units='umol H20/m2/s', &
avgflag='A', long_name='sunlit leaf stomatal conductance at local noon', &
ptr_patch=ptr_1d)
ptr_1d => this%gs_mol_sha_ln_patch(begp:endp,1)
call hist_addfld1d (fname='GSSHALN', units='umol H20/m2/s', &
avgflag='A', long_name='shaded leaf stomatal conductance at local noon', &
ptr_patch=ptr_1d)
endif
if(use_luna)then
if(nlevcan>1)then
call hist_addfld2d (fname='Vcmx25Z', units='umol/m2/s', type2d='nlevcan', &
avgflag='A', long_name='canopy profile of vcmax25 predicted by LUNA model', &
ptr_patch=this%vcmx25_z_patch)
call hist_addfld2d (fname='Jmx25Z', units='umol electrons/m2/s', type2d='nlevcan', &
avgflag='A', long_name='maximum rate of electron transport at 25 Celcius for canopy layers', &
ptr_patch=this%jmx25_z_patch)
call hist_addfld2d (fname='PNLCZ', units='unitless', type2d='nlevcan', &
avgflag='A', long_name='Proportion of nitrogen allocated for light capture', &
ptr_patch=this%pnlc_z_patch,default='inactive')
else
ptr_1d => this%vcmx25_z_patch(:,1)
call hist_addfld1d (fname='Vcmx25Z', units='umol/m2/s',&
avgflag='A', long_name='canopy profile of vcmax25 predicted by LUNA model', &
ptr_patch=ptr_1d)
ptr_1d => this%jmx25_z_patch(:,1)
call hist_addfld1d (fname='Jmx25Z', units='umol electrons/m2/s',&
avgflag='A', long_name='maximum rate of electron transport at 25 Celcius for canopy layers', &
ptr_patch=ptr_1d)
ptr_1d => this%pnlc_z_patch(:,1)
call hist_addfld1d (fname='PNLCZ', units='unitless', &
avgflag='A', long_name='Proportion of nitrogen allocated for light capture', &
ptr_patch=ptr_1d,default='inactive')
this%luvcmax25top_patch(begp:endp) = spval
call hist_addfld1d (fname='VCMX25T', units='umol/m2/s', &
avgflag='M', long_name='canopy profile of vcmax25', &
ptr_patch=this%luvcmax25top_patch, set_lake=spval, set_urb=spval)
this%lujmax25top_patch(begp:endp) = spval
call hist_addfld1d (fname='JMX25T', units='umol/m2/s', &
avgflag='M', long_name='canopy profile of jmax', &
ptr_patch=this%lujmax25top_patch, set_lake=spval, set_urb=spval)
this%lutpu25top_patch(begp:endp) = spval
call hist_addfld1d (fname='TPU25T', units='umol/m2/s', &
avgflag='M', long_name='canopy profile of tpu', &
ptr_patch=this%lutpu25top_patch, set_lake=spval, set_urb=spval)
endif
this%fpsn24_patch = spval
call hist_addfld1d (fname='FPSN24', units='umol CO2/m^2 ground/day',&
avgflag='A', long_name='24 hour accumulative patch photosynthesis starting from mid-night', &
ptr_patch=this%fpsn24_patch, default='inactive')
endif
end subroutine InitHistory
!-----------------------------------------------------------------------
subroutine InitCold(this, bounds)
!
! !ARGUMENTS:
class(photosyns_type) :: this
type(bounds_type), intent(in) :: bounds
!
! !LOCAL VARIABLES:
integer :: p,l ! indices
!-----------------------------------------------------------------------
do p = bounds%begp,bounds%endp
l = patch%landunit(p)
this%alphapsnsun_patch(p) = spval
this%alphapsnsha_patch(p) = spval
if (lun%ifspecial(l)) then
this%psnsun_patch(p) = 0._r8
this%psnsha_patch(p) = 0._r8
if ( use_c13 ) then
this%c13_psnsun_patch(p) = 0._r8
this%c13_psnsha_patch(p) = 0._r8
endif
if ( use_c14 ) then
this%c14_psnsun_patch(p) = 0._r8
this%c14_psnsha_patch(p) = 0._r8
endif
end if
end do
end subroutine InitCold
!-----------------------------------------------------------------------
subroutine allocParams ( this )
!
implicit none
! !ARGUMENTS:
class(photo_params_type) :: this
!
! !LOCAL VARIABLES:
character(len=32) :: subname = 'allocParams'
!-----------------------------------------------------------------------
! allocate parameters
allocate( this%krmax (0:mxpft) ) ; this%krmax(:) = nan
allocate( this%theta_cj (0:mxpft) ) ; this%theta_cj(:) = nan
allocate( this%kmax (0:mxpft,nvegwcs) ) ; this%kmax(:,:) = nan
allocate( this%psi50 (0:mxpft,nvegwcs) ) ; this%psi50(:,:) = nan
allocate( this%ck (0:mxpft,nvegwcs) ) ; this%ck(:,:) = nan
if ( use_hydrstress .and. nvegwcs /= 4 )then
call endrun(msg='Error:: the Plant Hydraulics Stress methodology is for the spacA function is hardcoded for nvegwcs==4' &
//errMsg(__FILE__, __LINE__))
end if
end subroutine allocParams
!-----------------------------------------------------------------------
subroutine readParams ( this, ncid )
!
! !USES:
use ncdio_pio , only : file_desc_t,ncd_io
use paramUtilMod, only: readNcdioScalar
implicit none
! !ARGUMENTS:
class(photosyns_type) :: this
type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id
!
! !LOCAL VARIABLES:
character(len=32) :: subname = 'readParams'
character(len=100) :: errCode = '-Error reading in parameters file:'
logical :: readv ! has variable been read in or not
real(r8) :: temp1d(0:mxpft) ! temporary to read in parameter
real(r8) :: temp2d(0:mxpft,nvegwcs) ! temporary to read in parameter
character(len=100) :: tString ! temp. var for reading
!-----------------------------------------------------------------------
! read in parameters
call params_inst%allocParams()
tString = "krmax"
call ncd_io(varname=trim(tString),data=temp1d, flag='read', ncid=ncid, readvar=readv)
if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__))
params_inst%krmax=temp1d
tString = "lmr_intercept_atkin"
call ncd_io(varname=trim(tString),data=temp1d, flag='read', ncid=ncid, readvar=readv)
if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__))
params_inst%lmr_intercept_atkin=temp1d
tString = "theta_cj"
call ncd_io(varname=trim(tString),data=temp1d, flag='read', ncid=ncid, readvar=readv)
if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__))
params_inst%theta_cj=temp1d
tString = "kmax"
call ncd_io(varname=trim(tString),data=temp2d, flag='read', ncid=ncid, readvar=readv)
if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__))
params_inst%kmax=temp2d
tString = "psi50"
call ncd_io(varname=trim(tString),data=temp2d, flag='read', ncid=ncid, readvar=readv)
if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__))
params_inst%psi50=temp2d
tString = "ck"
call ncd_io(varname=trim(tString),data=temp2d, flag='read', ncid=ncid, readvar=readv)
if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__))
params_inst%ck=temp2d
! read in the scalar parameters
! Michaelis-Menten constant at 25°C for O2 (unitless)
call readNcdioScalar(ncid, 'ko25_coef', subname, params_inst%ko25_coef)
! Michaelis-Menten constant at 25°C for CO2 (unitless)
call readNcdioScalar(ncid, 'kc25_coef', subname, params_inst%kc25_coef)
! CO2 compensation point at 25°C at present day O2 levels
call readNcdioScalar(ncid, 'cp25_yr2000', subname, params_inst%cp25_yr2000)
! Rubisco activity at 25 C (umol CO2/gRubisco/s)
call readNcdioScalar(ncid, 'act25', subname, params_inst%act25)
! Mass ratio of total Rubisco molecular mass to nitrogen in Rubisco (gRubisco/gN(Rubisco))
call readNcdioScalar(ncid, 'fnr', subname, params_inst%fnr)
! Fraction of light absorbed by non-photosynthetic pigment (unitless)
call readNcdioScalar(ncid, 'fnps', subname, params_inst%fnps)
! Empirical curvature parameter for electron transport rate (unitless)
call readNcdioScalar(ncid, 'theta_psii', subname, params_inst%theta_psii)
! Empirical curvature parameter for ap photosynthesis co-limitation (unitless)
call readNcdioScalar(ncid, 'theta_ip', subname, params_inst%theta_ip)
! Activation energy for vcmax (J/mol)
call readNcdioScalar(ncid, 'vcmaxha', subname, params_inst%vcmaxha)
! Activation energy for jmax (J/mol)
call readNcdioScalar(ncid, 'jmaxha', subname, params_inst%jmaxha)
! Activation energy for tpu (J/mol)
call readNcdioScalar(ncid, 'tpuha', subname, params_inst%tpuha)
! Activation energy for lmr (J/mol)
call readNcdioScalar(ncid, 'lmrha', subname, params_inst%lmrha)
! Activation energy for kc (J/mol)
call readNcdioScalar(ncid, 'kcha', subname, params_inst%kcha)
! Activation energy for ko (J/mol)
call readNcdioScalar(ncid, 'koha', subname, params_inst%koha)
! Activation energy for cp (J/mol)
call readNcdioScalar(ncid, 'cpha', subname, params_inst%cpha)
! Deactivation energy for vcmax (J/mol)
call readNcdioScalar(ncid, 'vcmaxhd', subname, params_inst%vcmaxhd)
! Deactivation energy for jmax (J/mol)
call readNcdioScalar(ncid, 'jmaxhd', subname, params_inst%jmaxhd)
! Deactivation energy for tpu (J/mol)
call readNcdioScalar(ncid, 'tpuhd', subname, params_inst%tpuhd)
! Deactivation energy for lmr (J/mol)
call readNcdioScalar(ncid, 'lmrhd', subname, params_inst%lmrhd)
! Entropy term for lmr (J/mol/K)
call readNcdioScalar(ncid, 'lmrse', subname, params_inst%lmrse)
! Ratio of tpu25top to vcmax25top (unitless)
call readNcdioScalar(ncid, 'tpu25ratio', subname, params_inst%tpu25ratio)
! Ratio of kp25top to vcmax25top (unitless)
call readNcdioScalar(ncid, 'kp25ratio', subname, params_inst%kp25ratio)
end subroutine readParams
!------------------------------------------------------------------------
subroutine ReadNML(this, NLFilename)
!
! !DESCRIPTION:
! Read the namelist for Photosynthesis
!
! !USES:
use fileutils , only : getavu, relavu, opnfil
use shr_nl_mod , only : shr_nl_find_group_name
use spmdMod , only : masterproc, mpicom
use shr_mpi_mod , only : shr_mpi_bcast
use clm_varctl , only : iulog
!
! !ARGUMENTS:
class(photosyns_type) :: this
character(len=*), intent(IN) :: NLFilename ! Namelist filename
!
! !LOCAL VARIABLES:
integer :: ierr ! error code
integer :: unitn ! unit for namelist file
character(len=*), parameter :: subname = 'Photosyn::ReadNML'
character(len=*), parameter :: nmlname = 'photosyns_inparm'
logical :: rootstem_acc = .false. ! Respiratory acclimation for roots and stems
logical :: light_inhibit = .false. ! If light should inhibit respiration
integer :: leafresp_method = leafresp_mtd_ryan1991 ! leaf maintencence respiration at 25C for canopy top method to use
logical :: modifyphoto_and_lmr_forcrop = .false. ! Modify photosynthesis and LMR for crop
character(len=50) :: stomatalcond_method = 'Ball-Berry1987' ! Photosynthesis method string
!-----------------------------------------------------------------------
namelist /photosyns_inparm/ leafresp_method, light_inhibit, &
rootstem_acc, stomatalcond_method, modifyphoto_and_lmr_forcrop
! Initialize options to default values, in case they are not specified in
! the namelist
if (masterproc) then
unitn = getavu()
write(iulog,*) 'Read in '//nmlname//' namelist'
call opnfil (NLFilename, unitn, 'F')
call shr_nl_find_group_name(unitn, nmlname, status=ierr)
if (ierr == 0) then
read(unitn, nml=photosyns_inparm, iostat=ierr)
if (ierr /= 0) then
call endrun(msg="ERROR reading "//nmlname//"namelist"//errmsg(sourcefile, __LINE__))
end if
else
call endrun(msg="ERROR could NOT find "//nmlname//"namelist"//errmsg(sourcefile, __LINE__))
end if
call relavu( unitn )
this%rootstem_acc = rootstem_acc
this%leafresp_method = leafresp_method
this%light_inhibit = light_inhibit
this%modifyphoto_and_lmr_forcrop = modifyphoto_and_lmr_forcrop
if ( trim(stomatalcond_method) == 'Ball-Berry1987' ) then
this%stomatalcond_mtd = stomatalcond_mtd_bb1987
else if ( trim(stomatalcond_method) == 'Medlyn2011' ) then
this%stomatalcond_mtd = stomatalcond_mtd_medlyn2011
else
call endrun(msg="ERROR bad value for stomtalcond_method in "//nmlname//"namelist"//errmsg(sourcefile, __LINE__))
end if
end if
call shr_mpi_bcast (this%rootstem_acc , mpicom)
call shr_mpi_bcast (this%leafresp_method, mpicom)
call shr_mpi_bcast (this%light_inhibit , mpicom)
call shr_mpi_bcast (this%stomatalcond_mtd, mpicom)
call shr_mpi_bcast (this%modifyphoto_and_lmr_forcrop, mpicom)
if (masterproc) then
write(iulog,*) ' '
write(iulog,*) nmlname//' settings:'
write(iulog,nml=photosyns_inparm)
write(iulog,*) ' '
end if
end subroutine ReadNML
!------------------------------------------------------------------------
subroutine Restart(this, bounds, ncid, flag)
!
! !USES:
use ncdio_pio , only : file_desc_t, ncd_defvar, ncd_io, ncd_double, ncd_int, ncd_inqvdlen
use restUtilMod
!
! !ARGUMENTS:
class(photosyns_type) :: this
type(bounds_type), intent(in) :: bounds
type(file_desc_t), intent(inout) :: ncid ! netcdf id
character(len=*) , intent(in) :: flag ! 'read' or 'write'
!
! !LOCAL VARIABLES:
integer :: j,c ! indices
logical :: readvar ! determine if variable is on initial file
!-----------------------------------------------------------------------
if ( use_c13 ) then
call restartvar(ncid=ncid, flag=flag, varname='rc13_canair', xtype=ncd_double, &
dim1name='pft', long_name='', units='', &
interpinic_flag='interp', readvar=readvar, data=this%rc13_canair_patch)
call restartvar(ncid=ncid, flag=flag, varname='rc13_psnsun', xtype=ncd_double, &
dim1name='pft', long_name='', units='', &
interpinic_flag='interp', readvar=readvar, data=this%rc13_psnsun_patch)
call restartvar(ncid=ncid, flag=flag, varname='rc13_psnsha', xtype=ncd_double, &
dim1name='pft', long_name='', units='', &
interpinic_flag='interp', readvar=readvar, data=this%rc13_psnsha_patch)
endif
call restartvar(ncid=ncid, flag=flag, varname='GSSUN', xtype=ncd_double, &
dim1name='pft', dim2name='levcan', switchdim=.true., &
long_name='sunlit leaf stomatal conductance', units='umol H20/m2/s', &
scale_by_thickness=.false., &
interpinic_flag='interp', readvar=readvar, data=this%gs_mol_sun_patch)
call restartvar(ncid=ncid, flag=flag, varname='GSSHA', xtype=ncd_double, &
dim1name='pft', dim2name='levcan', switchdim=.true., &
long_name='shaded leaf stomatal conductance', units='umol H20/m2/s', &
scale_by_thickness=.false., &
interpinic_flag='interp', readvar=readvar, data=this%gs_mol_sha_patch)
call restartvar(ncid=ncid, flag=flag, varname='GSSUNLN', xtype=ncd_double, &
dim1name='pft', dim2name='levcan', switchdim=.true., &
long_name='sunlit leaf stomatal conductance averaged over 1 hour before to 1 hour after local noon', &
units='umol H20/m2/s', &
scale_by_thickness=.false., &
interpinic_flag='interp', readvar=readvar, data=this%gs_mol_sun_ln_patch)
call restartvar(ncid=ncid, flag=flag, varname='GSSHALN', xtype=ncd_double, &
dim1name='pft', dim2name='levcan', switchdim=.true., &
long_name='shaded leaf stomatal conductance averaged over 1 hour before to 1 hour after local noon', &
units='umol H20/m2/s', &
scale_by_thickness=.false., &
interpinic_flag='interp', readvar=readvar, data=this%gs_mol_sha_ln_patch)
call restartvar(ncid=ncid, flag=flag, varname='lnca', xtype=ncd_double, &
dim1name='pft', long_name='leaf N concentration', units='gN leaf/m^2', &
interpinic_flag='interp', readvar=readvar, data=this%lnca_patch)
if(use_luna) then
call restartvar(ncid=ncid, flag=flag, varname='vcmx25_z', xtype=ncd_double, &
dim1name='pft', dim2name='levcan', switchdim=.true., &
long_name='Maximum carboxylation rate at 25 Celcius for canopy layers', units='umol CO2/m**2/s', &
scale_by_thickness=.false., &
interpinic_flag='interp', readvar=readvar, data=this%vcmx25_z_patch)
call restartvar(ncid=ncid, flag=flag, varname='jmx25_z', xtype=ncd_double, &
dim1name='pft', dim2name='levcan', switchdim=.true., &
long_name='Maximum rate of electron transport at 25 Celcius for canopy layers', units='umol electrons/m**2/s', &
scale_by_thickness=.false., &
interpinic_flag='interp', readvar=readvar, data=this%jmx25_z_patch)
call restartvar(ncid=ncid, flag=flag, varname='vcmx25_z_last_valid_patch:vcmx_prevyr', xtype=ncd_double, &
dim1name='pft', dim2name='levcan', switchdim=.true., &
long_name='avg carboxylation rate at 25 celsius for canopy layers', units='umol CO2/m**2/s', &
scale_by_thickness=.false., &
interpinic_flag='interp', readvar=readvar, data=this%vcmx25_z_last_valid_patch)
call restartvar(ncid=ncid, flag=flag, varname='jmx25_z_last_valid_patch:jmx_prevyr', xtype=ncd_double, &
dim1name='pft', dim2name='levcan', switchdim=.true., &
long_name='avg rate of electron transport at 25 Celcius for canopy layers', units='umol electrons/m**2/s', &
scale_by_thickness=.false., &
interpinic_flag='interp', readvar=readvar, data=this%jmx25_z_last_valid_patch)
call restartvar(ncid=ncid, flag=flag, varname='pnlc_z', xtype=ncd_double, &
dim1name='pft', dim2name='levcan', switchdim=.true., &
long_name='proportion of leaf nitrogen allocated for light capture', units='unitless', &
scale_by_thickness=.false., &
interpinic_flag='interp', readvar=readvar, data=this%pnlc_z_patch )
call restartvar(ncid=ncid, flag=flag, varname='enzs_z', xtype=ncd_double, &
dim1name='pft', dim2name='levcan', switchdim=.true., &
long_name='enzyme decay status during stress: 1.0-fully active; 0.0-all decayed', units='unitless', &
scale_by_thickness=.false., &
interpinic_flag='interp', readvar=readvar, data=this%enzs_z_patch )
call restartvar(ncid=ncid, flag=flag, varname='gpp24', xtype=ncd_double, &
dim1name='pft', long_name='accumulative gross primary production', units='umol CO2/m**2 ground/day', &
interpinic_flag='interp', readvar=readvar, data=this%fpsn24_patch)
endif
call restartvar(ncid=ncid, flag=flag, varname='vcmx25t', xtype=ncd_double, &
dim1name='pft', long_name='canopy profile of vcmax25', &
units='umol/m2/s', &
interpinic_flag='interp', readvar=readvar, data=this%luvcmax25top_patch)
call restartvar(ncid=ncid, flag=flag, varname='jmx25t', xtype=ncd_double, &
dim1name='pft', long_name='canopy profile of jmax', &
units='umol/m2/s', &
interpinic_flag='interp', readvar=readvar, data=this%lujmax25top_patch)
call restartvar(ncid=ncid, flag=flag, varname='tpu25t', xtype=ncd_double, &
dim1name='pft', long_name='canopy profile of tpu', &
units='umol/m2/s', &
interpinic_flag='interp', readvar=readvar, data=this%lutpu25top_patch)
call restartvar(ncid=ncid, flag=flag, varname='VPD_CAN', xtype=ncd_double, &
dim1name='pft', long_name='canopy vapor pressure deficit', &
units='kPa', &
interpinic_flag='interp', readvar=readvar, data=this%vpd_can_patch)
end subroutine Restart
!------------------------------------------------------------------------------
subroutine TimeStepInit (this, bounds)
!
! Time step initialization
!
! !USES:
use landunit_varcon, only : istsoil, istcrop, istice, istwet
!
! !ARGUMENTS:
class(photosyns_type) :: this
type(bounds_type) , intent(in) :: bounds
!
! !LOCAL VARIABLES:
integer :: p,l ! indices
!-----------------------------------------------------------------------
do p = bounds%begp, bounds%endp
l = patch%landunit(p)
if (.not. lun%lakpoi(l)) then
this%psnsun_patch(p) = 0._r8
this%psnsun_wc_patch(p) = 0._r8
this%psnsun_wj_patch(p) = 0._r8
this%psnsun_wp_patch(p) = 0._r8
this%psnsha_patch(p) = 0._r8
this%psnsha_wc_patch(p) = 0._r8
this%psnsha_wj_patch(p) = 0._r8
this%psnsha_wp_patch(p) = 0._r8
this%fpsn_patch(p) = 0._r8
this%fpsn_wc_patch(p) = 0._r8
this%fpsn_wj_patch(p) = 0._r8
this%fpsn_wp_patch(p) = 0._r8
if ( use_c13 ) then
this%alphapsnsun_patch(p) = 0._r8
this%alphapsnsha_patch(p) = 0._r8
this%c13_psnsun_patch(p) = 0._r8
this%c13_psnsha_patch(p) = 0._r8
endif
if ( use_c14 ) then
this%c14_psnsun_patch(p) = 0._r8
this%c14_psnsha_patch(p) = 0._r8
endif