Skip to content

Commit 14aeb4f

Browse files
authored
Merge pull request #381 from rgknox/rgknox-soildepth-clm5
variable soil depth compatibility with CLM5
2 parents 1495bbb + 02792d0 commit 14aeb4f

15 files changed

+856
-493
lines changed

biogeochem/EDCanopyStructureMod.F90

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ subroutine DemoteFromLayer(currentSite,currentPatch,i_lyr)
393393

394394
allocate(copyc)
395395
if( hlm_use_planthydro.eq.itrue ) then
396-
call InitHydrCohort(copyc)
396+
call InitHydrCohort(currentSite,copyc)
397397
endif
398398
call copy_cohort(currentCohort, copyc) !
399399

@@ -722,7 +722,7 @@ subroutine PromoteIntoLayer(currentSite,currentPatch,i_lyr)
722722
if(cc_gain < currentCohort%c_area)then
723723
allocate(copyc)
724724
if( hlm_use_planthydro.eq.itrue ) then
725-
call InitHydrCohort(copyc)
725+
call InitHydrCohort(CurrentSite,copyc)
726726
endif
727727

728728
call copy_cohort(currentCohort, copyc) !makes an identical copy...
@@ -891,10 +891,11 @@ subroutine canopy_summarization( nsites, sites, bc_in )
891891

892892
use FatesInterfaceMod , only : bc_in_type
893893
use EDPatchDynamicsMod , only : set_patchno
894-
use EDPatchDynamicsMod , only : set_root_fraction
894+
use FatesAllometryMod , only : set_root_fraction
895+
use FatesAllometryMod , only : i_hydro_rootprof_context
895896
use FatesSizeAgeTypeIndicesMod, only : sizetype_class_index
896897
use EDtypesMod , only : area
897-
use EDPftvarcon , only : EDPftvarcon_inst
898+
use EDPftvarcon , only : EDPftvarcon_inst
898899

899900
! !ARGUMENTS
900901
integer , intent(in) :: nsites
@@ -929,8 +930,18 @@ subroutine canopy_summarization( nsites, sites, bc_in )
929930

930931
do while(associated(currentPatch))
931932

932-
call set_root_fraction(currentPatch,bc_in(s)%zi_sisl)
933-
933+
! Calculate rooting depth fractions for the patch x pft
934+
! Note that we are calling for the root fractions in the hydrologic context.
935+
! See explanation in FatesAllometryMod. In other locations, this
936+
! function is called to return the profile of biomass as used for litter
937+
938+
do ft = 1, numpft
939+
call set_root_fraction(currentPatch%rootfr_ft(ft,1:bc_in(s)%nlevsoil), ft, &
940+
bc_in(s)%zi_sisl,lowerb=lbound(bc_in(s)%zi_sisl,1), &
941+
icontext=i_hydro_rootprof_context)
942+
end do
943+
944+
934945
!zero cohort-summed variables.
935946
currentPatch%total_canopy_area = 0.0_r8
936947
currentPatch%total_tree_area = 0.0_r8
@@ -943,6 +954,7 @@ subroutine canopy_summarization( nsites, sites, bc_in )
943954
ft = currentCohort%pft
944955

945956

