Skip to content

Commit

Permalink
corrected hardtemp
Browse files Browse the repository at this point in the history
  • Loading branch information
mariuslam committed Jun 27, 2022
1 parent 41f352e commit d22471c
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 14 deletions.
15 changes: 9 additions & 6 deletions biogeochem/EDMortalityFunctionsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,9 @@ subroutine Hardening_scheme(currentSite,currentPatch,cohort_in,bc_in ) !marius
rate_dh=(Tmean-2.5_r8)*((max_h_dehard-min_h)/-62.22_r8)
end if
end if

dayl_thresh= 42000.0_r8 + ( (-30.0_r8 - max(-60.0_r8,min(0.0_r8,currentSite%hardtemp)) )/15.0_r8) * 4500.0_r8
!write(fates_log(),*) hlm_current_year,hlm_current_month,hlm_current_day,'hardtemp',currentSite%hardtemp
!================================================
!Hardening calculation
cohort_in%hard_level_prev = cohort_in%hard_level
Expand All @@ -420,21 +421,23 @@ subroutine Hardening_scheme(currentSite,currentPatch,cohort_in,bc_in ) !marius
else if (cohort_in%hard_level_prev < target_h) then
cohort_in%hard_level = cohort_in%hard_level_prev + rate_dh
end if

!write(fates_log(),*) hlm_current_year,hlm_current_month,hlm_current_day,'thresh',dayl_thresh,'dayl',bc_in%dayl_si,'prev dayl',bc_in%prev_dayl_si
if (bc_in%dayl_si <= dayl_thresh .and. bc_in%dayl_si < bc_in%prev_dayl_si) then ! prev: 46260._r8
if (cohort_in%hard_level_prev >= target_h) then
cohort_in%hard_level = cohort_in%hard_level_prev - rate_h
else
cohort_in%hard_level = cohort_in%hard_level_prev ! now dehardening is not possible in autumn but the hardiness level is also allowed to remain steady
end if
!write(fates_log(),*) hlm_current_year,hlm_current_month,hlm_current_day,'hard_prev',cohort_in%hard_level_prev,'target',target_h,'rate',rate_h
else if (bc_in%dayl_si > dayl_thresh .and. bc_in%dayl_si < bc_in%prev_dayl_si) then
cohort_in%hard_level = min_h
end if
ipft = cohort_in%pft
!if (prt_params%season_decid(ipft) == itrue .and. cohort_in%status_coh == leaves_on .and. bc_in%dayl_si > bc_in%prev_dayl_si .and. &
! (nint(hlm_model_day) >= currentSite%cleafondate .or. nint(hlm_model_day) >= currentSite%dleafondate)) then
! cohort_in%hard_level = min_h
!end if
if (prt_params%season_decid(ipft) == itrue .and. cohort_in%status_coh == leaves_on .and. bc_in%dayl_si > bc_in%prev_dayl_si .and. &
(nint(hlm_model_day) >= currentSite%cleafondate .or. nint(hlm_model_day) >= currentSite%dleafondate)) then
cohort_in%hard_level = min_h
!write(fates_log(),*) hlm_current_year,hlm_current_month,hlm_current_day,'leaves_on'
end if
if (cohort_in%hard_level > min_h) then
cohort_in%hard_level = min_h
end if
Expand Down
72 changes: 67 additions & 5 deletions biogeochem/EDPhysiologyMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module EDPhysiologyMod
use FatesInterfaceTypesMod, only : hlm_day_of_year
use FatesInterfaceTypesMod, only : numpft
use FatesInterfaceTypesMod, only : nleafage
use FatesInterfaceTypesMod, only : hlm_use_planthydro
use FatesInterfaceTypesMod, only : hlm_use_planthydro,hlm_use_hydrohard
use FatesInterfaceTypesMod, only : hlm_parteh_mode
use FatesInterfaceTypesMod, only : hlm_use_fixed_biogeog
use FatesInterfaceTypesMod, only : hlm_use_nocomp
Expand Down Expand Up @@ -1108,11 +1108,11 @@ subroutine phenology_leafonoff(currentSite)
! COLD LEAF ON
! The site level flags signify that it is no-longer too cold
! for leaves. Time to signal flushing

