-
Notifications
You must be signed in to change notification settings - Fork 93
/
Copy pathPRTParamsFATESMod.F90
1994 lines (1603 loc) · 90.1 KB
/
PRTParamsFATESMod.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 PRTInitParamsFatesMod
! This is a FATES specific module for loading parameters through
! the CLM/ELM module system.
use FatesConstantsMod, only : r8 => fates_r8
use FatesConstantsMod, only : itrue,ifalse
use FatesConstantsMod, only : nearzero
use FatesConstantsMod, only : years_per_day
use FatesInterfaceTypesMod, only : hlm_parteh_mode
use PRTParametersMod, only : prt_params
use PRTGenericMod, only : num_organ_types
use PRTGenericMod, only : leaf_organ, fnrt_organ, store_organ
use PRTGenericMod, only : sapw_organ, struct_organ, repro_organ
use PRTGenericMod, only : nitrogen_element, phosphorus_element
use FatesGlobals, only : endrun => fates_endrun
use FatesGlobals, only : fates_log
use shr_log_mod, only : errMsg => shr_log_errMsg
use EDPftvarcon, only : EDPftvarcon_inst
use PRTGenericMod, only : prt_cnp_flex_allom_hyp,prt_carbon_allom_hyp
use FatesAllometryMod , only : h_allom
use FatesAllometryMod , only : h2d_allom
use FatesAllometryMod , only : bagw_allom
use FatesAllometryMod , only : bsap_allom
use FatesAllometryMod , only : bleaf
use FatesAllometryMod , only : bfineroot
use FatesAllometryMod , only : bdead_allom
use FatesAllometryMod , only : bstore_allom
use FatesAllometryMod , only : bbgw_allom
use FatesAllometryMod , only : carea_allom
use FatesAllometryMod , only : CheckIntegratedAllometries
use FatesAllometryMod, only : set_root_fraction
use PRTGenericMod, only : StorageNutrientTarget
use EDTypesMod, only : init_recruit_trim
use FatesConstantsMod, only : ihard_stress_decid, isemi_stress_decid
!
! !PUBLIC TYPES:
implicit none
save
private
integer, parameter, public :: lower_bound_pft = 1
integer, parameter, public :: lower_bound_general = 1
character(len=*), parameter, private :: sourcefile = &
__FILE__
! !PUBLIC MEMBER FUNCTIONS:
public :: PRTRegisterParams
public :: PRTReceiveParams
public :: PRTCheckParams
public :: PRTDerivedParams
public :: NewRecruitTotalStoichiometry
!-----------------------------------------------------------------------
contains
!-----------------------------------------------------------------------
subroutine PRTRegisterParams(fates_params)
use FatesParametersInterface, only : fates_parameters_type
implicit none
class(fates_parameters_type), intent(inout) :: fates_params
call PRTRegisterPFT(fates_params)
call PRTRegisterPFTOrgans(fates_params)
call PRTRegisterPFTLeafAge(fates_params)
call Register_PFT_nvariants(fates_params)
call PRTRegisterOrgan(fates_params)
end subroutine PRTRegisterParams
!-----------------------------------------------------------------------
subroutine PRTReceiveParams(fates_params)
use FatesParametersInterface, only : fates_parameters_type
implicit none
class(fates_parameters_type), intent(inout) :: fates_params
call PRTReceivePFT(fates_params)
call PRTReceivePFTOrgans(fates_params)
call PRTReceivePFTLeafAge(fates_params)
call Receive_PFT_nvariants(fates_params)
call PRTReceiveOrgan(fates_params)
end subroutine PRTReceiveParams
! =====================================================================================
subroutine PRTRegisterOrgan(fates_params)
use FatesParametersInterface, only : fates_parameters_type, param_string_length
use FatesParametersInterface, only : dimension_name_prt_organs, dimension_shape_1d
implicit none
class(fates_parameters_type), intent(inout) :: fates_params
character(len=param_string_length), parameter :: dim_names(1) = (/dimension_name_prt_organs/)
integer, parameter :: dim_lower_bound(1) = (/ lower_bound_general /)
character(len=param_string_length) :: name
name = 'fates_alloc_organ_id'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
end subroutine PRTRegisterOrgan
! =====================================================================================
subroutine PRTReceiveOrgan(fates_params)
! Make sure to call this after PRTRegisterPFTOrgans
use FatesParametersInterface, only : fates_parameters_type, param_string_length
implicit none
class(fates_parameters_type), intent(inout) :: fates_params
character(len=param_string_length) :: name
real(r8), allocatable :: tmpreal(:) ! Temporary variable to hold floats
name = 'fates_alloc_organ_id'
call fates_params%RetrieveParameterAllocate(name=name, &
data=tmpreal)
allocate(prt_params%organ_id(size(tmpreal,dim=1)))
call ArrayNint(tmpreal,prt_params%organ_id)
deallocate(tmpreal)
end subroutine PRTReceiveOrgan
! =====================================================================================
subroutine PRTRegisterPFT(fates_params)
use FatesParametersInterface, only : fates_parameters_type, param_string_length
use FatesParametersInterface, only : dimension_name_pft, dimension_shape_1d
implicit none
class(fates_parameters_type), intent(inout) :: fates_params
character(len=param_string_length), parameter :: dim_names(1) = (/dimension_name_pft/)
integer, parameter :: dim_lower_bound(1) = (/ lower_bound_pft /)
character(len=param_string_length) :: name
name = 'fates_phen_stress_decid'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_phen_season_decid'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_phen_evergreen'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_phen_stem_drop_fraction'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_phen_fnrt_drop_fraction'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_phen_mindaysoff'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_phen_drought_threshold'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_phen_moist_threshold'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_allom_fnrt_prof_a'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_allom_fnrt_prof_b'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_allom_fnrt_prof_mode'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_woody'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_wood_density'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_leaf_slamax'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_leaf_slatop'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_allom_sai_scaler'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_recruit_seed_dbh_repro_threshold'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_alloc_storage_cushion'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_alloc_store_priority_frac'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_turnover_senleaf_fdrought'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_turnover_fnrt'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_leafn_vert_scaler_coeff1'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_leafn_vert_scaler_coeff2'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_recruit_seed_alloc_mature'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_recruit_seed_alloc'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_trs_repro_alloc_a'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_trs_repro_alloc_b'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_c2b'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_allom_l2fr'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_cnp_pid_kd'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_cnp_pid_ki'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_cnp_pid_kp'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_cnp_store_ovrflw_frac'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_cnp_nfix1'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_grperc'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_allom_dbh_maxheight'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_allom_hmode'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_allom_lmode'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_allom_fmode'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_allom_amode'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_allom_stmode'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_allom_cmode'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_allom_smode'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_allom_dmode'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_allom_la_per_sa_int'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_allom_la_per_sa_slp'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_allom_agb_frac'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_allom_d2h1'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_allom_d2h2'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_allom_d2h3'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_allom_d2bl1'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_allom_d2bl2'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_allom_d2bl3'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_allom_blca_expnt_diff'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_allom_d2ca_coefficient_max'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_allom_d2ca_coefficient_min'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_allom_agb1'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_allom_agb2'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_allom_agb3'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_allom_agb4'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_allom_h2cd1'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_allom_h2cd2'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_allom_zroot_max_dbh'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_allom_zroot_max_z'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_allom_zroot_min_dbh'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_allom_zroot_min_z'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_allom_zroot_k'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_turnover_branch'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_cnp_nitr_store_ratio'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_cnp_phos_store_ratio'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
end subroutine PRTRegisterPFT
!-----------------------------------------------------------------------
subroutine PRTReceivePFT(fates_params)
use FatesParametersInterface, only : fates_parameters_type, param_string_length
implicit none
class(fates_parameters_type), intent(inout) :: fates_params
character(len=param_string_length) :: name
real(r8), allocatable :: tmpreal(:) ! Temporary variable to hold floats
! that are converted to ints
name = 'fates_phen_stress_decid'
call fates_params%RetrieveParameterAllocate(name=name, &
data=tmpreal)
allocate(prt_params%stress_decid(size(tmpreal,dim=1)))
call ArrayNint(tmpreal,prt_params%stress_decid)
deallocate(tmpreal)
name = 'fates_phen_season_decid'
call fates_params%RetrieveParameterAllocate(name=name, &
data=tmpreal)
allocate(prt_params%season_decid(size(tmpreal,dim=1)))
call ArrayNint(tmpreal,prt_params%season_decid)
deallocate(tmpreal)
name = 'fates_phen_evergreen'
call fates_params%RetrieveParameterAllocate(name=name, &
data=tmpreal)
allocate(prt_params%evergreen(size(tmpreal,dim=1)))
call ArrayNint(tmpreal,prt_params%evergreen)
deallocate(tmpreal)
name = 'fates_phen_stem_drop_fraction'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%phen_stem_drop_fraction)
name = 'fates_phen_fnrt_drop_fraction'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%phen_fnrt_drop_fraction)
name = 'fates_phen_mindaysoff'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%phen_doff_time)
name = 'fates_phen_drought_threshold'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%phen_drought_threshold)
name = 'fates_phen_moist_threshold'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%phen_moist_threshold)
name = 'fates_leaf_slamax'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%slamax)
name = 'fates_leaf_slatop'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%slatop)
name = 'fates_allom_sai_scaler'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%allom_sai_scaler)
name = 'fates_allom_fnrt_prof_a'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%fnrt_prof_a)
name = 'fates_allom_fnrt_prof_b'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%fnrt_prof_b)
name = 'fates_allom_fnrt_prof_mode'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%fnrt_prof_mode)
name = 'fates_woody'
call fates_params%RetrieveParameterAllocate(name=name, &
data=tmpreal)
allocate(prt_params%woody(size(tmpreal,dim=1)))
call ArrayNint(tmpreal,prt_params%woody)
deallocate(tmpreal)
name = 'fates_wood_density'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%wood_density)
name = 'fates_recruit_seed_dbh_repro_threshold'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%dbh_repro_threshold)
name = 'fates_alloc_storage_cushion'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%cushion)
name = 'fates_alloc_store_priority_frac'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%leaf_stor_priority)
name = 'fates_turnover_senleaf_fdrought'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%senleaf_long_fdrought)
name = 'fates_turnover_fnrt'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%root_long)
name = 'fates_leafn_vert_scaler_coeff1'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%leafn_vert_scaler_coeff1)
name = 'fates_leafn_vert_scaler_coeff2'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%leafn_vert_scaler_coeff2)
name = 'fates_recruit_seed_alloc_mature'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%seed_alloc_mature)
name = 'fates_recruit_seed_alloc'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%seed_alloc)
name = 'fates_trs_repro_alloc_a'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%repro_alloc_a)
name = 'fates_trs_repro_alloc_b'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%repro_alloc_b)
name = 'fates_c2b'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%c2b)
name = 'fates_grperc'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%grperc)
name = 'fates_allom_dbh_maxheight'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%allom_dbh_maxheight)
name = 'fates_allom_hmode'
call fates_params%RetrieveParameterAllocate(name=name, &
data=tmpreal)
allocate(prt_params%allom_hmode(size(tmpreal,dim=1)))
call ArrayNint(tmpreal,prt_params%allom_hmode)
deallocate(tmpreal)
name = 'fates_allom_lmode'
call fates_params%RetrieveParameterAllocate(name=name, &
data=tmpreal)
allocate(prt_params%allom_lmode(size(tmpreal,dim=1)))
call ArrayNint(tmpreal,prt_params%allom_lmode)
deallocate(tmpreal)
name = 'fates_allom_fmode'
call fates_params%RetrieveParameterAllocate(name=name, &
data=tmpreal)
allocate(prt_params%allom_fmode(size(tmpreal,dim=1)))
call ArrayNint(tmpreal,prt_params%allom_fmode)
deallocate(tmpreal)
name = 'fates_allom_amode'
call fates_params%RetrieveParameterAllocate(name=name, &
data=tmpreal)
allocate(prt_params%allom_amode(size(tmpreal,dim=1)))
call ArrayNint(tmpreal,prt_params%allom_amode)
deallocate(tmpreal)
name = 'fates_allom_stmode'
call fates_params%RetrieveParameterAllocate(name=name, &
data=tmpreal)
allocate(prt_params%allom_stmode(size(tmpreal,dim=1)))
call ArrayNint(tmpreal,prt_params%allom_stmode)
deallocate(tmpreal)
name = 'fates_allom_cmode'
call fates_params%RetrieveParameterAllocate(name=name, &
data=tmpreal)
allocate(prt_params%allom_cmode(size(tmpreal,dim=1)))
call ArrayNint(tmpreal,prt_params%allom_cmode)
deallocate(tmpreal)
name = 'fates_allom_smode'
call fates_params%RetrieveParameterAllocate(name=name, &
data=tmpreal)
allocate(prt_params%allom_smode(size(tmpreal,dim=1)))
call ArrayNint(tmpreal,prt_params%allom_smode)
deallocate(tmpreal)
name = 'fates_allom_dmode'
call fates_params%RetrieveParameterAllocate(name=name, &
data=tmpreal)
allocate(prt_params%allom_dmode(size(tmpreal,dim=1)))
call ArrayNint(tmpreal,prt_params%allom_dmode)
deallocate(tmpreal)
name = 'fates_allom_la_per_sa_int'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%allom_la_per_sa_int)
name = 'fates_allom_la_per_sa_slp'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%allom_la_per_sa_slp)
name = 'fates_allom_l2fr'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%allom_l2fr)
name = 'fates_cnp_pid_kp'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%pid_kp)
name = 'fates_cnp_pid_ki'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%pid_ki)
name = 'fates_cnp_pid_kd'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%pid_kd)
name = 'fates_cnp_store_ovrflw_frac'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%store_ovrflw_frac)
name = 'fates_cnp_nfix1'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%nfix_mresp_scfrac)
name = 'fates_allom_agb_frac'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%allom_agb_frac)
name = 'fates_allom_d2h1'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%allom_d2h1)
name = 'fates_allom_d2h2'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%allom_d2h2)
name = 'fates_allom_d2h3'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%allom_d2h3)
name = 'fates_allom_d2bl1'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%allom_d2bl1)
name = 'fates_allom_d2bl2'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%allom_d2bl2)
name = 'fates_allom_d2bl3'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%allom_d2bl3)
name = 'fates_allom_blca_expnt_diff'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%allom_blca_expnt_diff)
name = 'fates_allom_d2ca_coefficient_max'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%allom_d2ca_coefficient_max)
name = 'fates_allom_d2ca_coefficient_min'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%allom_d2ca_coefficient_min)
name = 'fates_allom_agb1'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%allom_agb1)
name = 'fates_allom_agb2'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%allom_agb2)
name = 'fates_allom_agb3'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%allom_agb3)
name = 'fates_allom_agb4'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%allom_agb4)
name = 'fates_allom_h2cd1'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%allom_h2cd1)
name = 'fates_allom_h2cd2'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%allom_h2cd2)
name = 'fates_allom_zroot_max_dbh'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%allom_zroot_max_dbh)
name = 'fates_allom_zroot_max_z'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%allom_zroot_max_z)
name = 'fates_allom_zroot_min_dbh'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%allom_zroot_min_dbh)
name = 'fates_allom_zroot_min_z'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%allom_zroot_min_z)
name = 'fates_allom_zroot_k'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%allom_zroot_k)
name = 'fates_turnover_branch'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%branch_long)
name = 'fates_cnp_nitr_store_ratio'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%nitr_store_ratio)
name = 'fates_cnp_phos_store_ratio'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%phos_store_ratio)
end subroutine PRTReceivePFT
!-----------------------------------------------------------------------
subroutine PRTRegisterPFTLeafAge(fates_params)
use FatesParametersInterface, only : fates_parameters_type, param_string_length
use FatesParametersInterface, only : max_dimensions, dimension_name_leaf_age
use FatesParametersInterface, only : dimension_name_pft, dimension_shape_2d
implicit none
class(fates_parameters_type), intent(inout) :: fates_params
integer, parameter :: dim_lower_bound(2) = (/ lower_bound_pft, lower_bound_general /)
character(len=param_string_length) :: dim_names(2)
character(len=param_string_length) :: name
dim_names(1) = dimension_name_pft
dim_names(2) = dimension_name_leaf_age
name = 'fates_turnover_leaf_canopy'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_2d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_turnover_leaf_ustory'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_2d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
return
end subroutine PRTRegisterPFTLeafAge
! =====================================================================================
subroutine ArrayNint(realarr,intarr)
real(r8),intent(in) :: realarr(:)
integer,intent(out) :: intarr(:)
integer :: i
do i = 1,size(realarr,dim=1)
intarr(i) = nint(realarr(i))
end do
return
end subroutine ArrayNint
! =====================================================================================
subroutine Register_PFT_nvariants(fates_params)
use FatesParametersInterface, only : fates_parameters_type, param_string_length
use FatesParametersInterface, only : max_dimensions, dimension_name_variants, dimension_name_pft, dimension_shape_2d
implicit none
class(fates_parameters_type), intent(inout) :: fates_params
integer, parameter :: dim_lower_bound(2) = (/ lower_bound_pft, lower_bound_general /)
character(len=param_string_length) :: dim_names(2)
character(len=param_string_length) :: name
! NOTE(bja, 2017-01) initialization doesn't seem to work correctly
! if dim_names has a parameter qualifier.
dim_names(1) = dimension_name_pft
dim_names(2) = dimension_name_variants
!X! name = ''
!X! call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_2d, &
!X! dimension_names=dim_names)
end subroutine Register_PFT_nvariants
! =====================================================================================
subroutine Receive_PFT_nvariants(fates_params)
use FatesParametersInterface, only : fates_parameters_type
use FatesParametersInterface, only : param_string_length
implicit none
class(fates_parameters_type), intent(inout) :: fates_params
character(len=param_string_length) :: name
!X! name = ''
!X! call fates_params%RetrieveParameter(name=name, &
!X! data=this%)
end subroutine Receive_PFT_nvariants
! =====================================================================================
subroutine PRTReceivePFTLeafAge(fates_params)
use FatesParametersInterface, only : fates_parameters_type
use FatesParametersInterface, only : param_string_length
implicit none
class(fates_parameters_type), intent(inout) :: fates_params
character(len=param_string_length) :: name
name = 'fates_turnover_leaf_canopy'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%leaf_long)
name = 'fates_turnover_leaf_ustory'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%leaf_long_ustory)
return
end subroutine PRTReceivePFTLeafAge
! =====================================================================================
subroutine PRTRegisterPFTOrgans(fates_params)
use FatesParametersInterface, only : fates_parameters_type, param_string_length
use FatesParametersInterface, only : max_dimensions, dimension_name_prt_organs
use FatesParametersInterface, only : dimension_name_pft, dimension_shape_2d
implicit none
class(fates_parameters_type), intent(inout) :: fates_params
integer, parameter :: dim_lower_bound(2) = (/ lower_bound_pft, lower_bound_general /)
character(len=param_string_length) :: dim_names(2)
character(len=param_string_length) :: name
! NOTE(bja, 2017-01) initialization doesn't seem to work correctly
! if dim_names has a parameter qualifier.
dim_names(1) = dimension_name_pft
dim_names(2) = dimension_name_prt_organs
name = 'fates_stoich_nitr'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_2d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_stoich_phos'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_2d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_alloc_organ_priority'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_2d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_cnp_turnover_nitr_retrans'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_2d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
name = 'fates_cnp_turnover_phos_retrans'
call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_2d, &
dimension_names=dim_names, lower_bounds=dim_lower_bound)
end subroutine PRTRegisterPFTOrgans
! =====================================================================================
subroutine PRTReceivePFTOrgans(fates_params)
use FatesParametersInterface, only : fates_parameters_type
use FatesParametersInterface, only : param_string_length
implicit none
class(fates_parameters_type), intent(inout) :: fates_params
character(len=param_string_length) :: name
name = 'fates_stoich_nitr'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%nitr_stoich_p1)
name = 'fates_stoich_phos'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%phos_stoich_p1)
name = 'fates_alloc_organ_priority'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%alloc_priority)
name = 'fates_cnp_turnover_nitr_retrans'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%turnover_nitr_retrans)
name = 'fates_cnp_turnover_phos_retrans'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%turnover_phos_retrans)
end subroutine PRTReceivePFTOrgans
! ===============================================================================================
subroutine FatesReportPFTParams(is_master)
! Argument
logical, intent(in) :: is_master ! Only log if this is the master proc
logical, parameter :: debug_report = .false.
character(len=15),parameter :: fmti = '(a,100(I12,1X))'
character(len=32),parameter :: fmt0 = '(a,100(F12.4,1X))'
integer :: npft,ipft
npft = size(prt_params%allom_hmode,1)
if(debug_report .and. is_master) then
if(npft>100)then
write(fates_log(),*) 'you are trying to report pft parameters during initialization'
write(fates_log(),*) 'but you have so many that it is over-running the format spec'
write(fates_log(),*) 'simply bump up the muptiplier in parameter fmt0 shown above'
call endrun(msg=errMsg(sourcefile, __LINE__))
end if
write(fates_log(),*) '----------- FATES PARTEH Parameters -----------------'
write(fates_log(),fmti) 'stress_decid = ',prt_params%stress_decid
write(fates_log(),fmti) 'season_decid = ',prt_params%season_decid
write(fates_log(),fmti) 'evergreen = ',prt_params%evergreen
write(fates_log(),fmt0) 'phen_fnrt_drop_fraction = ',prt_params%phen_fnrt_drop_fraction
write(fates_log(),fmt0) 'phen_stem_drop_fraction = ',prt_params%phen_stem_drop_fraction
write(fates_log(),fmt0) 'phen_doff_time = ',prt_params%phen_doff_time
write(fates_log(),fmt0) 'phen_drought_threshold = ',prt_params%phen_drought_threshold
write(fates_log(),fmt0) 'phen_moist_threshold = ',prt_params%phen_moist_threshold