diff --git a/biogeochem/EDPatchDynamicsMod.F90 b/biogeochem/EDPatchDynamicsMod.F90 index 0529b20f9f..cda0dd5b92 100644 --- a/biogeochem/EDPatchDynamicsMod.F90 +++ b/biogeochem/EDPatchDynamicsMod.F90 @@ -448,8 +448,9 @@ subroutine spawn_patches( currentSite, bc_in) type (ed_cohort_type), pointer :: storesmallcohort type (ed_cohort_type), pointer :: storebigcohort real(r8) :: site_areadis_primary ! total area disturbed (to primary forest) in m2 per site per day - real(r8) :: site_areadis_secondary ! total area disturbed (to secondary forest) in m2 per site per day + real(r8) :: site_areadis_secondary ! total area disturbed (to secondary forest) in m2 per site per day real(r8) :: patch_site_areadis ! total area disturbed in m2 per patch per day + real(r8) :: site_areadis ! total site area disturbed in m2 per day real(r8) :: age ! notional age of this patch in years integer :: el ! element loop index integer :: tnull ! is there a tallest cohort? @@ -467,6 +468,10 @@ subroutine spawn_patches( currentSite, bc_in) logical :: found_youngest_primary ! logical for finding the first primary forest patch integer :: min_nocomp_pft, max_nocomp_pft, i_nocomp_pft integer :: i_disturbance_type, i_dist2 ! iterators for looping over disturbance types + integer :: i_landusechange_type ! iterator for the land use change types + integer :: i_donorpatch_landuse_type ! iterator for the land use change types donor patch + integer :: n_luctype ! pass through variable for number of landuse types + integer :: receiver_patch_lu_label ! pass through variable for reciever patch land use type label real(r8) :: disturbance_rate ! rate of disturbance being resolved [fraction of patch area / day] real(r8) :: oldarea ! old patch area prior to disturbance logical :: clearing_matrix(n_landuse_cats,n_landuse_cats) ! do we clear vegetation when transferring from one LU type to another? @@ -643,7 +648,7 @@ subroutine spawn_patches( currentSite, bc_in) ! CDK what do we do here for land use transitions? - select case(disturbance_type) + select case(i_disturbance_type) case (dtype_ilog) call logging_litter_fluxes(currentSite, currentPatch, & new_patch, patch_site_areadis,bc_in) @@ -715,7 +720,7 @@ subroutine spawn_patches( currentSite, bc_in) store_c = currentCohort%prt%GetState(store_organ, carbon12_element) total_c = sapw_c + struct_c + leaf_c + fnrt_c + store_c - disttype_case: select case(disturbance_type) + disttype_case: select case(i_disturbance_type) ! treefall mortality is the current disturbance case (dtype_ifall) @@ -1159,13 +1164,13 @@ subroutine spawn_patches( currentSite, bc_in) currentPatch%disturbance_rates(i_dist2) = currentPatch%disturbance_rates(i_dist2) & * oldarea / currentPatch%area end do - do i_dist = 1,n_landuse_cats - currentPatch%landuse_transition_rates(i_dist) = currentPatch%landuse_transition_rates(i_dist) & + do i_dist2 = 1,n_landuse_cats + currentPatch%landuse_transition_rates(i_dist2) = currentPatch%landuse_transition_rates(i_dist2) & * oldarea / currentPatch%area end do else - do i_dist = i_lu_change+1,n_landuse_cats - currentPatch%landuse_transition_rates(i_dist) = currentPatch%landuse_transition_rates(i_dist) & + do i_dist2 = i_landusechange_type+1,n_landuse_cats + currentPatch%landuse_transition_rates(i_dist2) = currentPatch%landuse_transition_rates(i_dist2) & * oldarea / currentPatch%area end do end if @@ -2654,8 +2659,8 @@ subroutine fuse_patches( csite, bc_in ) call endrun(msg=errMsg(sourcefile, __LINE__)) endif else - maxpatches(primaryland) = maxpatch_primary - maxpatches(secondaryland) = maxpatch_secondary + maxpatches(primaryland) = maxpatch_primaryland + maxpatches(secondaryland) = maxpatch_secondaryland maxpatches(cropland) = maxpatch_cropland maxpatches(pastureland) = maxpatch_pastureland maxpatches(rangeland) = maxpatch_rangeland diff --git a/main/EDInitMod.F90 b/main/EDInitMod.F90 index 7a8fefa149..c24d0041cc 100644 --- a/main/EDInitMod.F90 +++ b/main/EDInitMod.F90 @@ -9,7 +9,8 @@ module EDInitMod use FatesConstantsMod , only : itrue use FatesConstantsMod , only : fates_unset_int use FatesConstantsMod , only : primaryland - use FatesConstantsMod , only : nearzero + use FatesConstantsMod , only : nearzero + use FatesConstantsMod , only : n_landuse_cats use FatesGlobals , only : endrun => fates_endrun use EDTypesMod , only : nclmax use FatesGlobals , only : fates_log @@ -520,12 +521,13 @@ subroutine init_patches( nsites, sites, bc_in) integer :: start_patch integer :: num_new_patches integer :: nocomp_pft - real(r8) :: newparea + real(r8) :: newparea, newparea_withlanduse real(r8) :: tota !check on area integer :: is_first_patch integer :: n_luh_states integer :: luh_state_counter real(r8) :: state_vector(n_landuse_cats) ! [m2/m2] + integer :: i_lu, i_lu_state type(ed_site_type), pointer :: sitep diff --git a/main/FatesHistoryInterfaceMod.F90 b/main/FatesHistoryInterfaceMod.F90 index 91a8a35e85..2cb00d549c 100644 --- a/main/FatesHistoryInterfaceMod.F90 +++ b/main/FatesHistoryInterfaceMod.F90 @@ -302,9 +302,11 @@ module FatesHistoryInterfaceMod integer :: ih_growth_resp_secondary_si integer :: ih_primaryland_fusion_error_si - integer :: ih_disturbance_rate_p2p_si - integer :: ih_disturbance_rate_p2s_si - integer :: ih_disturbance_rate_s2s_si + ! integer :: ih_disturbance_rate_p2p_si + ! integer :: ih_disturbance_rate_p2s_si + ! integer :: ih_disturbance_rate_s2s_si + ! integer :: ih_disturbance_rate_si + integer :: ih_area_si_landuse integer :: ih_fire_disturbance_rate_si integer :: ih_logging_disturbance_rate_si integer :: ih_fall_disturbance_rate_si @@ -2342,9 +2344,9 @@ subroutine update_history_dyn(this,nc,nsites,sites,bc_in) hio_canopy_biomass_si => this%hvars(ih_canopy_biomass_si)%r81d, & hio_understory_biomass_si => this%hvars(ih_understory_biomass_si)%r81d, & hio_primaryland_fusion_error_si => this%hvars(ih_primaryland_fusion_error_si)%r81d, & - hio_disturbance_rate_p2p_si => this%hvars(ih_disturbance_rate_p2p_si)%r81d, & - hio_disturbance_rate_p2s_si => this%hvars(ih_disturbance_rate_p2s_si)%r81d, & - hio_disturbance_rate_s2s_si => this%hvars(ih_disturbance_rate_s2s_si)%r81d, & + ! hio_disturbance_rate_p2p_si => this%hvars(ih_disturbance_rate_p2p_si)%r81d, & + ! hio_disturbance_rate_p2s_si => this%hvars(ih_disturbance_rate_p2s_si)%r81d, & + ! hio_disturbance_rate_s2s_si => this%hvars(ih_disturbance_rate_s2s_si)%r81d, & hio_fire_disturbance_rate_si => this%hvars(ih_fire_disturbance_rate_si)%r81d, & hio_logging_disturbance_rate_si => this%hvars(ih_logging_disturbance_rate_si)%r81d, & hio_fall_disturbance_rate_si => this%hvars(ih_fall_disturbance_rate_si)%r81d, & @@ -5298,6 +5300,7 @@ subroutine define_history_vars(this, initialize_variables) use FatesIOVariableKindMod, only : site_scagpft_r8, site_agepft_r8 use FatesIOVariableKindMod, only : site_elem_r8, site_elpft_r8, site_clscpf_r8 use FatesIOVariableKindMod, only : site_elcwd_r8, site_elage_r8 + use FatesIOVariableKindMod, only : site_landuse_r8, site_lulu_r8 implicit none @@ -6313,26 +6316,26 @@ subroutine define_history_vars(this, initialize_variables) upfreq=1, ivar=ivar, initialize=initialize_variables, & index = ih_primaryland_fusion_error_si) - call this%set_history_var(vname='FATES_DISTURBANCE_RATE_P2P', & - units='m2 m-2 yr-1', & - long='disturbance rate from primary to primary lands', & - use_default='active', avgflag='A', vtype=site_r8, hlms='CLM:ALM', & - upfreq=1, ivar=ivar, initialize=initialize_variables, & - index = ih_disturbance_rate_p2p_si) - - call this%set_history_var(vname='FATES_DISTURBANCE_RATE_P2S', & - units='m2 m-2 yr-1', & - long='disturbance rate from primary to secondary lands', & - use_default='active', avgflag='A', vtype=site_r8, hlms='CLM:ALM', & - upfreq=1, ivar=ivar, initialize=initialize_variables, & - index = ih_disturbance_rate_p2s_si ) - - call this%set_history_var(vname='FATES_DISTURBANCE_RATE_S2S', & - units='m2 m-2 yr-1', & - long='disturbance rate from secondary to secondary lands', & - use_default='active', avgflag='A', vtype=site_r8, hlms='CLM:ALM', & - upfreq=1, ivar=ivar, initialize=initialize_variables, & - index = ih_disturbance_rate_s2s_si) + ! call this%set_history_var(vname='FATES_DISTURBANCE_RATE_P2P', & + ! units='m2 m-2 yr-1', & + ! long='disturbance rate from primary to primary lands', & + ! use_default='active', avgflag='A', vtype=site_r8, hlms='CLM:ALM', & + ! upfreq=1, ivar=ivar, initialize=initialize_variables, & + ! index = ih_disturbance_rate_p2p_si) + + ! call this%set_history_var(vname='FATES_DISTURBANCE_RATE_P2S', & + ! units='m2 m-2 yr-1', & + ! long='disturbance rate from primary to secondary lands', & + ! use_default='active', avgflag='A', vtype=site_r8, hlms='CLM:ALM', & + ! upfreq=1, ivar=ivar, initialize=initialize_variables, & + ! index = ih_disturbance_rate_p2s_si ) + + ! call this%set_history_var(vname='FATES_DISTURBANCE_RATE_S2S', & + ! units='m2 m-2 yr-1', & + ! long='disturbance rate from secondary to secondary lands', & + ! use_default='active', avgflag='A', vtype=site_r8, hlms='CLM:ALM', & + ! upfreq=1, ivar=ivar, initialize=initialize_variables, & + ! index = ih_disturbance_rate_s2s_si) call this%set_history_var(vname='FATES_DISTURBANCE_RATE_FIRE', & units='m2 m-2 yr-1', long='disturbance rate from fire', & diff --git a/main/FatesInterfaceMod.F90 b/main/FatesInterfaceMod.F90 index ed631fbb23..1c31e7ff2d 100644 --- a/main/FatesInterfaceMod.F90 +++ b/main/FatesInterfaceMod.F90 @@ -16,8 +16,8 @@ module FatesInterfaceMod use EDParamsMod , only : ED_val_vai_width_increase_factor use EDParamsMod , only : ED_val_history_damage_bin_edges use EDParamsMod , only : maxpatch_total - use EDParamsMod , only : maxpatch_primary - use EDParamsMod , only : maxpatch_secondary + use EDParamsMod , only : maxpatch_primaryland, maxpatch_secondaryland + use EDParamsMod , only : maxpatch_pastureland, maxpatch_rangeland, maxpatch_cropland use EDParamsMod , only : max_cohort_per_patch use EDTypesMod , only : maxSWb use EDTypesMod , only : ivis @@ -765,8 +765,11 @@ subroutine SetFatesGlobalElements1(use_fates,surf_numpft,surf_numcft) ! to hold all PFTs. So create the same number of ! patches as the number of PFTs - maxpatch_primary = fates_numpft - maxpatch_secondary = 0 + maxpatch_primaryland = fates_numpft + maxpatch_secondaryland = 0 + maxpatch_pastureland = 0 + maxpatch_rangeland = 0 + maxpatch_cropland = 0 maxpatch_total = fates_numpft ! If this is an SP run, we actually need enough patches on the @@ -781,13 +784,16 @@ subroutine SetFatesGlobalElements1(use_fates,surf_numpft,surf_numcft) else ! If we are using fixed biogeography or no-comp then we - ! can also apply those constraints to maxpatch_primary and secondary + ! can also apply those constraints to maxpatch_primaryland and secondary ! and that value will match fates_maxPatchesPerSite if(hlm_use_nocomp==itrue) then - maxpatch_primary = max(maxpatch_primary,fates_numpft) - maxpatch_total = maxpatch_primary + maxpatch_secondary + maxpatch_primaryland = max(maxpatch_primaryland,fates_numpft) + maxpatch_total = maxpatch_primaryland + maxpatch_secondaryland + & + maxpatch_pastureland + maxpatch_rangeland + & + maxpatch_cropland + !if(maxpatch_primary