NGEET / fates

repository for the Functionally Assembled Terrestrial Ecosystem Simulator (FATES)
Other
100 stars 92 forks source link

Patch Fusion Metric: patch_pft_size_profile and its indexing #49

Closed rgknox closed 7 years ago

rgknox commented 8 years ago

Summary of Issue:

In the subroutine patch_pft_size_profile() of EDPatchDynamicsMod, the array pft_agb_profile(:,:) is filled with the integrated structural biomass of all cohorts that fall within its different size and pft classes (the two dimensions). This array is compared among patches as the metric for similarity when it comes time to decide which should fuse.

My expectation was that the largest of the size class bins in the array should be allotted to all of those cohorts greater than some maximum size class (currently defined as DBHMAX = 150cm). But, it seems like cohorts larger than this threshold are not contributing biomass to the largest bin, and are instead contributing to the second largest.

Could others confirm my interpretation please?

Could others agree/disagree that we should re-structure the array indexing so that diameters larger than DBHMAX are the sole inhabitants of of the highest index, and those of smaller sizes populate indices 1:N_DBH_BINS-1?

Code as it appears:

In EDTypesMode.F90:

real(r8) ::  pft_agb_profile(numpft_ed,n_dbh_bins)            ! binned above ground biomass, for patch fusion: KgC/m2

In EDPatchDynamicsMod.F90:

subroutine patch_pft_size_profile(cp_pnt)
    !
    ! !DESCRIPTION:
    !  Binned patch size profiles generated for patch fusion routine        
    !
    ! !USES:
    !
    ! !ARGUMENTS:
    type(ed_patch_type), target, intent(inout) :: cp_pnt
    !
    ! !LOCAL VARIABLES:
    type(ed_patch_type) , pointer  :: currentPatch
    type(ed_cohort_type), pointer  :: currentCohort
    real(r8) :: mind(N_DBH_BINS) ! Bottom of DBH bin 
    real(r8) :: maxd(N_DBH_BINS) ! Top of DBH bin
    real(r8) :: delta_dbh   ! Size of DBH bin
    integer  :: p    ! Counter for PFT 
    integer  :: j    ! Counter for DBH bins 
    !---------------------------------------------------------------------

    currentPatch => cp_pnt

    delta_dbh = (DBHMAX/N_DBH_BINS)

    do p = 1,numpft_ed
       do j = 1,N_DBH_BINS
          currentPatch%pft_agb_profile(p,j) = 0.0_r8
       enddo
    enddo

    do j = 1,N_DBH_BINS   
        if (j == 1) then
           mind(j) = 0.0_r8
           maxd(j) = delta_dbh
        else 
           mind(j) = (j-1) * delta_dbh
           maxd(j) = (j)*delta_dbh
        endif
    enddo

    currentCohort => currentPatch%shortest
    do while(associated(currentCohort))    
       do j = 1,N_DBH_BINS   
          if((currentCohort%dbh  >  mind(j)) .AND. (currentCohort%dbh  <=  maxd(j)))then

             currentPatch%pft_agb_profile(currentCohort%pft,j) = currentPatch%pft_agb_profile(currentCohort%pft,j) + &
                  currentCohort%bdead*currentCohort%n/currentPatch%area

          endif
       enddo ! dbh bins

       ! Deal with largest dbh bin
       j = N_DBH_BINS-1
       if(currentCohort%dbh  >  j*delta_dbh)then

          currentPatch%pft_agb_profile(currentCohort%pft,j) = currentPatch%pft_agb_profile(currentCohort%pft,j) + &
               currentCohort%bdead*currentCohort%n/currentPatch%area

       endif !  

       currentCohort => currentCohort%taller

    enddo !currentCohort 

  end subroutine patch_pft_size_profile

What is the changeset ID of the code, and the machine you are using: 763a722

Screen output or output files showing the error message and context:

ckoven commented 7 years ago

is this still a problem, and if so, can we add it to the to-do list?

ckoven commented 7 years ago

ok, @rgknox and i just checked, and it looks like we fixed this ages ago. closing.