Skip to content

Commit

Permalink
Merge tag 'sci.1.44.1_api.14.2.0_patchA' into sci.1.45.2_api.15.0.0_b…
Browse files Browse the repository at this point in the history
…ranch

Patch tag A. These are fixes that enabled b4b restart cababilities in E3SM. These are applied retroactively to this api which is at present, behind fates master which is api 16 at the time of this log
  • Loading branch information
rgknox committed Jun 17, 2021
2 parents 516c184 + e3a884f commit 36e60bb
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 24 deletions.
10 changes: 10 additions & 0 deletions biogeochem/EDPatchDynamicsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1384,6 +1384,16 @@ subroutine TransLitterNewPatch(currentSite, &

enddo

do pft = 1,numpft

new_litt%seed_decay(pft) = new_litt%seed_decay(pft) + &
curr_litt%seed_decay(pft)*patch_site_areadis/newPatch%area

new_litt%seed_germ_decay(pft) = new_litt%seed_germ_decay(pft) + &
curr_litt%seed_germ_decay(pft)*patch_site_areadis/newPatch%area

end do

! -----------------------------------------------------------------------------
! Distribute the existing litter that was already in place on the donor
! patch. Some of this burns and is sent to the atmosphere, and some goes to the
Expand Down
33 changes: 9 additions & 24 deletions biogeochem/FatesSoilBGCFluxMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -826,9 +826,9 @@ subroutine FluxIntoLitterPools(csite, bc_in, bc_out)

select case (element_list(el))
case (carbon12_element)
bc_out%litt_flux_cel_c_si(:) = 0._r8
bc_out%litt_flux_lig_c_si(:) = 0._r8
bc_out%litt_flux_lab_c_si(:) = 0._r8
bc_out%litt_flux_cel_c_si(:) = 0.0_r8
bc_out%litt_flux_lig_c_si(:) = 0.0_r8
bc_out%litt_flux_lab_c_si(:) = 0.0_r8
flux_cel_si => bc_out%litt_flux_cel_c_si(:)
flux_lab_si => bc_out%litt_flux_lab_c_si(:)
flux_lig_si => bc_out%litt_flux_lig_c_si(:)
Expand Down Expand Up @@ -861,31 +861,16 @@ subroutine FluxIntoLitterPools(csite, bc_in, bc_out)

end select

! Add efflux to the litter pool. kg/ha/day -> kg/m2/day
do id = 1,nlev_eff_decomp
flux_lab_si(id) = flux_lab_si(id) + &
sum(csite%flux_diags(el)%nutrient_efflux_scpf)*surface_prof(id)*area_inv
end do


currentPatch => csite%oldest_patch
do while (associated(currentPatch))

! If there is any efflux (from stores overflowing)
! than pass that to the labile litter pool

currentCohort => currentPatch%tallest
do while(associated(currentCohort))
if(.not.currentCohort%isnew)then
if(element_list(el).eq.carbon12_element) then
efflux_ptr => currentCohort%daily_c_efflux
elseif(element_list(el).eq.nitrogen_element) then
efflux_ptr => currentCohort%daily_n_efflux
elseif(element_list(el).eq.phosphorus_element) then
efflux_ptr => currentCohort%daily_p_efflux
end if
do id = 1,nlev_eff_decomp
flux_lab_si(id) = flux_lab_si(id) + &
efflux_ptr*currentCohort%n* AREA_INV * surface_prof(id)
end do
end if
currentCohort => currentCohort%shorter
end do

! Set a pointer to the litter object
! for the current element on the current
! patch
Expand Down
17 changes: 17 additions & 0 deletions main/FatesRestartInterfaceMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ module FatesRestartInterfaceMod
integer :: ir_fnrt_litt
integer :: ir_seed_litt
integer :: ir_seedgerm_litt
integer :: ir_seed_decay_litt
integer :: ir_seedgerm_decay_litt
integer :: ir_seed_prod_co
integer :: ir_livegrass_pa
integer :: ir_age_pa
Expand Down Expand Up @@ -938,6 +940,17 @@ subroutine define_restart_vars(this, initialize_variables)
units='kg/m2', veclength=num_elements, flushval = flushzero, &
hlms='CLM:ALM', initialize=initialize_variables, ivar=ivar, index = ir_seedgerm_litt)


call this%RegisterCohortVector(symbol_base='fates_seed_decay', vtype=cohort_r8, &
long_name_base='seed bank (non-germinated)', &
units='kg/m2', veclength=num_elements, flushval = flushzero, &
hlms='CLM:ALM', initialize=initialize_variables, ivar=ivar, index = ir_seed_decay_litt)

call this%RegisterCohortVector(symbol_base='fates_seedgerm_decay', vtype=cohort_r8, &
long_name_base='seed bank (germinated)', &
units='kg/m2', veclength=num_elements, flushval = flushzero, &
hlms='CLM:ALM', initialize=initialize_variables, ivar=ivar, index = ir_seedgerm_decay_litt)

call this%RegisterCohortVector(symbol_base='fates_ag_cwd_frag', vtype=cohort_r8, &
long_name_base='above ground CWD frag flux', &
units='kg/m2/day', veclength=num_elements, flushval = flushzero, &
Expand Down Expand Up @@ -1932,6 +1945,8 @@ subroutine set_restart_vectors(this,nc,nsites,sites)
do i = 1,numpft
this%rvars(ir_seed_litt+el)%r81d(io_idx_pa_pft) = litt%seed(i)
this%rvars(ir_seedgerm_litt+el)%r81d(io_idx_pa_pft) = litt%seed_germ(i)
this%rvars(ir_seed_decay_litt+el)%r81d(io_idx_pa_pft) = litt%seed_decay(i)
this%rvars(ir_seedgerm_decay_litt+el)%r81d(io_idx_pa_pft) = litt%seed_germ_decay(i)
io_idx_pa_pft = io_idx_pa_pft + 1
end do

Expand Down Expand Up @@ -2694,6 +2709,8 @@ subroutine get_restart_vectors(this, nc, nsites, sites)
do i = 1,numpft
litt%seed(i) = this%rvars(ir_seed_litt+el)%r81d(io_idx_pa_pft)
litt%seed_germ(i) = this%rvars(ir_seedgerm_litt+el)%r81d(io_idx_pa_pft)
litt%seed_decay(i) = this%rvars(ir_seed_decay_litt+el)%r81d(io_idx_pa_pft)
litt%seed_germ_decay(i) = this%rvars(ir_seedgerm_decay_litt+el)%r81d(io_idx_pa_pft)
io_idx_pa_pft = io_idx_pa_pft + 1
end do

Expand Down

0 comments on commit 36e60bb

Please sign in to comment.