Skip to content

Commit

Permalink
Merge pull request #1091 from JessicaNeedham/hitefix
Browse files Browse the repository at this point in the history
Change all 'hite' to 'height'
  • Loading branch information
glemieux authored Oct 10, 2023
2 parents 21e18c6 + 8733caf commit a3048a6
Show file tree
Hide file tree
Showing 14 changed files with 110 additions and 110 deletions.
58 changes: 29 additions & 29 deletions biogeochem/EDCanopyStructureMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ subroutine canopy_structure( currentSite , bc_in )
if(currentCohort%canopy_layer .eq. 2)then
if (associated(currentCohort%taller)) then
if (currentCohort%taller%canopy_layer .eq. 1 ) then
currentPatch%zstar = currentCohort%taller%hite
currentPatch%zstar = currentCohort%taller%height
endif
endif
endif
Expand Down Expand Up @@ -407,7 +407,7 @@ subroutine DemoteFromLayer(currentSite,currentPatch,i_lyr,bc_in)
! to the understory.
! ----------------------------------------------------------

currentCohort%excl_weight = 1._r8 / (currentCohort%hite**ED_val_comp_excln)
currentCohort%excl_weight = 1._r8 / (currentCohort%height**ED_val_comp_excln)
sumweights = sumweights + currentCohort%excl_weight

else
Expand All @@ -428,7 +428,7 @@ subroutine DemoteFromLayer(currentSite,currentPatch,i_lyr,bc_in)
tied_size_with_neighbors = .false.
nextc => currentCohort%taller
do while (associated(nextc))
if ( abs(nextc%hite - currentCohort%hite) < similar_height_tol ) then
if ( abs(nextc%height - currentCohort%height) < similar_height_tol ) then
if( nextc%canopy_layer .eq. currentCohort%canopy_layer ) then
tied_size_with_neighbors = .true.
total_crownarea_of_tied_cohorts = &
Expand All @@ -451,7 +451,7 @@ subroutine DemoteFromLayer(currentSite,currentPatch,i_lyr,bc_in)

nextc => currentCohort%taller
do while (associated(nextc))
if ( abs(nextc%hite - currentCohort%hite) < similar_height_tol ) then
if ( abs(nextc%height - currentCohort%height) < similar_height_tol ) then
if (nextc%canopy_layer .eq. currentCohort%canopy_layer ) then
! now we know the total crown area of all equal-sized,
! equal-canopy-layer cohorts
Expand Down Expand Up @@ -891,7 +891,7 @@ subroutine PromoteIntoLayer(currentSite,currentPatch,i_lyr)
! Stochastic case, as above (in demotion portion of code)
! ------------------------------------------------------------------

currentCohort%prom_weight = currentCohort%hite**ED_val_comp_excln
currentCohort%prom_weight = currentCohort%height**ED_val_comp_excln
sumweights = sumweights + currentCohort%prom_weight
else

Expand All @@ -910,7 +910,7 @@ subroutine PromoteIntoLayer(currentSite,currentPatch,i_lyr)
tied_size_with_neighbors = .false.
nextc => currentCohort%shorter
do while (associated(nextc))
if ( abs(nextc%hite - currentCohort%hite) < similar_height_tol ) then
if ( abs(nextc%height - currentCohort%height) < similar_height_tol ) then
if( nextc%canopy_layer .eq. currentCohort%canopy_layer ) then
tied_size_with_neighbors = .true.
total_crownarea_of_tied_cohorts = &
Expand All @@ -932,7 +932,7 @@ subroutine PromoteIntoLayer(currentSite,currentPatch,i_lyr)

nextc => currentCohort%shorter
do while (associated(nextc))
if ( abs(nextc%hite - currentCohort%hite) < similar_height_tol ) then
if ( abs(nextc%height - currentCohort%height) < similar_height_tol ) then
if (nextc%canopy_layer .eq. currentCohort%canopy_layer ) then
! now we know the total crown area of all equal-sized,
! equal-canopy-layer cohorts
Expand Down Expand Up @@ -1499,7 +1499,7 @@ subroutine leaf_area_profile( currentSite )

! !USES:

use EDtypesMod , only : area, hitemax, n_hite_bins
use EDtypesMod , only : area, heightmax, n_height_bins
use EDParamsMod, only : dinc_vai, dlower_vai

