From 64aa4d99ba744eeeacae84ed53756db93d144e46 Mon Sep 17 00:00:00 2001 From: lmbirch89 <35340409+lmbirch89@users.noreply.github.com> Date: Sat, 21 Mar 2020 11:24:39 -0400 Subject: [PATCH 1/3] Add files via upload --- src/biogeophys/LunaMod.F90 | 36 +++--- src/biogeophys/PhotosynthesisMod.F90 | 31 ++++-- src/biogeophys/TemperatureType.F90 | 52 ++++++--- src/biogeophys/WaterDiagnosticBulkType.F90 | 122 +++++++++++++++++++++ 4 files changed, 203 insertions(+), 38 deletions(-) diff --git a/src/biogeophys/LunaMod.F90 b/src/biogeophys/LunaMod.F90 index 35a38701ec..3ff3fade55 100644 --- a/src/biogeophys/LunaMod.F90 +++ b/src/biogeophys/LunaMod.F90 @@ -306,7 +306,9 @@ subroutine Update_Photosynthesis_Capacity(bounds, fn, filterp, & vcmx25_z => photosyns_inst%vcmx25_z_patch , & ! Output: [real(r8) (:,:) ] patch leaf Vc,max25 (umol/m2 leaf/s) for canopy layer jmx25_z => photosyns_inst%jmx25_z_patch , & ! Output: [real(r8) (:,:) ] patch leaf Jmax25 (umol electron/m**2/s) for canopy layer pnlc_z => photosyns_inst%pnlc_z_patch , & ! Output: [real(r8) (:,:) ] patch proportion of leaf nitrogen allocated for light capture for canopy layer - enzs_z => photosyns_inst%enzs_z_patch & ! Output: [real(r8) (:,:) ] enzyme decay status 1.0-fully active; 0-all decayed during stress + enzs_z => photosyns_inst%enzs_z_patch , & ! Output: [real(r8) (:,:) ] enzyme decay status 1.0-fully active; 0-all decayed during stress + vcmx_prevyr => photosyns_inst%vcmx_prevyr , & ! Output: [real(r8) (:,:) ] patch leaf Vc,max25 from previous year avg + jmx_prevyr => photosyns_inst%jmx_prevyr & ! Output: [real(r8) (:,:) ] patch leaf Jmax25 from previous year avg ) !---------------------------------------------------------------------------------------------------------------------------------------------------------- !set timestep @@ -332,7 +334,7 @@ subroutine Update_Photosynthesis_Capacity(bounds, fn, filterp, & hourpd = dayl(g) / 3600._r8 tleafd10 = t_veg10_day(p) - tfrz tleafn10 = t_veg10_night(p) - tfrz - tleaf10 = (dayl(g)*tleafd10 +(86400._r8-dayl(g)) * tleafd10)/86400._r8 + tleaf10 = (dayl(g)*tleafd10 +(86400._r8-dayl(g)) * tleafn10)/86400._r8 tair10 = t10(p)- tfrz relh10 = min(1.0_r8, rh10_p(p)) rb10v = rb10_p(p) @@ -409,11 +411,15 @@ subroutine Update_Photosynthesis_Capacity(bounds, fn, filterp, & chg = vcmx25_opt-vcmx25_z(p, z) chg_constrn = min(abs(chg),vcmx25_z(p, z)*max_daily_pchg) + vcmx_prevyr(p,z) = vcmx25_z(p,z) vcmx25_z(p, z) = vcmx25_z(p, z)+sign(1.0_r8,chg)*chg_constrn - + vcmx_prevyr(p,z) = (vcmx_prevyr(p,z)+vcmx25_z(p,z))/2.0_r8 + chg = jmx25_opt-jmx25_z(p, z) chg_constrn = min(abs(chg),jmx25_z(p, z)*max_daily_pchg) + jmx_prevyr(p,z) = jmx25_z(p,z) jmx25_z(p, z) = jmx25_z(p, z)+sign(1.0_r8,chg)*chg_constrn + jmx_prevyr(p,z) = (jmx_prevyr(p,z)+jmx25_z(p,z))/2.0_r8 PNlc_z(p, z)= PNlcopt @@ -472,8 +478,8 @@ subroutine Update_Photosynthesis_Capacity(bounds, fn, filterp, & endif !if not C3 plants else do z = 1 , nrad(p) - jmx25_z(p, z) = 85._r8 - vcmx25_z(p, z) = 50._r8 + jmx25_z(p, z) = jmx_prevyr(p,z) + vcmx25_z(p, z) = vcmx_prevyr(p,z) end do endif !checking for LAI and LNC endif !the first daycheck @@ -792,7 +798,7 @@ end subroutine Clear24_Climate_LUNA subroutine NitrogenAllocation(FNCa,forc_pbot10, relh10, CO2a10,O2a10, PARi10,PARimx10,rb10, hourpd, tair10, tleafd10, tleafn10, & Jmaxb0, Jmaxb1, Wc2Wjb0, relhExp,& PNlcold, PNetold, PNrespold, PNcbold, & - PNstoreopt, PNlcopt, PNetopt, PNrespopt, PNcbopt) + PNstoreopt, PNlcopt, PNetopt, PNrespopt, PNcbopt, dayl_factor) implicit none real(r8), intent (in) :: FNCa !Area based functional nitrogen content (g N/m2 leaf) real(r8), intent (in) :: forc_pbot10 !10-day mean air pressure (Pa) @@ -819,7 +825,7 @@ subroutine NitrogenAllocation(FNCa,forc_pbot10, relh10, CO2a10,O2a10, PARi10,PAR real(r8), intent (out):: PNetopt !optimal proportion of nitrogen for electron transport real(r8), intent (out):: PNrespopt !optimal proportion of nitrogen for respiration real(r8), intent (out):: PNcbopt !optial proportion of nitrogen for carboxyaltion - + real(r8), intent(in) :: dayl_factor !lbirch: added to scaled light: !------------------------------------------------------------------------------------------------------------------------------- !intermediate variables real(r8) :: Carboncost1 !absolute amount of carbon cost associated with maintenance respiration due to deccrease in light capture nitrogen(g dry mass per day) @@ -897,11 +903,11 @@ subroutine NitrogenAllocation(FNCa,forc_pbot10, relh10, CO2a10,O2a10, PARi10,PAR tleafd10c = min(max(tleafd10, Trange1), Trange2) !constrain the physiological range tleafn10c = min(max(tleafn10, Trange1), Trange2) !constrain the physiological range ci = 0.7_r8 * CO2a10 - JmaxCoef = Jmaxb1 * ((hourpd / 12.0_r8)**2.0_r8) * (1.0_r8 - exp(-relhExp * max(relh10 - minrelh, 0.0_r8) / & + JmaxCoef = Jmaxb1 * dayl_factor * (1.0_r8 - exp(-relhExp * max(relh10 - minrelh, 0.0_r8) / & (1.0_r8 - minrelh))) do while (PNlcoldi .NE. PNlc .and. jj < 100) - Fc = VcmxTKattge(tair10, tleafd10c) * Fc25 - Fj = JmxTKattge(tair10, tleafd10c) * Fj25 + Fc = VcmxTLeuning(tair10, tleafd10c) * Fc25 + Fj = JmxTLeuning(tair10, tleafd10c) * Fj25 NUEr = Cv * NUEr25 * (RespTBernacchi(tleafd10c) * hourpd + RespTBernacchi(tleafn10c) * (24.0_r8 - hourpd)) !nitrogen use efficiency for respiration (g biomass/m2/day/g N) !**************************************************** !Nitrogen Allocation Scheme: store the initial value @@ -1054,7 +1060,7 @@ subroutine Nitrogen_investments (KcKjFlag, FNCa, Nlc, forc_pbot10, relh10, & A = (1.0_r8 - theta_cj) * max(Wc, Wj) + theta_cj * min(Wc, Wj) endif PSN = Cv * A * hourpd - Vcmaxnight = VcmxTKattge(tair10, tleafn10) / VcmxTKattge(tair10, tleafd10) * Vcmax + Vcmaxnight = VcmxTLeuning(tair10, tleafn10) / VcmxTLeuning(tair10, tleafd10) * Vcmax RESP = Cv * leaf_mr_vcm * (Vcmax * hourpd + Vcmaxnight * (24.0_r8 - hourpd)) Net = Jmax / Fj Ncb = Vcmax / Fc @@ -1209,8 +1215,8 @@ subroutine NUEref(NUEjref,NUEcref,Kj2Kcref) tgrow = 25.0_r8 tleaf = 25.0_r8 - Fc = VcmxTKattge(tgrow, tleaf) * Fc25 - Fj = JmxTKattge(tgrow, tleaf) * Fj25 + Fc = VcmxTLeuning(tgrow, tleaf) * Fc25 + Fj = JmxTLeuning(tgrow, tleaf) * Fj25 CO2c = co2ref * forc_pbot_ref * 1.0e-6_r8 !pa O2c = O2ref * forc_pbot_ref * 1.0e-6_r8 !pa k_c = params_inst%kc25_coef * exp((79430.0_r8 / (rgas*1.e-3_r8 * (25.0_r8 + tfrz))) * (1.0_r8 - (tfrz + 25.0_r8) / (tfrz + tleaf))) @@ -1250,8 +1256,8 @@ subroutine NUE(O2a, ci, tgrow, tleaf, NUEj,NUEc,Kj2Kc) real(r8) :: awc !second deminator term for rubsico limited carboxylation rate based on Farquhar model real(r8) :: c_p !CO2 compenstation point (Pa) - Fc = VcmxTKattge(tgrow, tleaf) * Fc25 - Fj = JmxTKattge(tgrow, tleaf) * Fj25 + Fc = VcmxTLenuning(tgrow, tleaf) * Fc25 + Fj = JmxTLeuning(tgrow, tleaf) * Fj25 k_c = params_inst%kc25_coef * exp((79430.0_r8 / (rgas*1.e-3_r8 * (25.0_r8 + tfrz))) * (1.0_r8 - (tfrz + 25.0_r8) / (tfrz + tleaf))) k_o = params_inst%ko25_coef * exp((36380.0_r8 / (rgas*1.e-3_r8 * (25.0_r8 + tfrz))) * (1.0_r8 - (tfrz + 25.0_r8) / (tfrz + tleaf))) c_p = params_inst%cp25_yr2000 * exp((37830.0_r8 / (rgas*1.e-3_r8 * (25.0_r8 + tfrz))) * (1.0_r8 - (tfrz + 25.0_r8) / (tfrz + tleaf))) diff --git a/src/biogeophys/PhotosynthesisMod.F90 b/src/biogeophys/PhotosynthesisMod.F90 index a111cab156..11249d534c 100644 --- a/src/biogeophys/PhotosynthesisMod.F90 +++ b/src/biogeophys/PhotosynthesisMod.F90 @@ -183,6 +183,8 @@ module PhotosynthesisMod ! LUNA specific variables real(r8), pointer, public :: vcmx25_z_patch (:,:) ! patch leaf Vc,max25 (umol CO2/m**2/s) for canopy layer real(r8), pointer, public :: jmx25_z_patch (:,:) ! patch leaf Jmax25 (umol electron/m**2/s) for canopy layer + real(r8), pointer, public :: vcmx_prevyr (:,:) ! patch leaf Vc,max25 previous year avg + real(r8), pointer, public :: jmx2_prevyr (:,:) ! patch leaf Jmax25 previous year avg real(r8), pointer, public :: pnlc_z_patch (:,:) ! patch proportion of leaf nitrogen allocated for light capture for canopy layer real(r8), pointer, public :: enzs_z_patch (:,:) ! enzyme decay status 1.0-fully active; 0-all decayed during stress real(r8), pointer, public :: fpsn24_patch (:) ! 24 hour mean patch photosynthesis (umol CO2/m**2 ground/day) @@ -328,6 +330,8 @@ subroutine InitAllocate(this, bounds) ! statements. allocate(this%vcmx25_z_patch (begp:endp,1:nlevcan)) ; this%vcmx25_z_patch (:,:) = 30._r8 allocate(this%jmx25_z_patch (begp:endp,1:nlevcan)) ; this%jmx25_z_patch (:,:) = 60._r8 + allocate(this%vcmx_prevyr (begp:endp,1:nlevcan)) ; this%vcmx_prevyr (:,:) = 30._r8 + allocate(this%jmx_prevyr (begp:endp,1:nlevcan)) ; this%jmx_prevyr (:,:) = 60._r8 allocate(this%pnlc_z_patch (begp:endp,1:nlevcan)) ; this%pnlc_z_patch (:,:) = 0.01_r8 allocate(this%fpsn24_patch (begp:endp)) ; this%fpsn24_patch (:) = nan allocate(this%enzs_z_patch (begp:endp,1:nlevcan)) ; this%enzs_z_patch (:,:) = 1._r8 @@ -833,6 +837,14 @@ subroutine Restart(this, bounds, ncid, flag) dim1name='pft', dim2name='levcan', switchdim=.true., & long_name='Maximum carboxylation rate at 25 celcius for canopy layers', units='umol CO2/m**2/s', & interpinic_flag='interp', readvar=readvar, data=this%jmx25_z_patch) + call restartvar(ncid=ncid, flag=flag, varname='vcmx_prevyr', xtype=ncd_double, & + dim1name='pft', dim2name='levcan', switchdim=.true., & + long_name='avg carboxylation rate at 25 celcius for canopy layers', units='umol CO2/m**2/s', & + interpinic_flag='interp', readvar=readvar, data=this%vcmx_prevyr) + call restartvar(ncid=ncid, flag=flag, varname='jmx_prevyr', xtype=ncd_double, & + dim1name='pft', dim2name='levcan', switchdim=.true., & + long_name='avg carboxylation rate at 25 celcius for canopy layers', units='umol CO2/m**2/s', & + interpinic_flag='interp', readvar=readvar, data=this%jmx_prevyr) call restartvar(ncid=ncid, flag=flag, varname='pnlc_z', xtype=ncd_double, & dim1name='pft', dim2name='levcan', switchdim=.true., & long_name='proportion of leaf nitrogen allocated for light capture', units='unitless', & @@ -2791,18 +2803,18 @@ subroutine PhotosynthesisHydraulicStress ( bounds, fn, filterp, & kcha = 79430._r8 koha = 36380._r8 cpha = 37830._r8 - vcmaxha = 72000._r8 - jmaxha = 50000._r8 - tpuha = 72000._r8 + vcmaxha = 73637._r8 + jmaxha = 50300._r8 + tpuha = 73637._r8 lmrha = 46390._r8 ! High temperature deactivation, from: ! Leuning (2002) Plant, Cell and Environment 25:1205-1210 ! The factor "c" scales the deactivation to a value of 1.0 at 25C - vcmaxhd = 200000._r8 - jmaxhd = 200000._r8 - tpuhd = 200000._r8 + vcmaxhd = 149252._r8 + jmaxhd = 152044._r8 + tpuhd = 149252._r8 lmrhd = 150650._r8 lmrse = 490._r8 lmrc = fth25 (lmrhd, lmrse) @@ -3162,9 +3174,10 @@ subroutine PhotosynthesisHydraulicStress ( bounds, fn, filterp, & kp25_sha = kp25top * nscaler_sha ! Adjust for temperature - - vcmaxse = 668.39_r8 - 1.07_r8 * min(max((t10(p)-tfrz),11._r8),35._r8) - jmaxse = 659.70_r8 - 0.75_r8 * min(max((t10(p)-tfrz),11._r8),35._r8) + vcmaxse = 486.0_r8 + jmaxse = 495.0_r8 + !vcmaxse = 668.39_r8 - 1.07_r8 * min(max((t10(p)-tfrz),11._r8),35._r8) + !jmaxse = 659.70_r8 - 0.75_r8 * min(max((t10(p)-tfrz),11._r8),35._r8) tpuse = vcmaxse vcmaxc = fth25 (vcmaxhd, vcmaxse) jmaxc = fth25 (jmaxhd, jmaxse) diff --git a/src/biogeophys/TemperatureType.F90 b/src/biogeophys/TemperatureType.F90 index 5c69733f8a..4949c5f24b 100644 --- a/src/biogeophys/TemperatureType.F90 +++ b/src/biogeophys/TemperatureType.F90 @@ -453,13 +453,17 @@ subroutine InitHistory(this, bounds, is_simple_buildtemp, is_prog_buildtemp ) call hist_addfld1d (fname='T10', units='K', & avgflag='A', long_name='10-day running mean of 2-m temperature', & ptr_patch=this%t_a10_patch, default='inactive') - - if (use_cn .and. use_crop )then - this%t_a5min_patch(begp:endp) = spval - call hist_addfld1d (fname='A5TMIN', units='K', & - avgflag='A', long_name='5-day running mean of min 2-m temperature', & - ptr_patch=this%t_a5min_patch, default='inactive') - end if + + this%soila10_patch(begp:endp) = spval + call hist_addfld1d (fname='SOIL10', units='K', & + avgflag='A', long_name='10-day running mean of 3rd layer soil', & + ptr_patch=this%soila10_patch, default='inactive') + !if (use_cn .and. use_crop )then + this%t_a5min_patch(begp:endp) = spval + call hist_addfld1d (fname='A5TMIN', units='K', & + avgflag='A', long_name='5-day running mean of min 2-m temperature', & + ptr_patch=this%t_a5min_patch, default='inactive') + !end if if (use_cn .and. use_crop )then this%t_a10min_patch(begp:endp) = spval @@ -1163,6 +1167,12 @@ subroutine InitAccBuffer (this, bounds) call init_accum_field (name='T10', units='K', & desc='10-day running mean of 2-m temperature', accum_type='runmean', accum_period=-10, & subgrid_type='pft', numlev=1,init_value=SHR_CONST_TKFRZ+20._r8) + call init_accum_field (name='SOIL10', units='K', & + desc='10-day running mean of 3rd layer soil temp.', accum_type='runmean', accum_period=-10, & + subgrid_type='pft', numlev=1,init_value=SHR_CONST_TKFRZ) + call init_accum_field (name='TDM5', units='K', & + desc='5-day running mean of min 2-m temperature', accum_type='runmean', accum_period=-5, & + subgrid_type='pft', numlev=1, init_value=SHR_CONST_TKFRZ) if ( use_crop )then call init_accum_field (name='TDM10', units='K', & @@ -1248,7 +1258,12 @@ subroutine InitAccVars(this, bounds) call extract_accum_field ('T10', rbufslp, nstep) this%t_a10_patch(begp:endp) = rbufslp(begp:endp) + + call extract_accum_field ('SOIL10', rbufslp, nstep) + this%t_a10_patch(begp:endp) = rbufslp(begp:endp) + call extract_accum_field ('TDM5', rbufslp, nstep) + this%t_a5min_patch(begp:endp) = rbufslp(begp:endp) if (use_crop) then call extract_accum_field ('TDM10', rbufslp, nstep) this%t_a10min_patch(begp:endp)= rbufslp(begp:endp) @@ -1432,6 +1447,22 @@ subroutine UpdateAccVars (this, bounds) call update_accum_field ('T10', this%t_ref2m_patch, nstep) call extract_accum_field ('T10', this%t_a10_patch, nstep) + + do p = begp,endp + c = patch%column(p) + rbufslp(p) = this%t_soisno_col(c,3) + end do + call update_accum_field ('SOIL10', rbufslp, nstep) + call extract_accum_field ('SOIL10', this%soila10_patch, nstep) + + ! Accumulate and extract TDM5 + + do p = begp,endp + rbufslp(p) = min(this%t_ref2m_min_patch(p),this%t_ref2m_min_inst_patch(p)) !slevis: ok choice? + if (rbufslp(p) > 1.e30_r8) rbufslp(p) = SHR_CONST_TKFRZ !and were 'min'& + end do !'min_inst' not initialized? + call update_accum_field ('TDM5', rbufslp, nstep) + call extract_accum_field ('TDM5', this%t_a5min_patch, nstep) if ( use_crop )then ! Accumulate and extract TDM10 @@ -1443,14 +1474,7 @@ subroutine UpdateAccVars (this, bounds) call update_accum_field ('TDM10', rbufslp, nstep) call extract_accum_field ('TDM10', this%t_a10min_patch, nstep) - ! Accumulate and extract TDM5 - do p = begp,endp - rbufslp(p) = min(this%t_ref2m_min_patch(p),this%t_ref2m_min_inst_patch(p)) !slevis: ok choice? - if (rbufslp(p) > 1.e30_r8) rbufslp(p) = SHR_CONST_TKFRZ !and were 'min'& - end do !'min_inst' not initialized? - call update_accum_field ('TDM5', rbufslp, nstep) - call extract_accum_field ('TDM5', this%t_a5min_patch, nstep) ! Accumulate and extract GDD0 diff --git a/src/biogeophys/WaterDiagnosticBulkType.F90 b/src/biogeophys/WaterDiagnosticBulkType.F90 index 21cc9d283b..9b07ceb847 100644 --- a/src/biogeophys/WaterDiagnosticBulkType.F90 +++ b/src/biogeophys/WaterDiagnosticBulkType.F90 @@ -38,6 +38,7 @@ module WaterDiagnosticBulkType real(r8), pointer :: h2osno_total_col (:) ! col total snow water (mm H2O) real(r8), pointer :: snow_depth_col (:) ! col snow height of snow covered area (m) + real(r8), pointer :: snow_10day (:) ! col snow height 10 day avg real(r8), pointer :: snowdp_col (:) ! col area-averaged snow height (m) real(r8), pointer :: snow_layer_unity_col (:,:) ! value 1 for each snow layer, used for history diagnostics real(r8), pointer :: bw_col (:,:) ! col partial density of water in the snow pack (ice + liquid) [kg/m3] @@ -86,6 +87,9 @@ module WaterDiagnosticBulkType procedure, private :: InitBulkAllocate procedure, private :: InitBulkHistory procedure, private :: InitBulkCold + procedure, private :: InitAccBuffer + procedure, private :: InitAccVars + procedure, private :: UpdateAccVars procedure, private :: RestartBackcompatIssue783 end type waterdiagnosticbulk_type @@ -176,6 +180,7 @@ subroutine InitBulkAllocate(this, bounds) allocate(this%h2osno_total_col (begc:endc)) ; this%h2osno_total_col (:) = nan allocate(this%snow_depth_col (begc:endc)) ; this%snow_depth_col (:) = nan + allocate(this%snow_10day (begc:endc)) ; this%snow_10day (:) = nan allocate(this%snowdp_col (begc:endc)) ; this%snowdp_col (:) = nan allocate(this%snow_layer_unity_col (begc:endc,-nlevsno+1:0)) ; this%snow_layer_unity_col (:,:) = nan allocate(this%bw_col (begc:endc,-nlevsno+1:0)) ; this%bw_col (:,:) = nan @@ -400,6 +405,14 @@ subroutine InitBulkHistory(this, bounds) avgflag='A', & long_name=this%info%lname('snow height of snow covered area'), & ptr_col=this%snow_depth_col, c2l_scale_type='urbanf') + !lbirch: added lagged snow depth variable + this%snow_10day(begc:endc) = spval + call hist_addfld1d ( & + fname=this%info%fname('SNOW_10D'), & + units='m', & + avgflag='A', & + long_name=this%info%lname('10day snow avg'), & + ptr_col=this%snow_10day, c2l_scale_type='urbanf') call hist_addfld1d ( & fname=this%info%fname('SNOW_DEPTH_ICE'), & @@ -507,8 +520,109 @@ subroutine InitBulkHistory(this, bounds) ptr_patch=this%qflx_prec_intr_patch, set_lake=0._r8) end subroutine InitBulkHistory + + !----------------------------------------------------------------------- + subroutine InitAccBuffer (this, bounds) + ! + ! !DESCRIPTION: + ! Initialize accumulation buffer for all required module accumulated fields + ! This routine set defaults values that are then overwritten by the + ! restart file for restart or branch runs + ! + ! !USES + use clm_varcon , only : spval + use accumulMod , only : init_accum_field + ! + ! !ARGUMENTS: + class(waterdiagnosticbulk_type) :: this + type(bounds_type), intent(in) :: bounds + !--------------------------------------------------------------------- + + !lbirch added 10day avg + call init_accum_field (name='SNOW_10D', units='m', & + desc='10-day running mean of snowdepth', accum_type='runmean', accum_period=-5, & + subgrid_type='column', numlev=1, init_value=0._r8) + + + end subroutine InitAccBuffer !----------------------------------------------------------------------- + subroutine InitAccVars (this, bounds) + ! !DESCRIPTION: + ! Initialize module variables that are associated with + ! time accumulated fields. This routine is called for both an initial run + ! and a restart run (and must therefore must be called after the restart file + ! is read in and the accumulation buffer is obtained) + ! + ! !USES + use accumulMod , only : extract_accum_field + use clm_time_manager , only : get_nstep + ! + ! !ARGUMENTS: + class(waterdiagnosticbulk_type) :: this + type(bounds_type), intent(in) :: bounds + ! + ! !LOCAL VARIABLES: + integer :: begc, endc + integer :: nstep + integer :: ier + real(r8), pointer :: rbufslp(:) ! temporary + !--------------------------------------------------------------------- + begc = bounds%begc; endc = bounds%endc + + ! Allocate needed dynamic memory for single level patch field + allocate(rbufslp(begc:endc), stat=ier) + + ! Determine time step + nstep = get_nstep() + !lbirch added + call extract_accum_field ('SNOW_10D', rbufslp, nstep) + this%snow_10day(begc:endc) = rbufslp(begc:endc) + + deallocate(rbufslp) + + end subroutine InitAccVars + +!----------------------------------------------------------------------- + subroutine UpdateAccVars (this, bounds) + ! + ! USES + use clm_time_manager, only : get_nstep + use accumulMod , only : update_accum_field, extract_accum_field + ! + ! !ARGUMENTS: + class(waterdiagnosticbulk_type) :: this + type(bounds_type) , intent(in) :: bounds + ! + ! !LOCAL VARIABLES: + integer :: c ! indices + integer :: dtime ! timestep size [seconds] + integer :: nstep ! timestep number + integer :: ier ! error status + integer :: begc, endc + real(r8), pointer :: rbufslp(:) ! temporary single level - patch level + !--------------------------------------------------------------------- + !added by lbirch for snow + begc = bounds%begc; endc = bounds%endc + + nstep = get_nstep() + + ! Allocate needed dynamic memory for single level patch field + + allocate(rbufslp(begc:endc), stat=ier) + + ! Accumulate and extract snow 10 day + call update_accum_field ('SNOW_10D', this%snow_depth_col, nstep) + call extract_accum_field ('SNOW_10D', this%snow_10day, nstep) + + + deallocate(rbufslp) + + end subroutine UpdateAccVars + + + !----------------------------------------------------------------------- + subroutine InitBulkCold(this, bounds, & snow_depth_input_col, h2osno_input_col) ! @@ -656,6 +770,14 @@ subroutine RestartBulk(this, bounds, ncid, flag, writing_finidat_interp_dest_fil long_name=this%info%lname('snow depth'), & units='m', & interpinic_flag='interp', readvar=readvar, data=this%snow_depth_col) + !lbirch added 10 day snow + call restartvar(ncid=ncid, flag=flag, & + varname=this%info%fname('SNOW_10D'), & + xtype=ncd_double, & + dim1name='column', & + long_name=this%info%lname('10 day snow height'), & + units='m', & + interpinic_flag='interp', readvar=readvar, data=this%snow_10day) call restartvar(ncid=ncid, flag=flag, & varname=this%info%fname('frac_sno_eff'), & From d91b2eea3c4ff1f30a2e94657c9cc9a5a3601dd7 Mon Sep 17 00:00:00 2001 From: lmbirch89 <35340409+lmbirch89@users.noreply.github.com> Date: Sat, 21 Mar 2020 11:25:30 -0400 Subject: [PATCH 2/3] Add files via upload --- src/biogeochem/CNPhenologyMod.F90 | 33 +++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 index 400d46e11a..d32a3fc137 100644 --- a/src/biogeochem/CNPhenologyMod.F90 +++ b/src/biogeochem/CNPhenologyMod.F90 @@ -299,7 +299,7 @@ subroutine CNPhenology (bounds, num_soilc, filter_soilc, num_soilp, & call CNSeasonDecidPhenology(num_soilp, filter_soilp, & temperature_inst, cnveg_state_inst, dgvs_inst, & - cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) + cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst, waterstatebulk_inst) call CNStressDecidPhenology(num_soilp, filter_soilp, & soilstate_inst, temperature_inst, atm2lnd_inst, wateratm2lndbulk_inst, cnveg_state_inst, & @@ -670,7 +670,8 @@ end subroutine CNEvergreenPhenology !----------------------------------------------------------------------- subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & temperature_inst, cnveg_state_inst, dgvs_inst , & - cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) + cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst, & + waterstatebulk_inst) ! ! !DESCRIPTION: ! For coupled carbon-nitrogen code (CN). @@ -692,12 +693,15 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & type(cnveg_nitrogenstate_type) , intent(inout) :: cnveg_nitrogenstate_inst type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst + type(waterstatebulk_type) , intent(in) :: waterstatebulk_inst ! ! !LOCAL VARIABLES: integer :: g,c,p !indices integer :: fp !lake filter patch index real(r8):: ws_flag !winter-summer solstice flag (0 or 1) real(r8):: crit_onset_gdd !critical onset growing degree-day sum + real(r8):: crit_daylbirch !latitudinal gradient in arctic-boreal + real(r8):: onset_thresh !lbirch: flag onset threshold real(r8):: soilt !----------------------------------------------------------------------- @@ -780,7 +784,10 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & livestemn_storage_to_xfer => cnveg_nitrogenflux_inst%livestemn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] deadstemn_storage_to_xfer => cnveg_nitrogenflux_inst%deadstemn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] livecrootn_storage_to_xfer => cnveg_nitrogenflux_inst%livecrootn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - deadcrootn_storage_to_xfer => cnveg_nitrogenflux_inst%deadcrootn_storage_to_xfer_patch & ! Output: [real(r8) (:) ] + deadcrootn_storage_to_xfer => cnveg_nitrogenflux_inst%deadcrootn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] + t10 => temperature_inst%soila10_patch , & ! Output: [real(r8) (:) ] + tmin10 => temperature_inst%t_a10min_patch , & ! Output: [real(r8) (:) ] + snow_depth => waterstate_inst%snow_10day & ! Output: [real(r8) (:) ] ) ! start patch loop @@ -907,13 +914,21 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & if (onset_gddflag(p) == 1.0_r8 .and. soilt > SHR_CONST_TKFRZ) then onset_gdd(p) = onset_gdd(p) + (soilt-SHR_CONST_TKFRZ)*fracday end if + !seperate into Arctic boreal and lower latitudes + if (onset_gdd(p) > crit_onset_gdd .and. abs(grc%latdeg(g))<45.0_r8) then + onset_thresh=1.0_r8 + else if (onset_gddflag(p) == 1.0_r8 .and. t10(p) > SHR_CONST_TKFRZ .and. tmin10(p) > SHR_CONST_TKFRZ .and. ws_flag==1.0_r8 .and. dayl(g)>(crit_dayl/2.0_r8) .and. snow_depth(c)<0.1_r8) then + onset_thresh=1.0_r8 + end if + ! set onset_flag if critical growing degree-day sum is exceeded - if (onset_gdd(p) > crit_onset_gdd) then + if (onset_thresh == 1.0_r8) then onset_flag(p) = 1.0_r8 dormant_flag(p) = 0.0_r8 onset_gddflag(p) = 0.0_r8 onset_gdd(p) = 0.0_r8 + onset_thresh = 0.0_r8 onset_counter(p) = ndays_on * secspday ! move all the storage pools into transfer pools, @@ -954,9 +969,15 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & days_active(p) = days_active(p) + fracday if (days_active(p) > 355._r8) pftmayexist(p) = .false. end if - + ! use 15 hr max to ~11hours in temperate regions ! only begin to test for offset daylength once past the summer sol - if (ws_flag == 0._r8 .and. dayl(g) < crit_dayl) then + crit_daylbirch=54000-360*(65-grc%latdeg(g)) + if (crit_daylbirch < crit_dayl) then + crit_daylbirch = crit_dayl + end if + + !print*,'lbirch',crit_daylbirch + if (ws_flag == 0._r8 .and. dayl(g) < crit_daylbirch) then offset_flag(p) = 1._r8 offset_counter(p) = ndays_off * secspday prev_leafc_to_litter(p) = 0._r8 From 8a5252e784590c25460b7415da199a00ee39824b Mon Sep 17 00:00:00 2001 From: lmbirch89 <35340409+lmbirch89@users.noreply.github.com> Date: Sat, 21 Mar 2020 11:36:02 -0400 Subject: [PATCH 3/3] Add files via upload --- src/biogeochem/CNPhenologyMod.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 index d32a3fc137..0b7239b8c4 100644 --- a/src/biogeochem/CNPhenologyMod.F90 +++ b/src/biogeochem/CNPhenologyMod.F90 @@ -786,7 +786,7 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & livecrootn_storage_to_xfer => cnveg_nitrogenflux_inst%livecrootn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] deadcrootn_storage_to_xfer => cnveg_nitrogenflux_inst%deadcrootn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] t10 => temperature_inst%soila10_patch , & ! Output: [real(r8) (:) ] - tmin10 => temperature_inst%t_a10min_patch , & ! Output: [real(r8) (:) ] + tmin5 => temperature_inst%t_a5min_patch , & ! Output: [real(r8) (:) ] snow_depth => waterstate_inst%snow_10day & ! Output: [real(r8) (:) ] ) @@ -917,7 +917,7 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & !seperate into Arctic boreal and lower latitudes if (onset_gdd(p) > crit_onset_gdd .and. abs(grc%latdeg(g))<45.0_r8) then onset_thresh=1.0_r8 - else if (onset_gddflag(p) == 1.0_r8 .and. t10(p) > SHR_CONST_TKFRZ .and. tmin10(p) > SHR_CONST_TKFRZ .and. ws_flag==1.0_r8 .and. dayl(g)>(crit_dayl/2.0_r8) .and. snow_depth(c)<0.1_r8) then + else if (onset_gddflag(p) == 1.0_r8 .and. t10(p) > SHR_CONST_TKFRZ .and. tmin5(p) > SHR_CONST_TKFRZ .and. ws_flag==1.0_r8 .and. dayl(g)>(crit_dayl/2.0_r8) .and. snow_depth(c)<0.1_r8) then onset_thresh=1.0_r8 end if