if (prt_params%season_decid(ipft) == itrue)then
if (hlm_use_hydrohard .eq. itrue) then
if ( currentSite%cstatus == phen_cstat_notcold )then ! we have just moved to leaves being on .
!max_h=min(max(EDPftvarcon_inst%freezetol(currentCohort%pft),max(currentSite%hardtemp,-60._r8)-10._r8),-2._r8)
!if ( currentSite%hard_level2(ipft) > max_h/2._r8)then ! we have just moved to leaves being on . marius
max_h=min(max(EDPftvarcon_inst%freezetol(currentCohort%pft),max(currentSite%hardtemp,-60._r8)-10._r8),-2._r8)
if ( currentSite%hard_level2(ipft) > max_h/2._r8)then ! we have just moved to leaves being on . marius
if (currentCohort%status_coh == leaves_off)then ! Are the leaves currently off?
currentCohort%status_coh = leaves_on ! Leaves are on, so change status to
! stop flow of carbon out of bstore.
Expand Down Expand Up @@ -1168,8 +1168,70 @@ subroutine phenology_leafonoff(currentSite)

endif
endif !pft phenology
!endif !marius
endif !marius
endif ! growing season
else !marius
if ( currentSite%cstatus == phen_cstat_notcold )then ! we have just moved to leaves being on .
if (currentCohort%status_coh == leaves_off)then ! Are the leaves currently off?
currentCohort%status_coh = leaves_on ! Leaves are on, so change status to
! stop flow of carbon out of bstore.

if(store_c>nearzero) then
! flush either the amount required from the laimemory, or -most- of the storage pool
! RF: added a criterion to stop the entire store pool emptying and triggering termination mortality
! n.b. this might not be necessary if we adopted a more gradual approach to leaf flushing...
store_c_transfer_frac = min((EDPftvarcon_inst%phenflush_fraction(ipft)* &
currentCohort%laimemory)/store_c,(1.0_r8-carbon_store_buffer))

if(prt_params%woody(ipft).ne.itrue)then
totalmemory=currentCohort%laimemory+currentCohort%sapwmemory+currentCohort%structmemory
store_c_transfer_frac = min((EDPftvarcon_inst%phenflush_fraction(ipft)* &
totalmemory)/store_c, (1.0_r8-carbon_store_buffer))
endif

else
store_c_transfer_frac = 0.0_r8
end if

! This call will request that storage carbon will be transferred to
! leaf tissues. It is specified as a fraction of the available storage
if(prt_params%woody(ipft) == itrue) then

call PRTPhenologyFlush(currentCohort%prt, ipft, leaf_organ, store_c_transfer_frac)
currentCohort%laimemory = 0.0_r8

else

! Check that the stem drop fraction is set to non-zero amount otherwise flush all carbon store to leaves
if (stem_drop_fraction .gt. 0.0_r8) then

call PRTPhenologyFlush(currentCohort%prt, ipft, leaf_organ, &
store_c_transfer_frac*currentCohort%laimemory/totalmemory)

call PRTPhenologyFlush(currentCohort%prt, ipft, sapw_organ, &
store_c_transfer_frac*currentCohort%sapwmemory/totalmemory)

call PRTPhenologyFlush(currentCohort%prt, ipft, struct_organ, &
store_c_transfer_frac*currentCohort%structmemory/totalmemory)

else

call PRTPhenologyFlush(currentCohort%prt, ipft, leaf_organ, &
store_c_transfer_frac)

end if

currentCohort%laimemory = 0.0_r8
currentCohort%structmemory = 0.0_r8
currentCohort%sapwmemory = 0.0_r8

endif
endif !pft phenology
endif ! growing season
endif !marius




