diff --git a/src/clm5/biogeophys/SoilHydrologyType.F90 b/src/clm5/biogeophys/SoilHydrologyType.F90 index 33aee7efda..c62ec465f1 100644 --- a/src/clm5/biogeophys/SoilHydrologyType.F90 +++ b/src/clm5/biogeophys/SoilHydrologyType.F90 @@ -53,6 +53,11 @@ Module SoilHydrologyType real(r8), pointer :: i_0_col (:) ! col VIC average saturation in top soil layers real(r8), pointer :: ice_col (:,:) ! col VIC soil ice (kg/m2) for VIC soil layers +#ifdef USE_PDAF + ! Yorck + real(r8), pointer :: wa_col_inc (:) ! increment col water in the unconfined aquifer (mm) + real(r8), pointer :: wa_col_mean (:) ! mean col water in the unconfined aquifer (mm) +#endif contains ! Public routines @@ -117,6 +122,11 @@ subroutine InitAllocate(this, bounds) allocate(this%zwts_col (begc:endc)) ; this%zwts_col (:) = nan allocate(this%wa_col (begc:endc)) ; this%wa_col (:) = nan +#ifdef USE_PDAF + ! Yorck + allocate(this%wa_col_inc (begc:endc)) ; this%wa_col_inc (:) = nan + allocate(this%wa_col_mean (begc:endc)) ; this%wa_col_mean (:) = nan +#endif allocate(this%qcharge_col (begc:endc)) ; this%qcharge_col (:) = nan allocate(this%fracice_col (begc:endc,nlevgrnd)) ; this%fracice_col (:,:) = nan allocate(this%icefrac_col (begc:endc,nlevgrnd)) ; this%icefrac_col (:,:) = nan diff --git a/src/clm5/biogeophys/WaterStateType.F90 b/src/clm5/biogeophys/WaterStateType.F90 index 65944de240..fdec7cf1b3 100644 --- a/src/clm5/biogeophys/WaterStateType.F90 +++ b/src/clm5/biogeophys/WaterStateType.F90 @@ -54,6 +54,57 @@ module WaterstateType real(r8), pointer :: ice1_grc (:) ! grc initial gridcell total h2o ice content real(r8), pointer :: ice2_grc (:) ! grc post land cover change total ice content real(r8), pointer :: tws_grc (:) ! grc total water storage (mm H2O) +#ifdef USE_PDAF + ! Yorck additions, variables for getting monthly means which can be compared to a GRACE measurements, other variables will just + ! provide instantaneous values + + real(r8), pointer :: h2osno_col_mean (:) ! col snow water (mm H2O) + real(r8), pointer :: h2osoi_liq_col_mean (:,:) ! col liquid water (kg/m2) (new) (-nlevsno+1:nlevgrnd) + real(r8), pointer :: h2osoi_ice_col_mean (:,:) ! col ice lens (kg/m2) (new) (-nlevsno+1:nlevgrnd) + real(r8), pointer :: h2ocan_patch_mean (:) ! patch canopy water (mm H2O) + real(r8), pointer :: snocan_patch_mean (:) ! patch canopy water (mm H2O) + real(r8), pointer :: h2osfc_col_mean (:) ! col surface water (mm H2O) + real(r8), pointer :: total_plant_stored_h2o_col_mean(:) ! col water that is bound in plants, including roots, sapwood, leaves, etc + ! in most cases, the vegetation scheme does not have a dynamic + ! water storage in plants, and thus 0.0 is a suitable for the trivial case. + ! When FATES is coupled in with plant hydraulics turned on, this storage + ! term is set to non-zero. (kg/m2 H2O) + + + real(r8), pointer :: tws_hactive (:) ! TWS for hydrological active columns + real(r8), pointer :: tws_hactive_mean (:) ! TWS for hydrological active columns + + + ! also increments for all variables are added + real(r8), pointer :: h2osno_col_inc (:) ! col snow water (mm H2O) + real(r8), pointer :: h2osoi_liq_col_inc (:,:) ! col liquid water (kg/m2) (new) (-nlevsno+1:nlevgrnd) + real(r8), pointer :: h2osoi_ice_col_inc (:,:) ! col ice lens (kg/m2) (new) (-nlevsno+1:nlevgrnd) + real(r8), pointer :: h2ocan_patch_inc (:) ! patch canopy water (mm H2O) + real(r8), pointer :: h2osfc_col_inc (:) ! col surface water (mm H2O) + real(r8), pointer :: total_plant_stored_h2o_col_inc (:) ! col water that is bound in plants, including roots, sapwood, leaves, etc + ! in most cases, the vegetation scheme does not have a dynamic + ! water storage in plants, and thus 0.0 is a suitable for the trivial case. + ! When FATES is coupled in with plant hydraulics turned on, this storage + ! term is set to non-zero. (kg/m2 H2O) + real(r8), pointer :: tws_grc_inc (:) ! grc total water storage (mm H2O) + + ! for analysis of the statevector, also variables for putting the state inside are initialized + real(r8), pointer :: tws_state_before (:) ! TWS state + real(r8), pointer :: h2osoi_liq_state_before (:,:) ! soil liq state + real(r8), pointer :: h2osoi_ice_state_before (:,:) ! soil ice state + real(r8), pointer :: h2osfc_state_before (:) ! surface water state + real(r8), pointer :: h2osno_state_before (:) ! snow state + real(r8), pointer :: h2ocan_state_before (:) ! canopy state + + real(r8), pointer :: tws_state_after (:) ! TWS state + real(r8), pointer :: h2osoi_liq_state_after (:,:) ! soil liq state + real(r8), pointer :: h2osoi_ice_state_after (:,:) ! soil ice state + real(r8), pointer :: h2osfc_state_after (:) ! surface water state + real(r8), pointer :: h2osno_state_after (:) ! snow state + real(r8), pointer :: h2ocan_state_after (:) ! canopy state + + ! END Yorck +#endif #ifdef COUP_OAS_PFL real(r8), pointer :: pfl_psi_col (:,:) ! ParFlow pressure head COUP_OAS_PFL real(r8), pointer :: pfl_h2osoi_liq_col (:,:) ! ParFlow soil liquid COUP_OAS_PFL @@ -211,6 +262,42 @@ subroutine InitAllocate(this, bounds) allocate(this%ice2_grc (begg:endg)) ; this%ice2_grc (:) = nan allocate(this%tws_grc (begg:endg)) ; this%tws_grc (:) = nan +#ifdef USE_PDAF + ! Yorck additions (see above) + allocate(this%h2osoi_ice_col_mean (begc:endc,-nlevsno+1:nlevgrnd)) ; this%h2osoi_ice_col_mean (:,:) = nan + allocate(this%h2osoi_liq_col_mean (begc:endc,-nlevsno+1:nlevgrnd)) ; this%h2osoi_liq_col_mean (:,:) = nan + allocate(this%h2osno_col_mean (begc:endc)) ; this%h2osno_col_mean (:) = nan + allocate(this%h2ocan_patch_mean (begp:endp)) ; this%h2ocan_patch_mean (:) = nan + allocate(this%snocan_patch_mean (begp:endp)) ; this%snocan_patch_mean (:) = nan + allocate(this%h2osfc_col_mean (begc:endc)) ; this%h2osfc_col_mean (:) = nan + allocate(this%total_plant_stored_h2o_col_mean(begc:endc)) ; this%total_plant_stored_h2o_col_mean(:) = nan + + allocate(this%tws_hactive (begg:endg)) ; this%tws_hactive (:) = nan + allocate(this%tws_hactive_mean (begg:endg)) ; this%tws_hactive_mean (:) = nan + + allocate(this%h2osoi_ice_col_inc (begc:endc,1:nlevsoi)) ; this%h2osoi_ice_col_inc (:,:) = nan + allocate(this%h2osoi_liq_col_inc (begc:endc,1:nlevsoi)) ; this%h2osoi_liq_col_inc (:,:) = nan + allocate(this%h2osno_col_inc (begc:endc)) ; this%h2osno_col_inc (:) = nan + allocate(this%h2ocan_patch_inc (begp:endp)) ; this%h2ocan_patch_inc (:) = nan + allocate(this%h2osfc_col_inc (begc:endc)) ; this%h2osfc_col_inc (:) = nan + allocate(this%total_plant_stored_h2o_col_inc (begc:endc)) ; this%total_plant_stored_h2o_col_inc (:) = nan + allocate(this%tws_grc_inc (begg:endg)) ; this%tws_grc_inc (:) = nan + + allocate(this%tws_state_before (begg:endg)) ; this%tws_state_before (:) = nan + allocate(this%h2osoi_liq_state_before(begg:endg,1:nlevsoi)) ; this%h2osoi_liq_state_before(:,:) = nan + allocate(this%h2osoi_ice_state_before(begg:endg,1:nlevsoi)) ; this%h2osoi_ice_state_before(:,:) = nan + allocate(this%h2osno_state_before (begg:endg)) ; this%h2osno_state_before (:) = nan + allocate(this%h2osfc_state_before (begg:endg)) ; this%h2osfc_state_before (:) = nan + allocate(this%h2ocan_state_before (begg:endg)) ; this%h2ocan_state_before (:) = nan + + allocate(this%tws_state_after (begg:endg)) ; this%tws_state_after (:) = nan + allocate(this%h2osoi_liq_state_after (begg:endg,1:nlevsoi)) ; this%h2osoi_liq_state_after (:,:) = nan + allocate(this%h2osoi_ice_state_after (begg:endg,1:nlevsoi)) ; this%h2osoi_ice_state_after (:,:) = nan + allocate(this%h2osno_state_after (begg:endg)) ; this%h2osno_state_after (:) = nan + allocate(this%h2osfc_state_after (begg:endg)) ; this%h2osfc_state_after (:) = nan + allocate(this%h2ocan_state_after (begg:endg)) ; this%h2ocan_state_after (:) = nan + ! END Yorck +#endif allocate(this%total_plant_stored_h2o_col(begc:endc)) ; this%total_plant_stored_h2o_col(:) = nan allocate(this%snw_rds_col (begc:endc,-nlevsno+1:0)) ; this%snw_rds_col (:,:) = nan @@ -402,6 +489,13 @@ subroutine InitHistory(this, bounds) avgflag='A', long_name='total water storage', & ptr_lnd=this%tws_grc) +#ifdef USE_PDAF + ! Yorck: add also TWS_hactive in history outputs + this%tws_hactive(begg:endg) = spval + call hist_addfld1d (fname='TWS_hactive', units='mm', & + avgflag='A', long_name='total water storage of hydrological active cells', & + ptr_lnd=this%tws_hactive) +#endif ! (rgk 02-02-2017) There is intentionally no entry here for stored plant water ! I think that since the value is zero in all cases except ! for FATES plant hydraulics, it will be confusing for users diff --git a/src/clm5/main/atm2lndType.F90 b/src/clm5/main/atm2lndType.F90 index 524908fe3c..ea52e6f35e 100644 --- a/src/clm5/main/atm2lndType.F90 +++ b/src/clm5/main/atm2lndType.F90 @@ -147,6 +147,11 @@ module atm2lndType real(r8) , pointer :: t_mo_patch (:) => null() ! patch 30-day average temperature (Kelvin) real(r8) , pointer :: t_mo_min_patch (:) => null() ! patch annual min of t_mo (Kelvin) +#ifdef USE_PDAF + ! Yorck + real(r8), pointer :: volr_grc_inc (:) => null() ! rof volr total volume increment (m3) + real(r8), pointer :: volr_grc_mean (:) => null() ! rof volr total volume mean (m3) +#endif contains procedure, public :: Init @@ -552,6 +557,13 @@ subroutine InitAllocate(this, bounds) allocate(this%pfl_psi_grc (begg:endg,1:nlevgrnd)); this%pfl_psi_grc (:,:) = ival allocate(this%pfl_h2osoi_liq_grc (begg:endg,1:nlevgrnd)); this%pfl_h2osoi_liq_grc (:,:) = ival #endif + +#ifdef USE_PDAF + ! Yorck + allocate(this%volr_grc_inc (begg:endg)) ; this%volr_grc_inc (:) = ival + allocate(this%volr_grc_mean (begg:endg)) ; this%volr_grc_mean (:) = ival +#endif + ! anomaly forcing allocate(this%bc_precip_grc (begg:endg)) ; this%bc_precip_grc (:) = ival allocate(this%af_precip_grc (begg:endg)) ; this%af_precip_grc (:) = ival diff --git a/src/clm5/main/clm_driver.F90 b/src/clm5/main/clm_driver.F90 index 7fef829b08..b7f36c920d 100644 --- a/src/clm5/main/clm_driver.F90 +++ b/src/clm5/main/clm_driver.F90 @@ -1068,6 +1068,9 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro solarabs_inst, drydepvel_inst, & vocemis_inst, fireemis_inst, dust_inst, ch4_inst, glc_behavior, & lnd2atm_inst, & +#ifdef USE_PDAF + soilhydrology_inst, soilstate_inst, & +#endif net_carbon_exchange_grc = net_carbon_exchange_grc(bounds_proc%begg:bounds_proc%endg)) deallocate(net_carbon_exchange_grc) call t_stopf('lnd2atm') diff --git a/src/clm5/main/clm_varcon.F90 b/src/clm5/main/clm_varcon.F90 index d0a2053568..3ef51256fc 100644 --- a/src/clm5/main/clm_varcon.F90 +++ b/src/clm5/main/clm_varcon.F90 @@ -106,6 +106,14 @@ module clm_varcon ! Keep this negative to avoid conflicts with possible valid values integer , public, parameter :: ispval = -9999 ! special value for int data +#ifdef USE_PDAF + ! ------------------------------------------------------------------------ + ! Yorck variables + ! ------------------------------------------------------------------------ + + integer :: averaging_var = 0 ! averaging integer for averaging TWS variables according to GRACE interval + 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 +#endif ! ------------------------------------------------------------------------ ! These are tunable constants from clm2_3 ! ------------------------------------------------------------------------ diff --git a/src/clm5/main/lnd2atmMod.F90 b/src/clm5/main/lnd2atmMod.F90 index 950c8fd610..7d1d68602d 100644 --- a/src/clm5/main/lnd2atmMod.F90 +++ b/src/clm5/main/lnd2atmMod.F90 @@ -13,6 +13,9 @@ module lnd2atmMod use shr_fire_emis_mod , only : shr_fire_emis_mechcomps_n use clm_varpar , only : numrad, ndst, nlevgrnd, nlevsoi !ndst = number of dust bins. use clm_varcon , only : rair, grav, cpair, hfus, tfrz, spval +#ifdef USE_PDAF + use clm_varcon , only : set_averaging_to_zero, averaging_var, aquifer_water_baseline +#endif use clm_varctl , only : iulog, use_lch4 use seq_drydep_mod , only : n_drydep, drydep_method, DD_XLND use decompMod , only : bounds_type @@ -38,6 +41,12 @@ module lnd2atmMod use LandunitType , only : lun use GridcellType , only : grc use landunit_varcon , only : istice_mec, istsoil, istcrop +#ifdef USE_PDAF + use clm_time_manager , only : get_nstep + use SoilHydrologyType , only : soilhydrology_type + use SoilStateType , only : soilstate_type + use PatchType , only : patch +#endif ! ! !PUBLIC TYPES: implicit none @@ -127,6 +136,9 @@ subroutine lnd2atm(bounds, & solarabs_inst, drydepvel_inst, & vocemis_inst, fireemis_inst, dust_inst, ch4_inst, glc_behavior, & lnd2atm_inst, & +#ifdef USE_PDAF + soilhydrology_inst, soilstate_inst, & +#endif net_carbon_exchange_grc) ! ! !DESCRIPTION: @@ -153,17 +165,41 @@ subroutine lnd2atm(bounds, & type(ch4_type) , intent(in) :: ch4_inst type(glc_behavior_type) , intent(in) :: glc_behavior type(lnd2atm_type) , intent(inout) :: lnd2atm_inst +#ifdef USE_PDAF + ! Yorck + type(soilhydrology_type) , intent(inout) :: soilhydrology_inst + type(soilstate_type) , intent(inout) :: soilstate_inst + ! end Yorck +#endif real(r8) , intent(in) :: net_carbon_exchange_grc( bounds%begg: ) ! net carbon exchange between land and atmosphere, positive for source (gC/m2/s) ! ! !LOCAL VARIABLES: integer :: c, g, j ! indices +#ifdef USE_PDAF + integer :: p, l, index, counter ! indices +#endif real(r8) :: qflx_ice_runoff_col(bounds%begc:bounds%endc) ! total column-level ice runoff real(r8) :: eflx_sh_ice_to_liq_grc(bounds%begg:bounds%endg) ! sensible heat flux generated from the ice to liquid conversion, averaged to gridcell real(r8), parameter :: amC = 12.0_r8 ! Atomic mass number for Carbon real(r8), parameter :: amO = 16.0_r8 ! Atomic mass number for Oxygen real(r8), parameter :: amCO2 = amC + 2.0_r8*amO ! Atomic mass number for CO2 +#ifdef USE_PDAF + real(r8), parameter :: m_per_mm = 1.e-3_r8 ! 0.001 meters per mm + real(r8), parameter :: sec_per_hr = 3600 ! 3600 s in 1 hour +#endif ! The following converts g of C to kg of CO2 real(r8), parameter :: convertgC2kgCO2 = 1.0e-3_r8 * (amCO2/amC) +#ifdef USE_PDAF + integer :: nstep ! time step number + + REAL, allocatable :: h2osoi_liq_grc(:) + REAL, allocatable :: h2osoi_ice_grc(:) + REAL, allocatable :: h2osno_grc(:) + REAL, allocatable :: h2osfc_grc(:) + REAL, allocatable :: h2ocan_grc(:) + logical, allocatable :: found(:) + logical, allocatable :: found_patch(:) +#endif !------------------------------------------------------------------------ SHR_ASSERT_ALL((ubound(net_carbon_exchange_grc) == (/bounds%endg/)), errMsg(sourcefile, __LINE__)) @@ -442,6 +478,168 @@ subroutine lnd2atm(bounds, & enddo #endif +#ifdef USE_PDAF + ! Yorck: update also TWS of hydrological active cells + + if (allocated(h2osoi_liq_grc)) deallocate(h2osoi_liq_grc) + allocate(h2osoi_liq_grc(bounds%begg:bounds%endg)) + h2osoi_liq_grc(bounds%begg:bounds%endg) = spval + + if (allocated(h2osoi_ice_grc)) deallocate(h2osoi_ice_grc) + allocate(h2osoi_ice_grc(bounds%begg:bounds%endg)) + h2osoi_ice_grc(bounds%begg:bounds%endg) = spval + + if (allocated(h2osno_grc)) deallocate(h2osno_grc) + allocate(h2osno_grc(bounds%begg:bounds%endg)) + h2osno_grc(bounds%begg:bounds%endg) = spval + + if (allocated(h2osfc_grc)) deallocate(h2osfc_grc) + allocate(h2osfc_grc(bounds%begg:bounds%endg)) + h2osfc_grc(bounds%begg:bounds%endg) = spval + + if (allocated(h2ocan_grc)) deallocate(h2ocan_grc) + allocate(h2ocan_grc(bounds%begg:bounds%endg)) + h2ocan_grc(bounds%begg:bounds%endg) = spval + + if (allocated(found)) deallocate(found) + allocate(found(bounds%begg:bounds%endg)) + found(bounds%begg:bounds%endg) = .false. + + if (allocated(found_patch)) deallocate(found_patch) + allocate(found_patch(bounds%begg:bounds%endg)) + found_patch(bounds%begg:bounds%endg) = .false. + + do g = bounds%begg, bounds%endg + counter = 0 + do c = bounds%begc, bounds%endc + if (col%hydrologically_active(c) .and. col%gridcell(c)==g) then + do j = 1,nlevsoi + if (j==1 .and. .not. found(g)) then + found(g) = .true. + h2osoi_liq_grc(g) = 0._r8 + h2osoi_ice_grc(g) = 0._r8 + h2osno_grc(g) = 0._r8 + h2osfc_grc(g) = 0._r8 + end if + if (j<=col%nbedrock(c)) then + h2osoi_liq_grc(g) = h2osoi_liq_grc(g) + waterstate_inst%h2osoi_liq_col(c,j) + h2osoi_ice_grc(g) = h2osoi_ice_grc(g) + waterstate_inst%h2osoi_ice_col(c,j) + end if + end do + + + + h2osno_grc(g) = h2osno_grc(g) + waterstate_inst%h2osno_col(c) + h2osfc_grc(g) = h2osfc_grc(g) + waterstate_inst%h2osfc_col(c) + counter= counter+1 + end if + end do + if (counter.ne.0) then + h2osoi_liq_grc(g) = h2osoi_liq_grc(g)/counter + h2osoi_ice_grc(g) = h2osoi_ice_grc(g)/counter + h2osno_grc(g) = h2osno_grc(g)/counter + h2osfc_grc(g) = h2osfc_grc(g)/counter + end if + + + counter = 0 + do p = bounds%begp, bounds%endp + c = patch%column(p) + if (col%hydrologically_active(c) .and. col%gridcell(c)==g .and. patch%active(p)) then + if (.not. found_patch(g)) then + found_patch(g) = .true. + h2ocan_grc(g) = 0 + end if + h2ocan_grc(g) = h2ocan_grc(g) + waterstate_inst%h2ocan_patch(p) + counter = counter+1 + end if + end do + if (counter.ne.0) then + h2ocan_grc(g) = h2ocan_grc(g)/counter + else + h2ocan_grc(g) = 0 + end if + + if (found(g)) then + waterstate_inst%tws_hactive(g) = h2osoi_liq_grc(g) + h2osoi_ice_grc(g) + h2osno_grc(g) + h2osfc_grc(g) + h2ocan_grc(g) + end if + end do + + if (allocated(h2osoi_liq_grc)) deallocate(h2osoi_liq_grc) + + if (allocated(h2osoi_ice_grc)) deallocate(h2osoi_ice_grc) + + if (allocated(h2osno_grc)) deallocate(h2osno_grc) + + if (allocated(h2osfc_grc)) deallocate(h2osfc_grc) + + if (allocated(h2ocan_grc)) deallocate(h2ocan_grc) + + if (allocated(found)) deallocate(found) + + if (allocated(found_patch)) deallocate(found_patch) + + + ! YORCK --> idea: when TWS is calculated at the end of a time step, update all running mean variables. + ! this is done for all compartments of TWS, the variables are initialized in the respective type modules + ! here because the update of all important variables inside CLM is finished! + nstep = get_nstep() + if (nstep.eq.set_averaging_to_zero) then + + averaging_var = 0 + + end if + + averaging_var = averaging_var+1 + + ! if averaging var was resetted, reset also running averages + if (averaging_var == 1) then + do c = bounds%begc, bounds%endc + waterstate_inst%h2osno_col_mean(c) = 0._r8 + soilhydrology_inst%wa_col_mean(c) = 0._r8 + waterstate_inst%h2osfc_col_mean(c) = 0._r8 + waterstate_inst%total_plant_stored_h2o_col_mean(c) = 0._r8 + do j = 1,nlevgrnd + waterstate_inst%h2osoi_liq_col_mean(c,j) = 0._r8 + waterstate_inst%h2osoi_ice_col_mean(c,j) = 0._r8 + end do + end do + do g = bounds%begg, bounds%endg + atm2lnd_inst%volr_grc_mean(g) = 0._r8 + waterstate_inst%tws_hactive_mean(g) = 0._r8 + end do + + do p = bounds%begp, bounds%endp + waterstate_inst%h2ocan_patch_mean(p) = 0._r8 + waterstate_inst%snocan_patch_mean(p) = 0._r8 + end do + end if + + ! Yorck + ! update running average with mean = (var + (count-1)*mean)/count for all variables that contribute to TWS + do c = bounds%begc, bounds%endc + waterstate_inst%h2osno_col_mean(c) = (waterstate_inst%h2osno_col(c)+(averaging_var-1)*waterstate_inst%h2osno_col_mean(c))/averaging_var + soilhydrology_inst%wa_col_mean(c) = (soilhydrology_inst%wa_col(c)+(averaging_var-1)*soilhydrology_inst%wa_col_mean(c))/averaging_var + waterstate_inst%h2osfc_col_mean(c) = (waterstate_inst%h2osfc_col(c)+(averaging_var-1)*waterstate_inst%h2osfc_col_mean(c))/averaging_var + waterstate_inst%total_plant_stored_h2o_col_mean(c) = (waterstate_inst%total_plant_stored_h2o_col(c)+(averaging_var-1) * & + waterstate_inst%total_plant_stored_h2o_col_mean(c))/averaging_var + do j = 1,nlevgrnd + waterstate_inst%h2osoi_liq_col_mean(c,j) = (waterstate_inst%h2osoi_liq_col(c,j)+(averaging_var-1)* waterstate_inst%h2osoi_liq_col_mean(c,j))/averaging_var + waterstate_inst%h2osoi_ice_col_mean(c,j) = (waterstate_inst%h2osoi_ice_col(c,j)+(averaging_var-1)* waterstate_inst%h2osoi_ice_col_mean(c,j))/averaging_var + end do + end do + + do g = bounds%begg, bounds%endg + atm2lnd_inst%volr_grc_mean(g) = (atm2lnd_inst%volr_grc(g)+(averaging_var-1)*atm2lnd_inst%volr_grc_mean(g))/averaging_var + waterstate_inst%tws_hactive_mean(g) = (waterstate_inst%tws_hactive(g)+(averaging_var-1)*waterstate_inst%tws_hactive_mean(g))/averaging_var + end do + + do p = bounds%begp, bounds%endp + waterstate_inst%h2ocan_patch_mean(p) = (waterstate_inst%h2ocan_patch(p)+(averaging_var-1)*waterstate_inst%h2ocan_patch_mean(p))/averaging_var + waterstate_inst%snocan_patch_mean(p) = (waterstate_inst%snocan_patch(p)+(averaging_var-1)*waterstate_inst%snocan_patch_mean(p))/averaging_var + end do +#endif + end subroutine lnd2atm !-----------------------------------------------------------------------