Skip to content

Commit 548116b

Browse files
authored
Merge branch 'master' into dev-nvhpc-support
2 parents 701d501 + e1781ed commit 548116b

7 files changed

Lines changed: 326 additions & 1 deletion

File tree

src/clm5/biogeophys/SoilHydrologyType.F90

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ Module SoilHydrologyType
5353
real(r8), pointer :: i_0_col (:) ! col VIC average saturation in top soil layers
5454
real(r8), pointer :: ice_col (:,:) ! col VIC soil ice (kg/m2) for VIC soil layers
5555

56+
#ifdef USE_PDAF
57+
! Yorck
58+
real(r8), pointer :: wa_col_inc (:) ! increment col water in the unconfined aquifer (mm)
59+
real(r8), pointer :: wa_col_mean (:) ! mean col water in the unconfined aquifer (mm)
60+
#endif
5661
contains
5762

5863
! Public routines
@@ -117,6 +122,11 @@ subroutine InitAllocate(this, bounds)
117122
allocate(this%zwts_col (begc:endc)) ; this%zwts_col (:) = nan
118123

119124
allocate(this%wa_col (begc:endc)) ; this%wa_col (:) = nan
125+
#ifdef USE_PDAF
126+
! Yorck
127+
allocate(this%wa_col_inc (begc:endc)) ; this%wa_col_inc (:) = nan
128+
allocate(this%wa_col_mean (begc:endc)) ; this%wa_col_mean (:) = nan
129+
#endif
120130
allocate(this%qcharge_col (begc:endc)) ; this%qcharge_col (:) = nan
121131
allocate(this%fracice_col (begc:endc,nlevgrnd)) ; this%fracice_col (:,:) = nan
122132
allocate(this%icefrac_col (begc:endc,nlevgrnd)) ; this%icefrac_col (:,:) = nan

src/clm5/biogeophys/WaterStateType.F90

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,57 @@ module WaterstateType
5454
real(r8), pointer :: ice1_grc (:) ! grc initial gridcell total h2o ice content
5555
real(r8), pointer :: ice2_grc (:) ! grc post land cover change total ice content
5656
real(r8), pointer :: tws_grc (:) ! grc total water storage (mm H2O)
57+
#ifdef USE_PDAF
58+
! Yorck additions, variables for getting monthly means which can be compared to a GRACE measurements, other variables will just
59+
! provide instantaneous values
60+
61+
real(r8), pointer :: h2osno_col_mean (:) ! col snow water (mm H2O)
62+
real(r8), pointer :: h2osoi_liq_col_mean (:,:) ! col liquid water (kg/m2) (new) (-nlevsno+1:nlevgrnd)
63+
real(r8), pointer :: h2osoi_ice_col_mean (:,:) ! col ice lens (kg/m2) (new) (-nlevsno+1:nlevgrnd)
64+
real(r8), pointer :: h2ocan_patch_mean (:) ! patch canopy water (mm H2O)
65+
real(r8), pointer :: snocan_patch_mean (:) ! patch canopy water (mm H2O)
66+
real(r8), pointer :: h2osfc_col_mean (:) ! col surface water (mm H2O)
67+
real(r8), pointer :: total_plant_stored_h2o_col_mean(:) ! col water that is bound in plants, including roots, sapwood, leaves, etc
68+
! in most cases, the vegetation scheme does not have a dynamic
69+
! water storage in plants, and thus 0.0 is a suitable for the trivial case.
70+
! When FATES is coupled in with plant hydraulics turned on, this storage
71+
! term is set to non-zero. (kg/m2 H2O)
72+
73+
74+
real(r8), pointer :: tws_hactive (:) ! TWS for hydrological active columns
75+
real(r8), pointer :: tws_hactive_mean (:) ! TWS for hydrological active columns
76+
77+
78+
! also increments for all variables are added
79+
real(r8), pointer :: h2osno_col_inc (:) ! col snow water (mm H2O)
80+
real(r8), pointer :: h2osoi_liq_col_inc (:,:) ! col liquid water (kg/m2) (new) (-nlevsno+1:nlevgrnd)
81+
real(r8), pointer :: h2osoi_ice_col_inc (:,:) ! col ice lens (kg/m2) (new) (-nlevsno+1:nlevgrnd)
82+
real(r8), pointer :: h2ocan_patch_inc (:) ! patch canopy water (mm H2O)
83+
real(r8), pointer :: h2osfc_col_inc (:) ! col surface water (mm H2O)
84+
real(r8), pointer :: total_plant_stored_h2o_col_inc (:) ! col water that is bound in plants, including roots, sapwood, leaves, etc
85+
! in most cases, the vegetation scheme does not have a dynamic
86+
! water storage in plants, and thus 0.0 is a suitable for the trivial case.
87+
! When FATES is coupled in with plant hydraulics turned on, this storage
88+
! term is set to non-zero. (kg/m2 H2O)
89+
real(r8), pointer :: tws_grc_inc (:) ! grc total water storage (mm H2O)
90+
91+
! for analysis of the statevector, also variables for putting the state inside are initialized
92+
real(r8), pointer :: tws_state_before (:) ! TWS state
93+
real(r8), pointer :: h2osoi_liq_state_before (:,:) ! soil liq state
94+
real(r8), pointer :: h2osoi_ice_state_before (:,:) ! soil ice state
95+
real(r8), pointer :: h2osfc_state_before (:) ! surface water state
96+
real(r8), pointer :: h2osno_state_before (:) ! snow state
97+
real(r8), pointer :: h2ocan_state_before (:) ! canopy state
98+
99+
real(r8), pointer :: tws_state_after (:) ! TWS state
100+
real(r8), pointer :: h2osoi_liq_state_after (:,:) ! soil liq state
101+
real(r8), pointer :: h2osoi_ice_state_after (:,:) ! soil ice state
102+
real(r8), pointer :: h2osfc_state_after (:) ! surface water state
103+
real(r8), pointer :: h2osno_state_after (:) ! snow state
104+
real(r8), pointer :: h2ocan_state_after (:) ! canopy state
105+
106+
! END Yorck
107+
#endif
57108
#ifdef COUP_OAS_PFL
58109
real(r8), pointer :: pfl_psi_col (:,:) ! ParFlow pressure head COUP_OAS_PFL
59110
real(r8), pointer :: pfl_h2osoi_liq_col (:,:) ! ParFlow soil liquid COUP_OAS_PFL
@@ -211,6 +262,42 @@ subroutine InitAllocate(this, bounds)
211262
allocate(this%ice2_grc (begg:endg)) ; this%ice2_grc (:) = nan
212263
allocate(this%tws_grc (begg:endg)) ; this%tws_grc (:) = nan
213264

