From 8c8da99540ffc4a2f887368d4e8339192e433323 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Tue, 22 Jun 2021 12:06:02 -0600 Subject: [PATCH] Changed loop bounds in history writing to use actual rather than maximum canopy layers and leaf layers --- main/FatesHistoryInterfaceMod.F90 | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/main/FatesHistoryInterfaceMod.F90 b/main/FatesHistoryInterfaceMod.F90 index 97f3342b43..a7deb6fea4 100644 --- a/main/FatesHistoryInterfaceMod.F90 +++ b/main/FatesHistoryInterfaceMod.F90 @@ -3682,8 +3682,8 @@ subroutine update_history_hifrq(this,nc,nsites,sites,bc_in,dt_tstep) ! summarize radiation profiles through the canopy do ipft=1,numpft - do ican=1,nclmax ! cpatch%ncl_p ? - do ileaf=1,nlevleaf ! cpatch%ncan(ican,ipft) ? + do ican=1,cpatch%ncl_p + do ileaf=1,cpatch%ncan(ican,ipft) ! calculate where we are on multiplexed dimensions cnlfpft_indx = ileaf + (ican-1) * nlevleaf + (ipft-1) * nlevleaf * nclmax cnlf_indx = ileaf + (ican-1) * nlevleaf @@ -3756,11 +3756,12 @@ subroutine update_history_hifrq(this,nc,nsites,sites,bc_in,dt_tstep) cpatch%fabi_sha_z(ican,ipft,1) * cpatch%area * AREA_INV ! end do - end do + end do ! PFT-mean radiation profiles - do ican=1,nclmax - do ileaf=1,nlevleaf + do ican = 1, cpatch%ncl_p + do ileaf = 1, maxval(cpatch%nrad(ican,:)) + ! calculate where we are on multiplexed dimensions cnlf_indx = ileaf + (ican-1) * nlevleaf !