957+
946958
! Update the cohort's index within the size bin classes
947959
! Update the cohort's index within the SCPF classification system
948960
call sizetype_class_index(currentCohort%dbh,currentCohort%pft, &

biogeochem/EDCohortDynamicsMod.F90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,9 @@ subroutine create_cohort(currentSite, patchptr, pft, nn, hite, dbh, bleaf, bfine
184184
new_cohort%isnew = .true.
185185

186186
if( hlm_use_planthydro.eq.itrue ) then
187-
call InitHydrCohort(new_cohort)
188-
call updateSizeDepTreeHydProps(new_cohort, bc_in)
189-
call initTreeHydStates(currentSite,new_cohort, bc_in)
187+
call InitHydrCohort(CurrentSite,new_cohort)
188+
call updateSizeDepTreeHydProps(CurrentSite,new_cohort, bc_in)
189+
call initTreeHydStates(CurrentSite,new_cohort, bc_in)
190190
if(recruitstatus==1)then
191191
new_cohort%co_hydr%is_newly_recuited = .true.
192192
endif

biogeochem/EDPatchDynamicsMod.F90

Lines changed: 12 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ module EDPatchDynamicsMod
1818
use EDTypesMod , only : dtype_ilog
1919
use EDTypesMod , only : dtype_ifire
2020
use FatesInterfaceMod , only : hlm_use_planthydro
21-
use FatesInterfaceMod , only : hlm_numlevgrnd
22-
use FatesInterfaceMod , only : hlm_numlevsoil
2321
use FatesInterfaceMod , only : hlm_numSWb
2422
use FatesInterfaceMod , only : bc_in_type
2523
use FatesInterfaceMod , only : hlm_days_per_year
@@ -57,7 +55,6 @@ module EDPatchDynamicsMod
5755
public :: disturbance_rates
5856
public :: check_patch_area
5957
public :: set_patchno
60-
public :: set_root_fraction
6158
private:: fuse_2_patches
6259

6360
character(len=*), parameter, private :: sourcefile = &
@@ -346,7 +343,7 @@ subroutine spawn_patches( currentSite, bc_in)
346343
allocate(new_patch)
347344
call create_patch(currentSite, new_patch, age, site_areadis, &
348345
cwd_ag_local, cwd_bg_local, leaf_litter_local, &
349-
root_litter_local)
346+
root_litter_local, bc_in%nlevsoil)
350347

351348
new_patch%tallest => null()
352349
new_patch%shortest => null()
@@ -381,7 +378,7 @@ subroutine spawn_patches( currentSite, bc_in)
381378
do while(associated(currentCohort))
382379

383380
allocate(nc)
384-
if(hlm_use_planthydro.eq.itrue) call InitHydrCohort(nc)
381+
if(hlm_use_planthydro.eq.itrue) call InitHydrCohort(CurrentSite,nc)
385382
call zero_cohort(nc)
386383

387384
! nc is the new cohort that goes in the disturbed patch (new_patch)... currentCohort
@@ -1135,7 +1132,7 @@ end subroutine mortality_litter_fluxes
11351132

11361133
! ============================================================================
11371134
subroutine create_patch(currentSite, new_patch, age, areap,cwd_ag_local,cwd_bg_local, &
1138-
leaf_litter_local,root_litter_local)
1135+
leaf_litter_local,root_litter_local,nlevsoil)
11391136
!
11401137
! !DESCRIPTION:
11411138
! Set default values for creating a new patch
@@ -1145,12 +1142,13 @@ subroutine create_patch(currentSite, new_patch, age, areap,cwd_ag_local,cwd_bg_l
11451142
! !ARGUMENTS:
11461143
type(ed_site_type) , intent(inout), target :: currentSite
11471144
type(ed_patch_type), intent(inout), target :: new_patch
1148-
real(r8), intent(in) :: age ! notional age of this patch in years
1149-
real(r8), intent(in) :: areap ! initial area of this patch in m2.
1150-
real(r8), intent(in) :: cwd_ag_local(:) ! initial value of above ground coarse woody debris. KgC/m2
1151-
real(r8), intent(in) :: cwd_bg_local(:) ! initial value of below ground coarse woody debris. KgC/m2
1152-
real(r8), intent(in) :: root_litter_local(:)! initial value of root litter. KgC/m2
1153-
real(r8), intent(in) :: leaf_litter_local(:)! initial value of leaf litter. KgC/m2
1145+
real(r8), intent(in) :: age ! notional age of this patch in years
1146+
real(r8), intent(in) :: areap ! initial area of this patch in m2.
1147+
real(r8), intent(in) :: cwd_ag_local(:) ! initial value of above ground coarse woody debris. KgC/m2
1148+
real(r8), intent(in) :: cwd_bg_local(:) ! initial value of below ground coarse woody debris. KgC/m2
1149+
real(r8), intent(in) :: root_litter_local(:) ! initial value of root litter. KgC/m2
1150+
real(r8), intent(in) :: leaf_litter_local(:) ! initial value of leaf litter. KgC/m2
1151+
integer, intent(in) :: nlevsoil ! number of soil layers
11541152
!
11551153
! !LOCAL VARIABLES:
11561154
!---------------------------------------------------------------------
@@ -1163,8 +1161,8 @@ subroutine create_patch(currentSite, new_patch, age, areap,cwd_ag_local,cwd_bg_l
11631161
allocate(new_patch%fabi(hlm_numSWb))
11641162
allocate(new_patch%sabs_dir(hlm_numSWb))
11651163
allocate(new_patch%sabs_dif(hlm_numSWb))
1166-
allocate(new_patch%rootfr_ft(numpft,hlm_numlevgrnd))
1167-
allocate(new_patch%rootr_ft(numpft,hlm_numlevgrnd))
1164+
allocate(new_patch%rootfr_ft(numpft,nlevsoil))
1165+
allocate(new_patch%rootr_ft(numpft,nlevsoil))
11681166

11691167
call zero_patch(new_patch) !The nan value in here is not working??
11701168

@@ -1909,38 +1907,4 @@ function countPatches( nsites, sites ) result ( totNumPatches )
19091907

19101908
end function countPatches
19111909

1912-
! ====================================================================================
1913-
1914-
subroutine set_root_fraction( cpatch , zi )
1915-
!
1916-
! !DESCRIPTION:
1917-
! Calculates the fractions of the root biomass in each layer for each pft.
1918-
!
1919-
! !USES:
1920-
1921-
!
1922-
! !ARGUMENTS
1923-
type(ed_patch_type),intent(inout), target :: cpatch
1924-
real(r8),intent(in) :: zi(0:hlm_numlevsoil)
1925-
!
1926-
! !LOCAL VARIABLES:
1927-
integer :: lev,p,c,ft
1928-
!----------------------------------------------------------------------
1929-
1930-
do ft = 1,numpft
1931-
do lev = 1, hlm_numlevgrnd
1932-
cpatch%rootfr_ft(ft,lev) = 0._r8
1933-
enddo
1934-
1935-
do lev = 1, hlm_numlevsoil-1
1936-
cpatch%rootfr_ft(ft,lev) = .5_r8*( &
1937-
exp(-EDPftvarcon_inst%roota_par(ft) * zi(lev-1)) &
1938-
+ exp(-EDPftvarcon_inst%rootb_par(ft) * zi(lev-1)) &
1939-
- exp(-EDPftvarcon_inst%roota_par(ft) * zi(lev)) &
1940-
- exp(-EDPftvarcon_inst%rootb_par(ft) * zi(lev)))
1941-
end do
1942-
end do
1943-
1944-
end subroutine set_root_fraction
1945-
19461910
end module EDPatchDynamicsMod

0 commit comments

Comments
 (0)