!
Expand All @@ -1517,14 +1517,14 @@ subroutine leaf_area_profile( currentSite )
integer :: iv ! Vertical leaf layer index
integer :: cl ! Canopy layer index
real(r8) :: fraction_exposed ! how much of this layer is not covered by snow?
real(r8) :: layer_top_hite ! notional top height of this canopy layer (m)
real(r8) :: layer_bottom_hite ! notional bottom height of this canopy layer (m)
real(r8) :: frac_canopy(N_HITE_BINS) ! amount of canopy in each height class
real(r8) :: minh(N_HITE_BINS) ! minimum height in height class (m)
real(r8) :: maxh(N_HITE_BINS) ! maximum height in height class (m)
real(r8) :: layer_top_height ! notional top height of this canopy layer (m)
real(r8) :: layer_bottom_height ! notional bottom height of this canopy layer (m)
real(r8) :: frac_canopy(N_HEIGHT_BINS) ! amount of canopy in each height class
real(r8) :: minh(N_HEIGHT_BINS) ! minimum height in height class (m)
real(r8) :: maxh(N_HEIGHT_BINS) ! maximum height in height class (m)
real(r8) :: dh ! vertical detph of height class (m)
real(r8) :: min_chite ! bottom of cohort canopy (m)
real(r8) :: max_chite ! top of cohort canopy (m)
real(r8) :: min_cheight ! bottom of cohort canopy (m)
real(r8) :: max_cheight ! top of cohort canopy (m)
real(r8) :: lai ! leaf area per canopy area
real(r8) :: sai ! stem area per canopy area

Expand Down Expand Up @@ -1615,25 +1615,25 @@ subroutine leaf_area_profile( currentSite )
! We calculate the absolute elevation of each layer to help determine if the layer
! is obscured by snow.