265+
#ifdef USE_PDAF
266+
! Yorck additions (see above)
267+
allocate(this%h2osoi_ice_col_mean (begc:endc,-nlevsno+1:nlevgrnd)) ; this%h2osoi_ice_col_mean (:,:) = nan
268+
allocate(this%h2osoi_liq_col_mean (begc:endc,-nlevsno+1:nlevgrnd)) ; this%h2osoi_liq_col_mean (:,:) = nan
269+
allocate(this%h2osno_col_mean (begc:endc)) ; this%h2osno_col_mean (:) = nan
270+
allocate(this%h2ocan_patch_mean (begp:endp)) ; this%h2ocan_patch_mean (:) = nan
271+
allocate(this%snocan_patch_mean (begp:endp)) ; this%snocan_patch_mean (:) = nan
272+
allocate(this%h2osfc_col_mean (begc:endc)) ; this%h2osfc_col_mean (:) = nan
273+
allocate(this%total_plant_stored_h2o_col_mean(begc:endc)) ; this%total_plant_stored_h2o_col_mean(:) = nan
274+
275+
allocate(this%tws_hactive (begg:endg)) ; this%tws_hactive (:) = nan
276+
allocate(this%tws_hactive_mean (begg:endg)) ; this%tws_hactive_mean (:) = nan
277+
278+
allocate(this%h2osoi_ice_col_inc (begc:endc,1:nlevsoi)) ; this%h2osoi_ice_col_inc (:,:) = nan
279+
allocate(this%h2osoi_liq_col_inc (begc:endc,1:nlevsoi)) ; this%h2osoi_liq_col_inc (:,:) = nan
280+
allocate(this%h2osno_col_inc (begc:endc)) ; this%h2osno_col_inc (:) = nan
281+
allocate(this%h2ocan_patch_inc (begp:endp)) ; this%h2ocan_patch_inc (:) = nan
282+
allocate(this%h2osfc_col_inc (begc:endc)) ; this%h2osfc_col_inc (:) = nan
283+
allocate(this%total_plant_stored_h2o_col_inc (begc:endc)) ; this%total_plant_stored_h2o_col_inc (:) = nan
284+
allocate(this%tws_grc_inc (begg:endg)) ; this%tws_grc_inc (:) = nan
285+
286+
allocate(this%tws_state_before (begg:endg)) ; this%tws_state_before (:) = nan
287+
allocate(this%h2osoi_liq_state_before(begg:endg,1:nlevsoi)) ; this%h2osoi_liq_state_before(:,:) = nan
288+
allocate(this%h2osoi_ice_state_before(begg:endg,1:nlevsoi)) ; this%h2osoi_ice_state_before(:,:) = nan
289+
allocate(this%h2osno_state_before (begg:endg)) ; this%h2osno_state_before (:) = nan
290+
allocate(this%h2osfc_state_before (begg:endg)) ; this%h2osfc_state_before (:) = nan
291+
allocate(this%h2ocan_state_before (begg:endg)) ; this%h2ocan_state_before (:) = nan
292+
293+
allocate(this%tws_state_after (begg:endg)) ; this%tws_state_after (:) = nan
294+
allocate(this%h2osoi_liq_state_after (begg:endg,1:nlevsoi)) ; this%h2osoi_liq_state_after (:,:) = nan
295+
allocate(this%h2osoi_ice_state_after (begg:endg,1:nlevsoi)) ; this%h2osoi_ice_state_after (:,:) = nan
296+
allocate(this%h2osno_state_after (begg:endg)) ; this%h2osno_state_after (:) = nan
297+
allocate(this%h2osfc_state_after (begg:endg)) ; this%h2osfc_state_after (:) = nan
298+
allocate(this%h2ocan_state_after (begg:endg)) ; this%h2ocan_state_after (:) = nan
299+
! END Yorck
300+
#endif
214301
allocate(this%total_plant_stored_h2o_col(begc:endc)) ; this%total_plant_stored_h2o_col(:) = nan
215302

