-
Notifications
You must be signed in to change notification settings - Fork 321
/
Copy pathclm_driver.F90
1701 lines (1433 loc) · 83.5 KB
/
clm_driver.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 clm_driver
!-----------------------------------------------------------------------
! !DESCRIPTION:
! This module provides the main CLM driver physics calling sequence. Most
! computations occurs over ``clumps'' of gridcells (and associated subgrid
! scale entities) assigned to each MPI process. Computation is further
! parallelized by looping over clumps on each process using shared memory OpenMP.
!
! !USES:
use shr_kind_mod , only : r8 => shr_kind_r8
use clm_varctl , only : iulog, use_fates, use_fates_sp, use_fates_bgc
use clm_varctl , only : use_cn, use_lch4, use_noio, use_c13, use_c14
use CNSharedParamsMod , only : use_matrixcn
use clm_varctl , only : use_crop, irrigate, ndep_from_cpl
use clm_varctl , only : use_soil_moisture_streams
use clm_varctl , only : use_cropcal_streams
use clm_time_manager , only : get_nstep, is_beg_curr_day, is_beg_curr_year
use clm_time_manager , only : get_prev_date, is_first_step
use clm_varpar , only : nlevsno, nlevgrnd
use clm_varorb , only : obliqr
use spmdMod , only : masterproc, mpicom
use decompMod , only : get_proc_clumps, get_clump_bounds, get_proc_bounds, bounds_type
use filterMod , only : filter, filter_inactive_and_active
use filterMod , only : setExposedvegpFilter
use histFileMod , only : hist_update_hbuf, hist_htapes_wrapup
use restFileMod , only : restFile_write, restFile_filename
use abortutils , only : endrun
!
use dynSubgridDriverMod , only : dynSubgrid_driver, dynSubgrid_wrapup_weight_changes
use BalanceCheckMod , only : WaterGridcellBalance, BeginWaterColumnBalance, BalanceCheck
!
use BiogeophysPreFluxCalcsMod , only : BiogeophysPreFluxCalcs
use SurfaceHumidityMod , only : CalculateSurfaceHumidity
use UrbanTimeVarType , only : urbantv_type
use SoilTemperatureMod , only : SoilTemperature
use LakeTemperatureMod , only : LakeTemperature
!
use BareGroundFluxesMod , only : BareGroundFluxes
use CanopyFluxesMod , only : CanopyFluxes
use SoilFluxesMod , only : SoilFluxes ! (formerly Biogeophysics2Mod)
use UrbanFluxesMod , only : UrbanFluxes
use LakeFluxesMod , only : LakeFluxes
!
use HydrologyNoDrainageMod , only : CalcAndWithdrawIrrigationFluxes, HandleNewSnow, HydrologyNoDrainage ! (formerly Hydrology2Mod)
use HydrologyDrainageMod , only : HydrologyDrainage ! (formerly Hydrology2Mod)
use CanopyHydrologyMod , only : CanopyInterceptionAndThroughfall
use SurfaceWaterMod , only : UpdateFracH2oSfc
use LakeHydrologyMod , only : LakeHydrology
use SoilWaterMovementMod , only : use_aquifer_layer
!
use AerosolMod , only : AerosolMasses
use SnowSnicarMod , only : SnowAge_grain
use SurfaceAlbedoMod , only : SurfaceAlbedo
use UrbanAlbedoMod , only : UrbanAlbedo
!
use SurfaceRadiationMod , only : SurfaceRadiation, CanopySunShadeFracs
use UrbanRadiationMod , only : UrbanRadiation
!
use SoilBiogeochemVerticalProfileMod , only : SoilBiogeochemVerticalProfile
use SatellitePhenologyMod , only : SatellitePhenology, interpMonthlyVeg
use ndepStreamMod , only : ndep_interp
use cropcalStreamMod , only : cropcal_advance, cropcal_interp
use ch4Mod , only : ch4, ch4_init_gridcell_balance_check, ch4_init_column_balance_check
use DUSTMod , only : DustDryDep, DustEmission
use VOCEmissionMod , only : VOCEmission
!
use filterMod , only : setFilters
!
use atm2lndMod , only : downscale_forcings, set_atm2lnd_water_tracers
use lnd2atmMod , only : lnd2atm
use lnd2glcMod , only : lnd2glc_type
!
use shr_drydep_mod , only : n_drydep
use DryDepVelocity , only : depvel_compute
!
use DaylengthMod , only : UpdateDaylength
use perf_mod
!
use GridcellType , only : grc
use LandunitType , only : lun
use ColumnType , only : col
use PatchType , only : patch
use clm_instMod
use SoilMoistureStreamMod , only : PrescribedSoilMoistureInterp, PrescribedSoilMoistureAdvance
use SoilBiogeochemDecompCascadeConType , only : no_soil_decomp, decomp_method
!
! !PUBLIC TYPES:
implicit none
!
! !PUBLIC MEMBER FUNCTIONS:
public :: clm_drv ! Main clm driver
!
! !PRIVATE MEMBER FUNCTIONS:
private :: clm_drv_patch2col
private :: clm_drv_init ! Initialization of variables needed from previous timestep
private :: write_diagnostic ! Write diagnostic information to log file
character(len=*), parameter, private :: sourcefile = &
__FILE__
!-----------------------------------------------------------------------
contains
!-----------------------------------------------------------------------
subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, rof_prognostic)
!
! !DESCRIPTION:
!
! First phase of the clm driver calling the clm physics. An outline of
! the calling tree is given in the description of this module.
!
! !USES:
use clm_time_manager , only : get_curr_date
use clm_varctl , only : use_lai_streams, fates_spitfire_mode
use laiStreamMod , only : lai_advance
use FATESFireFactoryMod , only : scalar_lightning
!
! !ARGUMENTS:
implicit none
logical , intent(in) :: doalb ! true if time for surface albedo calc
real(r8), intent(in) :: nextsw_cday ! calendar day for nstep+1
real(r8), intent(in) :: declinp1 ! declination angle for next time step
real(r8), intent(in) :: declin ! declination angle for current time step
logical, intent(in) :: rstwr ! true => write restart file this step
logical, intent(in) :: nlend ! true => end of run on this step
character(len=*),intent(in) :: rdate ! restart file time stamp for name
! Whether we're running with a prognostic ROF component. This shouldn't change from
! timestep to timestep, but we pass it into the driver loop because it isn't available
! in initialization.
logical, intent(in) :: rof_prognostic ! whether we're running with a prognostic ROF component
!
! !LOCAL VARIABLES:
integer :: nstep ! time step number
integer :: nc, c, p, l, g ! indices
integer :: nclumps ! number of clumps on this processor
integer :: yr ! year (0, ...)
integer :: mon ! month (1, ..., 12)
integer :: day ! day of month (1, ..., 31)
integer :: sec ! seconds of the day
character(len=256) :: filer ! restart file name
integer :: ier ! error code
logical :: need_glacier_initialization ! true if we need to initialize glacier areas in this time step
type(bounds_type) :: bounds_clump
type(bounds_type) :: bounds_proc
! COMPILER_BUG(wjs, 2016-02-24, pgi 15.10) These temporary allocatable arrays are
! needed to work around pgi compiler bugs, as noted below
real(r8), allocatable :: downreg_patch(:)
real(r8), allocatable :: leafn_patch(:)
real(r8), allocatable :: agnpp_patch(:)
real(r8), allocatable :: bgnpp_patch(:)
real(r8), allocatable :: annsum_npp_patch(:)
real(r8), allocatable :: rr_patch(:)
real(r8), allocatable :: net_carbon_exchange_grc(:)
real(r8), allocatable :: froot_carbon(:)
real(r8), allocatable :: croot_carbon(:)
! COMPILER_BUG(wjs, 2014-11-29, pgi 14.7) Workaround for internal compiler error with
! pgi 14.7 ('normalize_forall_array: non-conformable'), which appears in the call to
! CalcIrrigationNeeded. Simply declaring this variable makes the ICE go away.
real(r8), allocatable :: dummy1_to_make_pgi_happy(:)
!-----------------------------------------------------------------------
! Determine processor bounds and clumps for this processor
call get_proc_bounds(bounds_proc)
nclumps = get_proc_clumps()
! ========================================================================
! In the first time step of a startup or hybrid run, we want to update CLM's glacier
! areas to match those given by GLC. This is because, in initialization, we do not yet
! know GLC's glacier areas, so CLM's glacier areas are based on the surface dataset
! (for a cold start or init_interp run) or the initial conditions file (in a
! non-init_interp, non-cold start run) - which may not match GLC's glacier areas for
! this configuration. (Coupling fields from GLC aren't received until the run loop.)
! Thus, CLM will see a potentially large, fictitious glacier area change in the first
! time step. We don't want this fictitious area change to result in any state or flux
! adjustments. Thus, we apply this area change here, at the start of the driver loop,
! so that in dynSubgrid_driver, it will look like there is no glacier area change in
! the first time step. (See
! https://github.com/ESCOMP/ctsm/issues/340#issuecomment-410483131 for more
! discussion on this.)
!
! This needs to happen very early in the run loop, before any balance checks are
! initialized, because - by design - this doesn't conserve mass at the grid cell
! level. (The whole point of this code block is that we adjust areas without doing
! the typical state or flux adjustments that need to accompany those area changes for
! conservation.)
!
! This accomplishes approximately the same effect that we would get if we were able to
! update glacier areas in initialization. The one difference - and minor, theoretical
! problem - that could arise from this start-of-run-loop update is: If the first time
! step of the CESM run loop looked like: (1) GLC runs and updates glacier area (i.e.,
! glacier area changes in the first time step compared with what was set in
! initialization); (2) coupler passes new glacier area to CLM; (3) CLM runs. Then the
! code here would mean that the true change in glacier area between initialization and
! the first time step would be ignored as far as state and flux adjustments are
! concerned. But this is unlikely to be an issue in practice: Currently GLC doesn't
! update this frequently, and even if it did, the change in glacier area in a single
! time step would typically be very small.
!
! If we are ever able to change the CESM initialization sequence so that GLC fields
! are passed to CLM in initialization, then this code block can be removed.
! ========================================================================
need_glacier_initialization = is_first_step()
if (need_glacier_initialization) then
!$OMP PARALLEL DO PRIVATE (nc, bounds_clump)
do nc = 1, nclumps
call get_clump_bounds(nc, bounds_clump)
call glc2lnd_inst%update_glc2lnd_fracs( &
bounds = bounds_clump)
call dynSubgrid_wrapup_weight_changes(bounds_clump, glc_behavior)
end do
!$OMP END PARALLEL DO
end if
! ============================================================================
! Specified phenology
! Done in SP mode, FATES-SP mode and also when dry-deposition is active
! ============================================================================
if (use_cn) then
! For dry-deposition need to call CLMSP so that mlaidiff is obtained
! NOTE: This is also true of FATES below
if ( n_drydep > 0 ) then
call t_startf('interpMonthlyVeg')
call interpMonthlyVeg(bounds_proc, canopystate_inst)
call t_stopf('interpMonthlyVeg')
endif
elseif(use_fates) then
! For FATES-Specified phenology mode interpolate the weights for
! time-interpolation of monthly vegetation data (as in SP mode below)
! Also for FATES with dry-deposition as above need to call CLMSP so that mlaidiff is obtained
!if ( use_fates_sp .or. (n_drydep > 0 ) ) then ! Replace with this when we have dry-deposition working
! For now don't allow for dry-deposition because of issues in #1044 EBK Jun/17/2022
if ( use_fates_sp ) then
call t_startf('interpMonthlyVeg')
call interpMonthlyVeg(bounds_proc, canopystate_inst)
call t_stopf('interpMonthlyVeg')
end if
else
! Determine weights for time interpolation of monthly vegetation data.
! This also determines whether it is time to read new monthly vegetation and
! obtain updated leaf area index [mlai1,mlai2], stem area index [msai1,msai2],
! vegetation top [mhvt1,mhvt2] and vegetation bottom [mhvb1,mhvb2]. The
! weights obtained here are used in subroutine SatellitePhenology to obtain time
! interpolated values.
! This is also done for FATES-SP mode above
if ( doalb .or. ( n_drydep > 0 ) )then
call t_startf('interpMonthlyVeg')
call interpMonthlyVeg(bounds_proc, canopystate_inst)
call t_stopf('interpMonthlyVeg')
end if
end if
! ==================================================================================
! Determine decomp vertical profiles
!
! These routines (alt_calc & decomp_vertprofiles) need to be called before
! pftdyn_cnbal, and it appears that they need to be called before pftdyn_interp and
! the associated filter updates, too (otherwise we get a carbon balance error)
! ==================================================================================
!$OMP PARALLEL DO PRIVATE (nc,bounds_clump)
do nc = 1,nclumps
call get_clump_bounds(nc, bounds_clump)
! BUG(wjs, 2014-12-15, bugz 2107) Because of the placement of the following
! routines (alt_calc and SoilBiogeochemVerticalProfile) in the driver sequence -
! they are called very early in each timestep, before weights are adjusted and
! filters are updated - it may be necessary for these routines to compute values
! over inactive as well as active points (since some inactive points may soon
! become active) - so that's what is done now. Currently, it seems to be okay to do
! this, because the variables computed here seem to only depend on quantities that
! are valid over inactive as well as active points.
call t_startf("decomp_vert")
call active_layer_inst%alt_calc(filter_inactive_and_active(nc)%num_soilc, filter_inactive_and_active(nc)%soilc, &
temperature_inst)
! Filter bgc_soilc operates on all non-sp soil columns
! Filter bgc_vegp operates on all non-fates, non-sp patches (use_cn) on soil
if ((use_cn .or. use_fates_bgc) .and. decomp_method /= no_soil_decomp) then
call SoilBiogeochemVerticalProfile(bounds_clump , &
filter_inactive_and_active(nc)%num_bgc_soilc, filter_inactive_and_active(nc)%bgc_soilc , &
filter_inactive_and_active(nc)%num_bgc_vegp, filter_inactive_and_active(nc)%bgc_vegp , &
active_layer_inst, soilstate_inst, soilbiogeochem_state_inst)
end if
call t_stopf("decomp_vert")
end do
!$OMP END PARALLEL DO
! ============================================================================
! Initialize the mass balance checks for carbon and nitrogen, and zero fluxes for
! transient land cover
! ============================================================================
if (use_cn) then
!$OMP PARALLEL DO PRIVATE (nc,bounds_clump)
do nc = 1,nclumps
call get_clump_bounds(nc, bounds_clump)
call t_startf('cninit')
call bgc_vegetation_inst%InitEachTimeStep(bounds_clump, &
filter(nc)%num_soilc, filter(nc)%soilc)
call t_stopf('cninit')
end do
!$OMP END PARALLEL DO
end if
!$OMP PARALLEL DO PRIVATE (nc,bounds_clump)
do nc = 1,nclumps
call get_clump_bounds(nc, bounds_clump)
call t_startf('begcnbal_grc')
if (use_cn .or. use_fates_bgc) then
! Initialize gridcell-level balance check
call bgc_vegetation_inst%InitGridcellBalance(bounds_clump, &
filter(nc)%num_allc, filter(nc)%allc, &
filter(nc)%num_bgc_soilc, filter(nc)%bgc_soilc, &
filter(nc)%num_bgc_vegp, filter(nc)%bgc_vegp, &
soilbiogeochem_carbonstate_inst, &
c13_soilbiogeochem_carbonstate_inst, &
c14_soilbiogeochem_carbonstate_inst, &
soilbiogeochem_nitrogenstate_inst)
end if
if (use_lch4) then
call ch4_init_gridcell_balance_check(bounds_clump, &
filter(nc)%num_nolakec, filter(nc)%nolakec, &
filter(nc)%num_lakec, filter(nc)%lakec, &
ch4_inst)
end if
call t_stopf('begcnbal_grc')
call t_startf('begwbal')
call WaterGridcellBalance(bounds_clump, &
filter(nc)%num_nolakec, filter(nc)%nolakec, &
filter(nc)%num_lakec, filter(nc)%lakec, &
water_inst, lakestate_inst, &
use_aquifer_layer = use_aquifer_layer(), flag = 'begwb')
call t_stopf('begwbal')
end do
!$OMP END PARALLEL DO
! ============================================================================
! Update subgrid weights with dynamic landcover (prescribed transient patches,
! CNDV, and or dynamic landunits), and do related adjustments. Note that this
! call needs to happen outside loops over nclumps.
! ============================================================================
call t_startf('dyn_subgrid')
call dynSubgrid_driver(bounds_proc, &
urbanparams_inst, soilstate_inst, water_inst, &
temperature_inst, energyflux_inst, lakestate_inst, &
canopystate_inst, photosyns_inst, crop_inst, glc2lnd_inst, bgc_vegetation_inst, &
soilbiogeochem_state_inst, soilbiogeochem_carbonstate_inst, &
c13_soilbiogeochem_carbonstate_inst, c14_soilbiogeochem_carbonstate_inst, &
soilbiogeochem_nitrogenstate_inst, soilbiogeochem_nitrogenflux_inst, &
soilbiogeochem_carbonflux_inst, ch4_inst, glc_behavior)
call t_stopf('dyn_subgrid')
! ============================================================================
! If soil moisture is prescribed from data streams set it here
! NOTE: This call needs to happen outside loops over nclumps (as streams are not threadsafe).
! ============================================================================
if (use_soil_moisture_streams) then
call t_startf('prescribed_sm')
call PrescribedSoilMoistureAdvance( bounds_proc )
call t_stopf('prescribed_sm')
endif
! ============================================================================
! Initialize the column-level mass balance checks for water, carbon & nitrogen.
!
! For water: Currently, I believe this needs to be done after weights are updated for
! prescribed transient patches or CNDV, because column-level water is not generally
! conserved when weights change (instead the difference is put in the grid cell-level
! terms, qflx_liq_dynbal, etc.). Grid cell-level balance
! checks ensure that the grid cell-level water is conserved by considering
! qflx_liq_dynbal and calling WaterGridcellBalance
! before the weight updates.
!
! For carbon & nitrogen: This needs to be done after dynSubgrid_driver, because the
! changes due to dynamic area adjustments can break column-level conservation
! ============================================================================
!$OMP PARALLEL DO PRIVATE (nc,bounds_clump)
do nc = 1,nclumps
call get_clump_bounds(nc, bounds_clump)
if (use_soil_moisture_streams) then
call t_startf('prescribed_sm')
call PrescribedSoilMoistureInterp(bounds_clump, soilstate_inst, &
water_inst%waterstatebulk_inst)
call t_stopf('prescribed_sm')
endif
call t_startf('begwbal')
call BeginWaterColumnBalance(bounds_clump, &
filter(nc)%num_nolakec, filter(nc)%nolakec, &
filter(nc)%num_lakec, filter(nc)%lakec, &
water_inst, soilhydrology_inst, lakestate_inst, &
use_aquifer_layer = use_aquifer_layer())
call t_stopf('begwbal')
call t_startf('begcnbal_col')
if (use_cn .or. use_fates_bgc) then
! Initialize column-level balance check
call bgc_vegetation_inst%InitColumnBalance(bounds_clump, &
filter(nc)%num_allc, filter(nc)%allc, &
filter(nc)%num_bgc_soilc, filter(nc)%bgc_soilc, &
filter(nc)%num_bgc_vegp, filter(nc)%bgc_vegp, &
soilbiogeochem_carbonstate_inst, &
c13_soilbiogeochem_carbonstate_inst, &
c14_soilbiogeochem_carbonstate_inst, &
soilbiogeochem_nitrogenstate_inst)
end if
if (use_lch4) then
call ch4_init_column_balance_check(bounds_clump, &
filter(nc)%num_nolakec, filter(nc)%nolakec, &
filter(nc)%num_lakec, filter(nc)%lakec, &
ch4_inst)
end if
call t_stopf('begcnbal_col')
end do
!$OMP END PARALLEL DO
! ============================================================================
! Update dynamic N deposition field, on albedo timestep
! currently being done outside clumps loop, but no reason why it couldn't be
! re-written to go inside.
! ============================================================================
if (use_cn) then ! .or. use_fates_bgc) then (ndep with fates will be added soon)
if (.not. ndep_from_cpl) then
call ndep_interp(bounds_proc, atm2lnd_inst)
end if
end if
if(use_cn) then
call t_startf('bgc_interp')
call bgc_vegetation_inst%InterpFileInputs(bounds_proc)
call t_stopf('bgc_interp')
! fates_spitfire_mode is assigned an integer value in the namelist
! see bld/namelist_files/namelist_definition_clm4_5.xml for details
else if (fates_spitfire_mode > scalar_lightning) then
call clm_fates%InterpFileInputs(bounds_proc)
end if
! Get time varying urban data
call urbantv_inst%urbantv_interp(bounds_proc)
! When LAI streams are being used
! NOTE: This call needs to happen outside loops over nclumps (as streams are not threadsafe)
if (doalb .and. use_lai_streams) then
call lai_advance(bounds_proc)
endif
! When crop calendar streams are being used
! NOTE: This call needs to happen outside loops over nclumps (as streams are not threadsafe)
if (use_cropcal_streams .and. is_beg_curr_year()) then
call cropcal_advance( bounds_proc )
end if
! ============================================================================
! Initialize variables from previous time step, downscale atm forcings, and
! Determine canopy interception and precipitation onto ground surface.
! Determine the fraction of foliage covered by water and the fraction
! of foliage that is dry and transpiring. Initialize snow layer if the
! snow accumulation exceeds 10 mm.
! ============================================================================
!$OMP PARALLEL DO PRIVATE (nc,l,c, bounds_clump, downreg_patch, leafn_patch, agnpp_patch, bgnpp_patch, annsum_npp_patch, rr_patch, froot_carbon, croot_carbon)
do nc = 1,nclumps
call get_clump_bounds(nc, bounds_clump)
call t_startf('drvinit')
call UpdateDaylength(bounds_clump, declin=declin, obliquity=obliqr)
! Initialze variables needed for new driver time step
call clm_drv_init(bounds_clump, &
filter(nc)%num_nolakec, filter(nc)%nolakec, &
filter(nc)%num_nolakep, filter(nc)%nolakep, &
filter(nc)%num_soilp , filter(nc)%soilp, &
canopystate_inst, water_inst%waterstatebulk_inst, &
water_inst%waterdiagnosticbulk_inst, &
energyflux_inst)
call topo_inst%UpdateTopo(bounds_clump, &
filter(nc)%num_icec, filter(nc)%icec, &
glc2lnd_inst, glc_behavior, &
atm_topo = atm2lnd_inst%forc_topo_grc(bounds_clump%begg:bounds_clump%endg))
call downscale_forcings(bounds_clump, &
topo_inst, atm2lnd_inst, water_inst%wateratm2lndbulk_inst, &
eflx_sh_precip_conversion = energyflux_inst%eflx_sh_precip_conversion_col(bounds_clump%begc:bounds_clump%endc))
call set_atm2lnd_water_tracers(bounds_clump, &
filter(nc)%num_allc, filter(nc)%allc, &
water_inst)
if (water_inst%DoConsistencyCheck()) then
call t_startf("tracer_consistency_check")
call water_inst%TracerConsistencyCheck(bounds_clump, 'after downscale_forcings')
call t_stopf("tracer_consistency_check")
end if
! Update filters that depend on variables set in clm_drv_init
call setExposedvegpFilter(bounds_clump, &
canopystate_inst%frac_veg_nosno_patch(bounds_clump%begp:bounds_clump%endp))
call t_stopf('drvinit')
if (irrigate) then
call t_startf('irrigationwithdraw')
call CalcAndWithdrawIrrigationFluxes( &
bounds = bounds_clump, &
num_soilc = filter(nc)%num_soilc, &
filter_soilc = filter(nc)%soilc, &
num_soilp = filter(nc)%num_soilp, &
filter_soilp = filter(nc)%soilp, &
soilhydrology_inst = soilhydrology_inst, &
soilstate_inst = soilstate_inst, &
irrigation_inst = irrigation_inst, &
water_inst = water_inst)
call t_stopf('irrigationwithdraw')
end if
if (water_inst%DoConsistencyCheck()) then
call t_startf("tracer_consistency_check")
call water_inst%TracerConsistencyCheck(bounds_clump, 'after CalcAndWithdrawIrrigationFluxes')
call t_stopf("tracer_consistency_check")
end if
! ============================================================================
! First Stage of Hydrology
! (1) water storage of intercepted precipitation
! (2) direct throughfall and canopy drainage of precipitation
! (3) fraction of foliage covered by water and the fraction is dry and transpiring
! (4) snow layer initialization if the snow accumulation exceeds 10 mm.
! ============================================================================
call t_startf('hydro1')
call CanopyInterceptionAndThroughfall(bounds_clump, &
filter(nc)%num_soilp, filter(nc)%soilp, &
filter(nc)%num_nolakep, filter(nc)%nolakep, &
filter(nc)%num_nolakec, filter(nc)%nolakec, &
patch, col, canopystate_inst, atm2lnd_inst, water_inst)
call HandleNewSnow(bounds_clump, &
filter(nc)%num_nolakec, filter(nc)%nolakec, &
scf_method, &
atm2lnd_inst, temperature_inst, &
aerosol_inst, water_inst)
! update surface water fraction (this may modify frac_sno)
call UpdateFracH2oSfc(bounds_clump, &
filter(nc)%num_soilc, filter(nc)%soilc, &
water_inst)
if (water_inst%DoConsistencyCheck()) then
call t_startf("tracer_consistency_check")
call water_inst%TracerConsistencyCheck(bounds_clump, 'after first stage of hydrology')
call t_stopf("tracer_consistency_check")
end if
call t_stopf('hydro1')
! ============================================================================
! Surface Radiation
! ============================================================================
call t_startf('surfrad')
! Surface Radiation primarily for non-urban columns
! Most of the surface radiation calculations are agnostic to the forest-model
! but the calculations of the fractions of sunlit and shaded canopies
! are specific, calculate them first.
! The nourbanp filter is set in dySubgrid_driver (earlier in this call)
! over the patch index range defined by bounds_clump%begp:bounds_proc%endp
if(use_fates) then
call clm_fates%wrap_sunfrac(nc,atm2lnd_inst, canopystate_inst)
else
call CanopySunShadeFracs(filter(nc)%nourbanp,filter(nc)%num_nourbanp, &
atm2lnd_inst, surfalb_inst, canopystate_inst, &
solarabs_inst)
end if
call SurfaceRadiation(bounds_clump, &
filter(nc)%num_nourbanp, filter(nc)%nourbanp, &
filter(nc)%num_urbanp, filter(nc)%urbanp, &
filter(nc)%num_urbanc, filter(nc)%urbanc, &
atm2lnd_inst, water_inst%waterdiagnosticbulk_inst, &
canopystate_inst, surfalb_inst, &
solarabs_inst, surfrad_inst)
! Surface Radiation for only urban columns
call UrbanRadiation(bounds_clump, &
filter(nc)%num_nourbanl, filter(nc)%nourbanl, &
filter(nc)%num_urbanl, filter(nc)%urbanl, &
filter(nc)%num_urbanc, filter(nc)%urbanc, &
filter(nc)%num_urbanp, filter(nc)%urbanp, &
atm2lnd_inst, water_inst%waterdiagnosticbulk_inst, &
temperature_inst, urbanparams_inst, &
solarabs_inst, surfalb_inst, energyflux_inst)
call t_stopf('surfrad')
! ============================================================================
! Determine leaf temperature and surface fluxes based on ground
! temperature from previous time step.
! ============================================================================
call t_startf('bgp1')
call BiogeophysPreFluxCalcs(bounds_clump, &
filter(nc)%num_nolakec, filter(nc)%nolakec, &
filter(nc)%num_nolakep, filter(nc)%nolakep, &
filter(nc)%num_urbanc, filter(nc)%urbanc, &
clm_fates, &
atm2lnd_inst, canopystate_inst, energyflux_inst, frictionvel_inst, &
soilstate_inst, temperature_inst, &
water_inst%wateratm2lndbulk_inst, water_inst%waterdiagnosticbulk_inst, &
water_inst%waterstatebulk_inst, water_inst%waterfluxbulk_inst)
call ozone_inst%CalcOzoneStress(bounds_clump, &
filter(nc)%num_exposedvegp, filter(nc)%exposedvegp, &
filter(nc)%num_noexposedvegp, filter(nc)%noexposedvegp)
! TODO(wjs, 2019-10-02) I'd like to keep moving this down until it is below
! LakeFluxes... I'll probably leave it in place there.
if (water_inst%DoConsistencyCheck()) then
call t_startf("tracer_consistency_check")
call water_inst%TracerConsistencyCheck(bounds_clump, 'after BiogeophysPreFluxCalcs')
call t_stopf("tracer_consistency_check")
end if
call CalculateSurfaceHumidity(bounds_clump, &
filter(nc)%num_nolakec, filter(nc)%nolakec, &
atm2lnd_inst, temperature_inst, &
water_inst%waterstatebulk_inst, water_inst%wateratm2lndbulk_inst, &
soilstate_inst, water_inst%waterdiagnosticbulk_inst)
call t_stopf('bgp1')
! ============================================================================
! Determine fluxes
! ============================================================================
call t_startf('bgp_fluxes')
call t_startf('bgflux')
! Bareground fluxes for all patches except lakes and urban landunits
call BareGroundFluxes(bounds_clump, &
filter(nc)%num_noexposedvegp, filter(nc)%noexposedvegp, &
atm2lnd_inst, soilstate_inst, &
frictionvel_inst, ch4_inst, energyflux_inst, temperature_inst, &
water_inst%waterfluxbulk_inst, water_inst%waterstatebulk_inst, &
water_inst%waterdiagnosticbulk_inst, water_inst%wateratm2lndbulk_inst, &
photosyns_inst, humanindex_inst, canopystate_inst)
call t_stopf('bgflux')
! non-bareground fluxes for all patches except lakes and urban landunits
! Calculate canopy temperature, latent and sensible fluxes from the canopy,
! and leaf water change by evapotranspiration
call t_startf('canflux')
! COMPILER_BUG(wjs, 2016-02-24, pgi 15.10) In principle, we should be able to make
! these function calls inline in the CanopyFluxes argument list. However, with pgi
! 15.10, that results in the dummy arguments having the wrong size (I suspect size
! 0, based on similar pgi compiler bugs that we have run into before). Also note
! that I don't have explicit bounds on the left-hand-side of these assignments:
! excluding these explicit bounds seemed to be needed to get around other compiler
! bugs.
allocate(downreg_patch(bounds_clump%begp:bounds_clump%endp))
allocate(leafn_patch(bounds_clump%begp:bounds_clump%endp))
downreg_patch = bgc_vegetation_inst%get_downreg_patch(bounds_clump)
leafn_patch = bgc_vegetation_inst%get_leafn_patch(bounds_clump)
allocate(froot_carbon(bounds_clump%begp:bounds_clump%endp))
allocate(croot_carbon(bounds_clump%begp:bounds_clump%endp))
froot_carbon = bgc_vegetation_inst%get_froot_carbon_patch( &
bounds_clump, canopystate_inst%tlai_patch(bounds_clump%begp:bounds_clump%endp))
croot_carbon = bgc_vegetation_inst%get_croot_carbon_patch( &
bounds_clump, canopystate_inst%tlai_patch(bounds_clump%begp:bounds_clump%endp))
call CanopyFluxes(bounds_clump, &
filter(nc)%num_exposedvegp, filter(nc)%exposedvegp, &
clm_fates,nc, &
active_layer_inst, atm2lnd_inst, canopystate_inst, &
energyflux_inst, frictionvel_inst, soilstate_inst, solarabs_inst, surfalb_inst, &
temperature_inst, water_inst%waterfluxbulk_inst, water_inst%waterstatebulk_inst, &
water_inst%waterdiagnosticbulk_inst, water_inst%wateratm2lndbulk_inst, &
ch4_inst, ozone_inst, photosyns_inst, &
humanindex_inst, soil_water_retention_curve, &
downreg_patch = downreg_patch(bounds_clump%begp:bounds_clump%endp), &
leafn_patch = leafn_patch(bounds_clump%begp:bounds_clump%endp), &
froot_carbon = froot_carbon(bounds_clump%begp:bounds_clump%endp), &
croot_carbon = croot_carbon(bounds_clump%begp:bounds_clump%endp))
deallocate(downreg_patch, leafn_patch, froot_carbon, croot_carbon)
call t_stopf('canflux')
! Fluxes for all urban landunits
call t_startf('uflux')
call UrbanFluxes(bounds_clump, &
filter(nc)%num_nourbanl, filter(nc)%nourbanl, &
filter(nc)%num_urbanl, filter(nc)%urbanl, &
filter(nc)%num_urbanc, filter(nc)%urbanc, &
filter(nc)%num_urbanp, filter(nc)%urbanp, &
atm2lnd_inst, urbanparams_inst, soilstate_inst, temperature_inst, &
water_inst%waterstatebulk_inst, water_inst%waterdiagnosticbulk_inst, &
frictionvel_inst, energyflux_inst, water_inst%waterfluxbulk_inst, &
water_inst%wateratm2lndbulk_inst, humanindex_inst)
call t_stopf('uflux')
! Fluxes for all lake landunits
call t_startf('bgplake')
call LakeFluxes(bounds_clump, &
filter(nc)%num_lakec, filter(nc)%lakec, &
filter(nc)%num_lakep, filter(nc)%lakep, &
atm2lnd_inst, solarabs_inst, frictionvel_inst, temperature_inst, &
energyflux_inst, water_inst%waterstatebulk_inst, &
water_inst%waterdiagnosticbulk_inst, &
water_inst%waterfluxbulk_inst, water_inst%wateratm2lndbulk_inst, &
lakestate_inst,&
humanindex_inst)
call t_stopf('bgplake')
call frictionvel_inst%SetActualRoughnessLengths( &
bounds = bounds_clump, &
num_exposedvegp = filter(nc)%num_exposedvegp, &
filter_exposedvegp = filter(nc)%exposedvegp, &
num_noexposedvegp = filter(nc)%num_noexposedvegp, &
filter_noexposedvegp = filter(nc)%noexposedvegp, &
num_urbanp = filter(nc)%num_urbanp, &
filter_urbanp = filter(nc)%urbanp, &
num_lakep = filter(nc)%num_lakep, &
filter_lakep = filter(nc)%lakep)
call t_stopf('bgp_fluxes')
if (irrigate) then
! ============================================================================
! Determine irrigation needed for future time steps
! ============================================================================
! NOTE(wjs, 2016-09-08) The placement of this call in the driver is historical: it
! used to be that it had to come after btran was computed. Now it no longer depends
! on btran, so it could be moved earlier in the driver loop - possibly even
! immediately before ApplyIrrigation, which would be a more clear place to put it.
call t_startf('irrigationneeded')
call irrigation_inst%CalcIrrigationNeeded( &
bounds = bounds_clump, &
num_exposedvegp = filter(nc)%num_exposedvegp, &
filter_exposedvegp = filter(nc)%exposedvegp, &
elai = canopystate_inst%elai_patch(bounds_clump%begp:bounds_clump%endp), &
t_soisno = temperature_inst%t_soisno_col(bounds_clump%begc:bounds_clump%endc , 1:nlevgrnd), &
eff_porosity = soilstate_inst%eff_porosity_col(bounds_clump%begc:bounds_clump%endc, 1:nlevgrnd), &
h2osoi_liq = water_inst%waterstatebulk_inst%h2osoi_liq_col&
(bounds_clump%begc:bounds_clump%endc , 1:nlevgrnd), &
volr = water_inst%wateratm2lndbulk_inst%volrmch_grc(bounds_clump%begg:bounds_clump%endg), &
rof_prognostic = rof_prognostic)
call t_stopf('irrigationneeded')
end if
! ============================================================================
! DUST and VOC emissions
! ============================================================================
call t_startf('bgc')
! Dust mobilization (C. Zender's modified codes)
call DustEmission(bounds_clump, &
filter(nc)%num_nolakep, filter(nc)%nolakep, &
atm2lnd_inst, soilstate_inst, canopystate_inst, &
water_inst%waterstatebulk_inst, water_inst%waterdiagnosticbulk_inst, &
frictionvel_inst, dust_inst)
! Dust dry deposition (C. Zender's modified codes)
call DustDryDep(bounds_clump, &
atm2lnd_inst, frictionvel_inst, dust_inst)
! VOC emission (A. Guenther's MEGAN (2006) model)
call VOCEmission(bounds_clump, &
filter(nc)%num_soilp, filter(nc)%soilp, &
atm2lnd_inst, canopystate_inst, photosyns_inst, temperature_inst, &
vocemis_inst)
call t_stopf('bgc')
! ============================================================================
! Determine temperatures
! ============================================================================
! Set lake temperature
call t_startf('lakeTemp')
call LakeTemperature(bounds_clump, &
filter(nc)%num_lakec, filter(nc)%lakec, &
filter(nc)%num_lakep, filter(nc)%lakep, &
solarabs_inst, soilstate_inst, water_inst%waterstatebulk_inst, &
water_inst%waterdiagnosticbulk_inst, water_inst%waterfluxbulk_inst, ch4_inst, &
energyflux_inst, temperature_inst, lakestate_inst)
call t_stopf('lakeTemp')
! Set soil/snow temperatures including ground temperature
call t_startf('soiltemperature')
call SoilTemperature(bounds_clump, &
filter(nc)%num_urbanl , filter(nc)%urbanl, &
filter(nc)%num_urbanc , filter(nc)%urbanc, &
filter(nc)%num_nolakep , filter(nc)%nolakep, &
filter(nc)%num_nolakec , filter(nc)%nolakec, &
atm2lnd_inst, urbanparams_inst, canopystate_inst, water_inst%waterstatebulk_inst, &
water_inst%waterdiagnosticbulk_inst, water_inst%waterfluxbulk_inst, &
solarabs_inst, soilstate_inst, energyflux_inst, temperature_inst, urbantv_inst)
! The following is called immediately after SoilTemperature so that melted ice is
! converted back to solid ice as soon as possible
call glacier_smb_inst%HandleIceMelt(bounds_clump, &
filter(nc)%num_do_smb_c, filter(nc)%do_smb_c, &
water_inst%waterstatebulk_inst, water_inst%waterfluxbulk_inst)
call t_stopf('soiltemperature')
! ============================================================================
! update surface fluxes for new ground temperature.
! ============================================================================
call t_startf('bgp2')
call SoilFluxes(bounds_clump, &
filter(nc)%num_urbanl, filter(nc)%urbanl, &
filter(nc)%num_urbanp, filter(nc)%urbanp, &
filter(nc)%num_nolakec, filter(nc)%nolakec, &
filter(nc)%num_nolakep, filter(nc)%nolakep, &
atm2lnd_inst, solarabs_inst, temperature_inst, canopystate_inst, &
water_inst%waterstatebulk_inst, water_inst%waterdiagnosticbulk_inst, &
energyflux_inst, water_inst%waterfluxbulk_inst)
call t_stopf('bgp2')
! ============================================================================
! Perform averaging from patch level to column level
! ============================================================================
call t_startf('patch2col')
call clm_drv_patch2col(bounds_clump, &
filter(nc)%num_allc, filter(nc)%allc, filter(nc)%num_nolakec, filter(nc)%nolakec, &
energyflux_inst, water_inst%waterfluxbulk_inst)
call t_stopf('patch2col')
! ============================================================================
! Vertical (column) soil and surface hydrology
! ============================================================================
! Note that filter_snowc and filter_nosnowc are returned by
! LakeHydrology after the new snow filter is built
call t_startf('hydro_without_drainage')
call HydrologyNoDrainage(bounds_clump, &
filter(nc)%num_nolakec, filter(nc)%nolakec, &
filter(nc)%num_hydrologyc, filter(nc)%hydrologyc, &
filter(nc)%num_urbanc, filter(nc)%urbanc, &
filter(nc)%num_snowc, filter(nc)%snowc, &
filter(nc)%num_nosnowc, filter(nc)%nosnowc, &
clm_fates, &
atm2lnd_inst, soilstate_inst, energyflux_inst, temperature_inst, &
water_inst, soilhydrology_inst, &
saturated_excess_runoff_inst, &
infiltration_excess_runoff_inst, &
aerosol_inst, canopystate_inst, scf_method, soil_water_retention_curve, topo_inst)
! The following needs to be done after HydrologyNoDrainage (because it needs
! waterfluxbulk_inst%qflx_snwcp_ice_col), but before HydrologyDrainage (because
! HydrologyDrainage calls glacier_smb_inst%AdjustRunoffTerms, which depends on
! ComputeSurfaceMassBalance having already been called).
call glacier_smb_inst%ComputeSurfaceMassBalance(bounds_clump, &
filter(nc)%num_allc, filter(nc)%allc, &
filter(nc)%num_do_smb_c, filter(nc)%do_smb_c, &
glc2lnd_inst, water_inst%waterstatebulk_inst, water_inst%waterfluxbulk_inst)
! Calculate column-integrated aerosol masses, and
! mass concentrations for radiative calculations and output
! (based on new snow level state, after SnowFilter is rebuilt.
! NEEDS TO BE AFTER SnowFiler is rebuilt, otherwise there
! can be zero snow layers but an active column in filter)
call AerosolMasses( bounds_clump, &
num_on=filter(nc)%num_snowc, filter_on=filter(nc)%snowc, &
num_off=filter(nc)%num_nosnowc, filter_off=filter(nc)%nosnowc, &
waterfluxbulk_inst = water_inst%waterfluxbulk_inst, &
waterstatebulk_inst = water_inst%waterstatebulk_inst, &
waterdiagnosticbulk_inst = water_inst%waterdiagnosticbulk_inst, &
aerosol_inst=aerosol_inst)
call t_stopf('hydro_without_drainage')
! ============================================================================
! Lake hydrology
! ============================================================================
! Note that filter_lakesnowc and filter_lakenosnowc are returned by
! LakeHydrology after the new snow filter is built
call t_startf('hylake')
call LakeHydrology(bounds_clump, &
filter(nc)%num_lakec, filter(nc)%lakec, &
filter(nc)%num_lakep, filter(nc)%lakep, &
filter(nc)%num_lakesnowc, filter(nc)%lakesnowc, &
filter(nc)%num_lakenosnowc, filter(nc)%lakenosnowc, &
scf_method, water_inst, &
atm2lnd_inst, temperature_inst, soilstate_inst, &
energyflux_inst, aerosol_inst, lakestate_inst, topo_inst)
! Calculate column-integrated aerosol masses, and
! mass concentrations for radiative calculations and output
! (based on new snow level state, after SnowFilter is rebuilt.
! NEEDS TO BE AFTER SnowFiler is rebuilt, otherwise there
! can be zero snow layers but an active column in filter)
call AerosolMasses(bounds_clump, &
num_on=filter(nc)%num_lakesnowc, filter_on=filter(nc)%lakesnowc, &
num_off=filter(nc)%num_lakenosnowc, filter_off=filter(nc)%lakenosnowc, &
waterfluxbulk_inst = water_inst%waterfluxbulk_inst, &
waterstatebulk_inst = water_inst%waterstatebulk_inst, &
waterdiagnosticbulk_inst = water_inst%waterdiagnosticbulk_inst, &
aerosol_inst=aerosol_inst)
! Must be done here because must use a snow filter for lake columns
call SnowAge_grain(bounds_clump, &
filter(nc)%num_lakesnowc, filter(nc)%lakesnowc, &
filter(nc)%num_lakenosnowc, filter(nc)%lakenosnowc, &
water_inst%waterfluxbulk_inst, water_inst%waterstatebulk_inst, &
water_inst%waterdiagnosticbulk_inst, temperature_inst, &
atm2lnd_inst)
call t_stopf('hylake')
! ============================================================================
! ! Fraction of soil covered by snow (Z.-L. Yang U. Texas)
! ============================================================================
call t_startf('snow_init')
do c = bounds_clump%begc,bounds_clump%endc
l = col%landunit(c)
if (lun%urbpoi(l)) then
! Urban landunit use Bonan 1996 (LSM Technical Note)
water_inst%waterdiagnosticbulk_inst%frac_sno_col(c) = &
min( water_inst%waterdiagnosticbulk_inst%snow_depth_col(c)/0.05_r8, 1._r8)
end if
end do
! ============================================================================
! Snow aging routine based on Flanner and Zender (2006), Linking snowpack
! microphysics and albedo evolution, JGR, and Brun (1989), Investigation of
! wet-snow metamorphism in respect of liquid-water content, Ann. Glaciol.
! ============================================================================
! Note the snow filters here do not include lakes
! TODO: move this up
call SnowAge_grain(bounds_clump, &
filter(nc)%num_snowc, filter(nc)%snowc, &
filter(nc)%num_nosnowc, filter(nc)%nosnowc, &
water_inst%waterfluxbulk_inst, water_inst%waterstatebulk_inst, &
water_inst%waterdiagnosticbulk_inst, temperature_inst, &
atm2lnd_inst)