layer_top_hite = currentCohort%hite - &
( real(iv-1,r8)/currentCohort%NV * currentCohort%hite * &
layer_top_height = currentCohort%height - &
( real(iv-1,r8)/currentCohort%NV * currentCohort%height * &
prt_params%crown_depth_frac(currentCohort%pft) )

layer_bottom_hite = currentCohort%hite - &
( real(iv,r8)/currentCohort%NV * currentCohort%hite * &
layer_bottom_height = currentCohort%height - &
( real(iv,r8)/currentCohort%NV * currentCohort%height * &
prt_params%crown_depth_frac(currentCohort%pft) )

fraction_exposed = 1.0_r8
if(currentSite%snow_depth > layer_top_hite)then
if(currentSite%snow_depth > layer_top_height)then
fraction_exposed = 0._r8
endif
if(currentSite%snow_depth < layer_bottom_hite)then
if(currentSite%snow_depth < layer_bottom_height)then
fraction_exposed = 1._r8
endif
if(currentSite%snow_depth >= layer_bottom_hite .and. &
currentSite%snow_depth <= layer_top_hite) then !only partly hidden...
fraction_exposed = 1._r8 - max(0._r8,(min(1.0_r8,(currentSite%snow_depth -layer_bottom_hite)/ &
(layer_top_hite-layer_bottom_hite ))))
if(currentSite%snow_depth >= layer_bottom_height .and. &
currentSite%snow_depth <= layer_top_height) then !only partly hidden...
fraction_exposed = 1._r8 - max(0._r8,(min(1.0_r8,(currentSite%snow_depth -layer_bottom_height)/ &
(layer_top_height-layer_bottom_height ))))
endif

if(iv==currentCohort%NV) then
Expand Down Expand Up @@ -1669,7 +1669,7 @@ subroutine leaf_area_profile( currentSite )

currentPatch%layer_height_profile(cl,ft,iv) = currentPatch%layer_height_profile(cl,ft,iv) + &
(remainder * fleaf * currentCohort%c_area/currentPatch%total_canopy_area * &
(layer_top_hite+layer_bottom_hite)/2.0_r8) !average height of layer.
(layer_top_height+layer_bottom_height)/2.0_r8) !average height of layer.

end do

Expand Down Expand Up @@ -1850,7 +1850,7 @@ subroutine update_hlm_dynamics(nsites,sites,fcolumn,bc_out)
endif

if (associated(currentPatch%tallest)) then
bc_out(s)%htop_pa(ifp) = currentPatch%tallest%hite
bc_out(s)%htop_pa(ifp) = currentPatch%tallest%height
else
! FIX(RF,040113) - should this be a parameter for the minimum possible vegetation height?
bc_out(s)%htop_pa(ifp) = 0.1_r8
Expand All @@ -1870,9 +1870,9 @@ subroutine update_hlm_dynamics(nsites,sites,fcolumn,bc_out)
if (currentCohort%canopy_layer .eq. 1) then
weight = min(1.0_r8,currentCohort%c_area/currentPatch%total_canopy_area)
bc_out(s)%z0m_pa(ifp) = bc_out(s)%z0m_pa(ifp) + &
EDPftvarcon_inst%z0mr(currentCohort%pft) * currentCohort%hite * weight
EDPftvarcon_inst%z0mr(currentCohort%pft) * currentCohort%height * weight
bc_out(s)%displa_pa(ifp) = bc_out(s)%displa_pa(ifp) + &
EDPftvarcon_inst%displar(currentCohort%pft) * currentCohort%hite * weight
EDPftvarcon_inst%displar(currentCohort%pft) * currentCohort%height * weight
endif
currentCohort => currentCohort%taller
end do
Expand Down
44 changes: 22 additions & 22 deletions biogeochem/EDCohortDynamicsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ Module EDCohortDynamicsMod
contains

!-------------------------------------------------------------------------------------!
subroutine create_cohort(currentSite, patchptr, pft, nn, hite, coage, dbh, &
subroutine create_cohort(currentSite, patchptr, pft, nn, height, coage, dbh, &
prt, elongf_leaf, elongf_fnrt, elongf_stem, status, recruitstatus, ctrim, &
carea, clayer, crowndamage, spread, bc_in)

Expand All @@ -182,7 +182,7 @@ subroutine create_cohort(currentSite, patchptr, pft, nn, hite, coage, dbh, &
integer, intent(in) :: status ! growth status of plant [1=leaves off; 2=leaves on]
integer, intent(in) :: recruitstatus ! recruit status of plant [1 = recruitment , 0 = other]
real(r8), intent(in) :: nn ! number of individuals in cohort [/m2]
real(r8), intent(in) :: hite ! cohort height [m]
real(r8), intent(in) :: height ! cohort height [m]
real(r8), intent(in) :: coage ! cohort age [m]
real(r8), intent(in) :: dbh ! cohort diameter at breast height [cm]
real(r8), intent(in) :: elongf_leaf ! leaf elongation factor [fraction] - 0: fully abscissed; 1: fully flushed
Expand All @@ -206,7 +206,7 @@ subroutine create_cohort(currentSite, patchptr, pft, nn, hite, coage, dbh, &

! create new cohort
allocate(newCohort)
call newCohort%Create(prt, pft, nn, hite, coage, dbh, status, ctrim, carea, &
call newCohort%Create(prt, pft, nn, height, coage, dbh, status, ctrim, carea, &
clayer, crowndamage, spread, patchptr%canopy_layer_tlai, elongf_leaf, elongf_fnrt, &
elongf_stem)

Expand Down Expand Up @@ -247,7 +247,7 @@ subroutine create_cohort(currentSite, patchptr, pft, nn, hite, coage, dbh, &

! This calculates node heights
call UpdatePlantHydrNodes(newCohort, newCohort%pft, &
newCohort%hite,currentSite%si_hydr)
newCohort%height,currentSite%si_hydr)

! This calculates volumes and lengths
call UpdatePlantHydrLenVol(newCohort,currentSite%si_hydr)
Expand Down Expand Up @@ -834,7 +834,7 @@ subroutine fuse_cohorts(currentSite, currentPatch, bc_in)
write(fates_log(),*) 'Cohort I, Cohort II'
write(fates_log(),*) 'n:',currentCohort%n,nextc%n
write(fates_log(),*) 'isnew:',currentCohort%isnew,nextc%isnew
write(fates_log(),*) 'hite:',currentCohort%hite,nextc%hite
write(fates_log(),*) 'height:',currentCohort%height,nextc%height
write(fates_log(),*) 'coage:',currentCohort%coage,nextc%coage
write(fates_log(),*) 'dbh:',currentCohort%dbh,nextc%dbh
write(fates_log(),*) 'pft:',currentCohort%pft,nextc%pft
Expand Down Expand Up @@ -937,7 +937,7 @@ subroutine fuse_cohorts(currentSite, currentPatch, bc_in)
call ForceDBH( currentCohort%pft, currentCohort%crowndamage, &
currentCohort%canopy_trim, &
currentCohort%efleaf_coh, currentCohort%efstem_coh, &
currentCohort%dbh, currentCohort%hite, &
currentCohort%dbh, currentCohort%height, &
bdead = currentCohort%prt%GetState(struct_organ,carbon12_element))

end if
Expand All @@ -950,7 +950,7 @@ subroutine fuse_cohorts(currentSite, currentPatch, bc_in)
endif

!
call h_allom(currentCohort%dbh,currentCohort%pft,currentCohort%hite)
call h_allom(currentCohort%dbh,currentCohort%pft,currentCohort%height)
!
case(conserve_dbh_and_number_not_crownarea)
!
Expand All @@ -962,7 +962,7 @@ subroutine fuse_cohorts(currentSite, currentPatch, bc_in)
currentCohort%dbh = (currentCohort%n*currentCohort%dbh &
+ nextc%n*nextc%dbh)/newn
!
call h_allom(currentCohort%dbh,currentCohort%pft,currentCohort%hite)
call h_allom(currentCohort%dbh,currentCohort%pft,currentCohort%height)
!
! -----------------------------------------------------------------
! If fusion pushed structural biomass to be larger than
Expand All @@ -976,7 +976,7 @@ subroutine fuse_cohorts(currentSite, currentPatch, bc_in)
call ForceDBH( currentCohort%pft, currentCohort%crowndamage, &
currentCohort%canopy_trim, &
currentCohort%efleaf_coh, currentCohort%efstem_coh, &
currentCohort%dbh, currentCohort%hite, &
currentCohort%dbh, currentCohort%height, &
bdead = currentCohort%prt%GetState(struct_organ,carbon12_element))

end if
Expand Down Expand Up @@ -1163,7 +1163,7 @@ subroutine fuse_cohorts(currentSite, currentPatch, bc_in)
endif

! At this point, nothing should be pointing to current Cohort
! update hydraulics quantities that are functions of hite & biomasses
! update hydraulics quantities that are functions of height & biomasses
! deallocate the hydro structure of nextc
if (hlm_use_planthydro.eq.itrue) then
call UpdateSizeDepPlantHydProps(currentSite,currentCohort, bc_in)
Expand Down Expand Up @@ -1358,15 +1358,15 @@ subroutine insert_cohort(currentPatch, pcc, ptall, pshort, tnull, snull, storebi
icohort => pcc ! assign address to icohort local name
!place in the correct place in the linked list of heights
!begin by finding cohort that is just taller than the new cohort
tsp = icohort%hite
tsp = icohort%height

current => pshortest
exitloop = 0
!starting with shortest tree on the grid, find tree just
!taller than tree being considered and return its pointer
if (associated(current)) then
do while (associated(current).and.exitloop == 0)
if (current%hite < tsp) then
if (current%height < tsp) then
current => current%taller
else
exitloop = 1
Expand Down Expand Up @@ -1471,7 +1471,7 @@ end subroutine count_cohorts
! ===================================================================================


subroutine EvaluateAndCorrectDBH(currentCohort,delta_dbh,delta_hite)
subroutine EvaluateAndCorrectDBH(currentCohort,delta_dbh,delta_height)

! -----------------------------------------------------------------------------------
! If the current diameter of a plant is somehow less than what is allometrically
Expand All @@ -1482,7 +1482,7 @@ subroutine EvaluateAndCorrectDBH(currentCohort,delta_dbh,delta_hite)
! argument
type(fates_cohort_type),intent(inout) :: currentCohort
real(r8),intent(out) :: delta_dbh
real(r8),intent(out) :: delta_hite
real(r8),intent(out) :: delta_height

! locals
real(r8) :: dbh
Expand All @@ -1496,7 +1496,7 @@ subroutine EvaluateAndCorrectDBH(currentCohort,delta_dbh,delta_hite)
real(r8) :: target_struct_c
real(r8) :: target_leaf_c
real(r8) :: struct_c
real(r8) :: hite_out
real(r8) :: height_out
real(r8) :: leaf_c
real(r8) :: crown_reduction
real(r8) :: elongf_leaf
Expand All @@ -1510,7 +1510,7 @@ subroutine EvaluateAndCorrectDBH(currentCohort,delta_dbh,delta_hite)
elongf_stem = currentCohort%efstem_coh

delta_dbh = 0._r8
delta_hite = 0._r8
delta_height = 0._r8

if( prt_params%woody(currentCohort%pft) == itrue) then

Expand Down Expand Up @@ -1539,12 +1539,12 @@ subroutine EvaluateAndCorrectDBH(currentCohort,delta_dbh,delta_hite)
if( (struct_c - target_struct_c ) > calloc_abs_error ) then

call ForceDBH( ipft,icrowndamage,canopy_trim, elongf_leaf, elongf_stem, &
dbh, hite_out, bdead=struct_c)
dbh, height_out, bdead=struct_c)

delta_dbh = dbh - currentCohort%dbh
delta_hite = hite_out - currentCohort%hite
delta_height = height_out - currentCohort%height
currentCohort%dbh = dbh
currentCohort%hite = hite_out
currentCohort%height = height_out
end if

else
Expand All @@ -1557,11 +1557,11 @@ subroutine EvaluateAndCorrectDBH(currentCohort,delta_dbh,delta_hite)

if( ( leaf_c - target_leaf_c ) > calloc_abs_error ) then
call ForceDBH( ipft, icrowndamage, canopy_trim, elongf_leaf, elongf_stem, &
dbh, hite_out, bl=leaf_c )
dbh, height_out, bl=leaf_c )
delta_dbh = dbh - currentCohort%dbh
delta_hite = hite_out - currentCohort%hite
delta_height = height_out - currentCohort%height
currentCohort%dbh = dbh
currentCohort%hite = hite_out
currentCohort%height = height_out
end if

end if
Expand Down
Loading

0 comments on commit a3048a6

Please sign in to comment.