Skip to content

Commit

Permalink
Added kill_old_grass subroutine
Browse files Browse the repository at this point in the history
  • Loading branch information
Laura Marques committed Apr 23, 2024
1 parent cd2679e commit 518e9cc
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/biosphere_biomee.mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ subroutine biosphere_annual(out_biosphere)
! Re-organize cohorts
!---------------------------------------------
call kill_lowdensity_cohorts( vegn )

call kill_old_grass( vegn )

call relayer_cohorts( vegn )

Expand Down
3 changes: 2 additions & 1 deletion src/datatypes.mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ module datatypes
integer :: layer = 1.0 ! the layer of this cohort (numbered from top, top layer=1)
integer :: firstlayer = 0.0 ! 0 = never been in the first layer; 1 = at least one year in first layer
real :: layerfrac = 0.0 ! fraction of layer area occupied by this cohort

real :: leaf_age = 0.0 ! leaf age (years)

!===== Population structure
real :: nindivs = 1.0 ! density of vegetation, individuals/m2
real :: age = 0.0 ! age of cohort, years
Expand Down
61 changes: 59 additions & 2 deletions src/vegetation_biomee.mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module md_vegetation_biomee
public :: vegn_reproduction, vegn_annualLAImax_update !, annual_calls
public :: vegn_nat_mortality, vegn_species_switch !, vegn_starvation
public :: relayer_cohorts, vegn_mergecohorts, kill_lowdensity_cohorts
public :: kill_old_grass
public :: vegn_annual_starvation,Zero_diagnostics, reset_vegn_initial

contains
Expand Down Expand Up @@ -232,6 +233,9 @@ subroutine vegn_growth_EW( vegn )
associate (sp => spdata(cc%species))

if (cc%status == LEAF_ON) then

!update leaf age
cc%leaf_age = cc%leaf_age + 1.0/365.0

! Get carbon from NSC pool. This sets cc%C_growth
call fetch_CN_for_growth( cc )
Expand Down Expand Up @@ -340,6 +344,7 @@ subroutine vegn_growth_EW( vegn )
cc%psapw%c%c12 = cc%psapw%c%c12 + dBSW
cc%pseed%c%c12 = cc%pseed%c%c12 + dSeed
cc%plabl%c%c12 = cc%plabl%c%c12 - dBR - dBL - dSeed - dBSW
cc%leaf_age = (1.0 - dBL/cc%pleaf%c%c12) * cc%leaf_age !NEW
cc%resg = 0.5 * (dBR + dBL + dSeed + dBSW) ! daily

! update nitrogen pools, Nitrogen allocation
Expand Down Expand Up @@ -490,6 +495,7 @@ subroutine vegn_phenology( vegn )
integer :: i
! real :: grassdensity ! for grasses only
! real :: BL_u,BL_c
integer :: GrassMaxL = 3
real :: ccNSC, ccNSN
logical :: cc_firstday = .false.
logical :: TURN_ON_life = .false., TURN_OFF_life
Expand Down Expand Up @@ -526,7 +532,8 @@ subroutine vegn_phenology( vegn )
endif

! Reset grass density at the first day of a growing season
if (cc_firstday .and. sp%lifeform == 0 .and. cc%age > 2.0) then
! if (cc_firstday .and. sp%lifeform == 0 .and. cc%age > 2.0) then
if (sp%lifeform ==0 .and. (cc_firstday .and. cc%age>0.5)) then

! reset grass density and size for perenials
ccNSC = (cc%plabl%c%c12 + cc%pleaf%c%c12 + cc%psapw%c%c12 + &
Expand Down Expand Up @@ -565,7 +572,8 @@ subroutine vegn_phenology( vegn )

enddo cohortloop2

if (TURN_ON_life) call relayer_cohorts( vegn )
! if (TURN_ON_life) call relayer_cohorts( vegn )
if (cc_firstday) call relayer_cohorts(vegn)

! OFF of a growing season
cohortloop3: do i = 1,vegn%n_cohorts
Expand Down Expand Up @@ -1864,6 +1872,54 @@ subroutine kill_lowdensity_cohorts( vegn )
endif
end subroutine kill_lowdensity_cohorts

subroutine kill_old_grass(vegn)
! kill old grass cohorts
! Weng, 01/22/2023
type(vegn_tile_type), intent(inout) :: vegn

! ---- local vars
type(cohort_type), pointer :: cx, cc(:) ! array to hold new cohorts
logical :: merged(vegn%n_cohorts) ! mask to skip cohorts that were already merged
real, parameter :: mindensity = 0.25E-4
logical :: OldGrass
integer :: i,j,k

! calculate the number of cohorts that are not old grass
k = 0
do i = 1, vegn%n_cohorts
cx =>vegn%cohorts(i)
associate(sp=>spdata(cx%species))
OldGrass = (sp%lifeform ==0 .and. cx%age > 3.0)
if (.not. OldGrass) k=k+1
end associate
enddo
if (k==0)then
write(*,*)'in kill_old_grass: All cohorts are old grass, No action!'
!stop
endif

! exclude cohorts that are old grass
if (k>0 .and. k<vegn%n_cohorts)then
allocate(cc(k))
j=0
do i = 1,vegn%n_cohorts
cx =>vegn%cohorts(i)
associate(sp=>spdata(cx%species))
OldGrass = (sp%lifeform ==0 .and. cx%age > 3.0)
if (.not. OldGrass) then
j=j+1
cc(j) = cx
else
! Carbon and Nitrogen from plants to soil pools
call plant2soil(vegn,cx,cx%nindivs)
endif
end associate
enddo
vegn%n_cohorts = j
deallocate (vegn%cohorts)
vegn%cohorts=>cc
endif
end subroutine kill_old_grass

subroutine merge_cohorts(c1, c2)
!////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -2219,6 +2275,7 @@ subroutine initialize_vegn_tile( vegn, nCohorts )
cx => vegn%cohorts(i)
cx%status = LEAF_OFF ! ON=1, OFF=0 ! ON
cx%layer = 1
cx%age = 0
cx%species = INT(myinterface%init_cohort(i)%init_cohort_species)
cx%ccID = i
cx%plabl%c%c12 = myinterface%init_cohort(i)%init_cohort_nsc
Expand Down

0 comments on commit 518e9cc

Please sign in to comment.