!COLD LEAF OFF
if (currentSite%cstatus == phen_cstat_nevercold .or. &
Expand Down
4 changes: 4 additions & 0 deletions biogeophys/FatesPlantHydraulicsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2549,6 +2549,7 @@ subroutine hydraulics_bc ( nsites, sites, bc_in, bc_out, dtime)

! Zero out diagnotsics that rely on accumulation
csite_hydr%sapflow_scpf(:,:) = 0._r8
csite_hydr%rootuptake_scpf(:,:) = 0._r8
csite_hydr%rootuptake_sl(:) = 0._r8
csite_hydr%rootuptake0_scpf(:,:) = 0._r8
csite_hydr%rootuptake10_scpf(:,:) = 0._r8
Expand Down Expand Up @@ -2730,6 +2731,9 @@ subroutine hydraulics_bc ( nsites, sites, bc_in, bc_out, dtime)
! These are normalized by depth (in case the desired horizon extends
! beyond the actual rhizosphere)

csite_hydr%rootuptake_scpf(sc,ft) = csite_hydr%rootuptake_scpf(sc,ft) + & !marius
SumBetweenDepths(csite_hydr,0._r8,1.e10_r8,rootuptake(1:nlevrhiz))*ccohort%n/dtime

csite_hydr%rootuptake0_scpf(sc,ft) = csite_hydr%rootuptake0_scpf(sc,ft) + &
SumBetweenDepths(csite_hydr,0._r8,0.1_r8,rootuptake(1:nlevrhiz))*ccohort%n/dtime

Expand Down
4 changes: 2 additions & 2 deletions main/EDMainMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -345,10 +345,10 @@ subroutine ed_integrate_state_variables(currentSite, bc_in, bc_out )
if (hlm_use_hydrohard.eq.itrue .or. hlm_use_frosthard.eq.itrue) then
currentSite%Tmin_24_fates=bc_in%tmin24_si-273.15_r8
if (nint(hlm_model_day)>=366) then
write(fates_log(),*) '5yrmean was taken'
write(fates_log(),*) '5yrmean was taken',bc_in%t_mean_5yr_si,bc_in%t_min_yr_inst_si
currentSite%hardtemp=bc_in%t_mean_5yr_si-273.15_r8
else if (nint(hlm_model_day)<366) then
write(fates_log(),*) 'minyrinst was taken'
!write(fates_log(),*) 'minyrinst was taken'
currentSite%hardtemp=bc_in%t_min_yr_inst_si-273.15_r8
end if
currentPatch => currentSite%youngest_patch
Expand Down
14 changes: 13 additions & 1 deletion main/FatesHistoryInterfaceMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,8 @@ module FatesHistoryInterfaceMod
integer :: ih_hard_level2_si_pft
integer :: ih_hardlevel_si_pft !marius
integer :: ih_Tmin_24_fates_si !marius

integer :: ih_lai_canopy_si_scpf

! Hydro: Soil water states
integer :: ih_rootwgt_soilvwc_si
integer :: ih_rootwgt_soilvwcsat_si
Expand Down Expand Up @@ -2028,6 +2029,7 @@ subroutine update_history_dyn(this,nc,nsites,sites)
hio_hardtemp_si => this%hvars(ih_hardtemp_si)%r81d, & !marius
hio_hard_level2_si_pft => this%hvars(ih_hard_level2_si_pft)%r82d, &
hio_Tmin_24_fates_si => this%hvars(ih_Tmin_24_fates_si)%r81d, & !marius
hio_lai_canopy_si_scpf => this%hvars(ih_lai_canopy_si_scpf)%r82d, &
hio_site_ncolddays_si => this%hvars(ih_site_ncolddays_si)%r81d, &
hio_site_nchilldays_si => this%hvars(ih_site_nchilldays_si)%r81d, &
hio_cleafoff_si => this%hvars(ih_cleafoff_si)%r81d, &
Expand Down Expand Up @@ -2688,6 +2690,8 @@ subroutine update_history_dyn(this,nc,nsites,sites)
store_m * ccohort%n / m2_per_ha
hio_bleaf_canopy_si_scpf(io_si,scpf) = hio_bleaf_canopy_si_scpf(io_si,scpf) + &
leaf_m * ccohort%n / m2_per_ha
hio_lai_canopy_si_scpf(io_si,scpf) = hio_lai_canopy_si_scpf(io_si,scpf) + &
ccohort%treelai*ccohort%c_area * AREA_INV

hio_canopy_biomass_si(io_si) = hio_canopy_biomass_si(io_si) + n_perm2 * total_m

Expand Down Expand Up @@ -5881,6 +5885,14 @@ subroutine define_history_vars(this, initialize_variables)
ivar=ivar, initialize=initialize_variables, &
index = ih_bleaf_canopy_si_scpf)

call this%set_history_var(vname='FATES_LAI_CANOPY_SZPF', &
units = 'm2 m-2', &
long='Leaf area index (LAI) of canopy plants by pft/size', &
use_default='active', &
avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', upfreq=1, &
ivar=ivar, initialize=initialize_variables, &
index = ih_lai_canopy_si_scpf )

call this%set_history_var(vname='FATES_NPLANT_CANOPY_SZPF', units = 'm-2', &
long='number of canopy plants by size/pft per m2', &
use_default='inactive', avgflag='A', vtype=site_size_pft_r8, &
Expand Down

0 comments on commit d22471c

Please sign in to comment.