216303
allocate(this%snw_rds_col (begc:endc,-nlevsno+1:0)) ; this%snw_rds_col (:,:) = nan
@@ -402,6 +489,13 @@ subroutine InitHistory(this, bounds)
402489
avgflag='A', long_name='total water storage', &
403490
ptr_lnd=this%tws_grc)
404491

492+
#ifdef USE_PDAF
493+
! Yorck: add also TWS_hactive in history outputs
494+
this%tws_hactive(begg:endg) = spval
495+
call hist_addfld1d (fname='TWS_hactive', units='mm', &
496+
avgflag='A', long_name='total water storage of hydrological active cells', &
497+
ptr_lnd=this%tws_hactive)
498+
#endif
405499
! (rgk 02-02-2017) There is intentionally no entry here for stored plant water
406500
! I think that since the value is zero in all cases except
407501
! for FATES plant hydraulics, it will be confusing for users

src/clm5/main/atm2lndType.F90

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,11 @@ module atm2lndType
147147
real(r8) , pointer :: t_mo_patch (:) => null() ! patch 30-day average temperature (Kelvin)
148148
real(r8) , pointer :: t_mo_min_patch (:) => null() ! patch annual min of t_mo (Kelvin)
149149

150+
#ifdef USE_PDAF
151+
! Yorck
152+
real(r8), pointer :: volr_grc_inc (:) => null() ! rof volr total volume increment (m3)
153+
real(r8), pointer :: volr_grc_mean (:) => null() ! rof volr total volume mean (m3)
154+
#endif
150155
contains
151156

152157
procedure, public :: Init
@@ -552,6 +557,13 @@ subroutine InitAllocate(this, bounds)
552557
allocate(this%pfl_psi_grc (begg:endg,1:nlevgrnd)); this%pfl_psi_grc (:,:) = ival
553558
allocate(this%pfl_h2osoi_liq_grc (begg:endg,1:nlevgrnd)); this%pfl_h2osoi_liq_grc (:,:) = ival
554559
#endif
560+
561+
#ifdef USE_PDAF
562+
! Yorck
563+
allocate(this%volr_grc_inc (begg:endg)) ; this%volr_grc_inc (:) = ival
564+
allocate(this%volr_grc_mean (begg:endg)) ; this%volr_grc_mean (:) = ival
565+
#endif
566+
555567
! anomaly forcing
556568
allocate(this%bc_precip_grc (begg:endg)) ; this%bc_precip_grc (:) = ival
557569
allocate(this%af_precip_grc (begg:endg)) ; this%af_precip_grc (:) = ival

src/clm5/main/clm_driver.F90

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,6 +1068,9 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro
10681068
solarabs_inst, drydepvel_inst, &
10691069
vocemis_inst, fireemis_inst, dust_inst, ch4_inst, glc_behavior, &
10701070
lnd2atm_inst, &
1071+
#ifdef USE_PDAF
1072+
soilhydrology_inst, soilstate_inst, &
1073+
#endif
10711074
net_carbon_exchange_grc = net_carbon_exchange_grc(bounds_proc%begg:bounds_proc%endg))
10721075
deallocate(net_carbon_exchange_grc)
10731076
call t_stopf('lnd2atm')

src/clm5/main/clm_varcon.F90

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,14 @@ module clm_varcon
106106
! Keep this negative to avoid conflicts with possible valid values
107107
integer , public, parameter :: ispval = -9999 ! special value for int data
108108

109+
#ifdef USE_PDAF
110+
! ------------------------------------------------------------------------
111+
! Yorck variables
112+
! ------------------------------------------------------------------------
113+
114+
integer :: averaging_var = 0 ! averaging integer for averaging TWS variables according to GRACE interval
115+
integer :: set_averaging_to_zero = ispval ! integer indicating at which point in time the averageTemp has to be set to zero due to missing observation values
116+
#endif
109117
! ------------------------------------------------------------------------
110118
! These are tunable constants from clm2_3
111119
! ------------------------------------------------------------------------

0 commit comments

Comments
 (0)