Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

two-stream finidat type restart fixes #1286

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
ee5ef88
adding land use parameters to file: grazing, PFT max canopy coverage
ckoven May 2, 2023
bc633e2
Merge branch 'luh2' into grazing
ckoven Jul 6, 2023
dbd692d
starting to add grazing parameterization
ckoven Jul 10, 2023
580df9e
more grazing updates
ckoven Jul 11, 2023
c62e98d
Merge branch 'luh2' into grazing_merge
ckoven Aug 14, 2023
cab4ee7
merged luh2 and resolved conflicts
ckoven Sep 18, 2023
cb5ea6d
fixed merged conflict
ckoven Sep 18, 2023
dcbf787
Merge branch 'luh2' into grazing_merge
ckoven Sep 19, 2023
2b36e09
Merge branch 'luh2' into grazing_merge
ckoven Oct 5, 2023
9e035dd
Merge branch 'luh2' into grazing_merge
ckoven Oct 16, 2023
3f755f0
merged main and resolved conflicts
ckoven Dec 19, 2023
4e818e8
changed hite to height
ckoven Dec 19, 2023
b67019d
changed grazing rate to 4%/day
ckoven Dec 19, 2023
53a6a44
merged main and resolved conflicts
ckoven Jul 19, 2024
636e003
read the grazing parameters
ckoven Jul 19, 2024
391d6e9
merged Rosie's file manual_nocomp_calibration__16july.cdl into fates_…
ckoven Jul 23, 2024
2b87e44
set all grazing_rate parameters to zero
ckoven Jul 24, 2024
b994519
Merge branch 'params_sp_nocomp_calibr' into grazing_paramcalib_merge
ckoven Jul 24, 2024
c039964
compile-time bugfixes
ckoven Jul 25, 2024
034f214
Merge branch 'grazing_merge' into grazing_paramcalib_merge
ckoven Jul 25, 2024
ed007e3
setting nclmax=3
ckoven Jul 25, 2024
ececdb5
changed order of promotion loop
ckoven Jul 26, 2024
ec6008e
added check for area gt 1
ckoven Jul 26, 2024
94fc5b1
two-stream restart bug fixes
rgknox Sep 7, 2024
298c6af
bug fix on allocating temp rad structures
rgknox Sep 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
compile-time bugfixes
  • Loading branch information
ckoven committed Jul 25, 2024
commit c039964e01e75e1bbab9b5c471693262f2556638
20 changes: 12 additions & 8 deletions biogeochem/EDPhysiologyMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2785,7 +2785,9 @@ subroutine CWDInput( currentSite, currentPatch, litt, bc_in)
! and turnover in dying trees.
!
! !USES:

use EDParamsMod , only : landuse_grazing_carbon_use_eff
use EDParamsMod , only : landuse_grazing_nitrogen_use_eff
use EDParamsMod , only : landuse_grazing_phosphorus_use_eff
!
! !ARGUMENTS
type(ed_site_type), intent(inout), target :: currentSite
Expand Down Expand Up @@ -2832,6 +2834,8 @@ subroutine CWDInput( currentSite, currentPatch, litt, bc_in)
integer :: numlevsoil ! Actual number of soil layers

real(r8) :: SF_val_CWD_frac_adj(4) !SF_val_CWD_frac adjusted based on cohort dbh
real(r8) :: leaf_herbivory
real(r8) :: herbivory_element_use_efficiency
!----------------------------------------------------------------------

! -----------------------------------------------------------------------------------
Expand All @@ -2842,13 +2846,13 @@ subroutine CWDInput( currentSite, currentPatch, litt, bc_in)

element_id = litt%element_id

select case(element):
case(carbon12_element):
herbivory_element_use_efficiency = fates_landuse_grazing_carbon_use_eff
case(nitrogen_element):
herbivory_element_use_efficiency = fates_landuse_grazing_nitrogen_use_eff
case (phosphorus_element):
herbivory_element_use_efficiency = fates_landuse_grazing_phosphorus_use_eff
select case(element_id)
case (carbon12_element)
herbivory_element_use_efficiency = landuse_grazing_carbon_use_eff
case (nitrogen_element)
herbivory_element_use_efficiency = landuse_grazing_nitrogen_use_eff
case (phosphorus_element)
herbivory_element_use_efficiency = landuse_grazing_phosphorus_use_eff
end select

! Object tracking flux diagnostics for each element
Expand Down
22 changes: 16 additions & 6 deletions biogeochem/FatesLandUseChangeMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -432,22 +432,32 @@ subroutine fates_grazing(prt, ft, land_use_label, height)
use PRTGenericMod, only : leaf_organ
use PRTGenericMod, only : prt_vartypes
use PRTLossFluxesMod, only : PRTHerbivoryLosses
use EDParamsMod , only : landuse_grazing_rate
use EDParamsMod , only : landuse_grazing_maxheight
use EDPftvarcon , only : EDPftvarcon_inst
use PRTParametersMod, only : prt_params
use FatesAllometryMod,only : CrownDepth

! apply grazing and browsing to plants as a function of PFT, height (for woody plants), and land use label.

class(prt_vartypes), intent(inout), pointer :: prt
integer, intent(in) :: ft
integer, intent(in) :: land_use-label
integer, intent(in) :: land_use_label
real(r8), intent(in) :: height

real(r8) :: grazing_rate ! rate of grazing (or browsing) of leaf tissue [day -1]

grazing_rate = fates_landuse_grazing_rate(land_use_label) * fates_landuse_grazing_palatability(ft)

real(r8) :: crown_depth

grazing_rate = landuse_grazing_rate(land_use_label) * EDPftvarcon_inst%landuse_grazing_palatability(ft)

if ( grazing_rate .gt. 0._r8) then
if (woody(ft)) then
if (prt_params%woody(ft)) then

call CrownDepth(height,ft,crown_depth)

grazing_rate = grazing_rate * &
max(0._r8, min(1._r8, (fates_landuse_grazing_maxheight - height*fates_allom_crown_depth_frac(ft)/(height - height*fates_allom_crown_depth_frac(ft)))))
max(0._r8, min(1._r8, &
(landuse_grazing_maxheight - (height - crown_depth )) / crown_depth))
endif

call PRTHerbivoryLosses(prt, leaf_organ, grazing_rate)
Expand Down
3 changes: 2 additions & 1 deletion main/EDMainMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ module EDMainMod
use PRTLossFluxesMod, only : PRTReproRelease
use EDPftvarcon, only : EDPftvarcon_inst
use FatesHistoryInterfaceMod, only : fates_hist
use FatesLandUseChangeMod, only: fates_grazing

! CIME Globals
use shr_log_mod , only : errMsg => shr_log_errMsg
Expand Down Expand Up @@ -955,7 +956,7 @@ subroutine TotalBalanceCheck (currentSite, call_index )
write(fates_log(),*) 'flux_generic_out: ',site_mass%flux_generic_out
write(fates_log(),*) 'frag_out: ',site_mass%frag_out
write(fates_log(),*) 'aresp_acc: ',site_mass%aresp_acc
write(fates_log(),*) 'herbivory_flux: ',site_mass%herbivory_flux
write(fates_log(),*) 'herbivory_flux_out: ',site_mass%herbivory_flux_out
write(fates_log(),*) 'error=net_flux-dstock:', error
write(fates_log(),*) 'biomass', biomass_stock
write(fates_log(),*) 'litter',litter_stock
Expand Down
2 changes: 1 addition & 1 deletion main/EDParamsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ subroutine FatesRegisterParams(fates_params)
call fates_params%RegisterParameter(name=name_landuse_grazing_nitrogen_use_eff, dimension_shape=dimension_shape_scalar, &
dimension_names=dim_names_scalar)

call fates_params%RegisterParameter(name=name_landuse_grazing_phosporus_use_eff, dimension_shape=dimension_shape_scalar, &
call fates_params%RegisterParameter(name=name_landuse_grazing_phosphorus_use_eff, dimension_shape=dimension_shape_scalar, &
dimension_names=dim_names_scalar)

! non-scalar parameters
Expand Down
2 changes: 1 addition & 1 deletion parteh/PRTLossFluxesMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,7 @@ subroutine PRTHerbivoryLosses(prt, organ_id, mass_fraction)
do i_pos = 1,prt_global%state_descriptor(i_var)%num_pos

! The mass that is leaving the plant
consumed_mass = mass_fraction * prt%variables(i_var)%val(i_pos)
herbivore_consumed_mass = mass_fraction * prt%variables(i_var)%val(i_pos)

! Track the amount of mass being eaten (+ is amount lost)
prt%variables(i_var)%herbivory(i_pos) = prt%variables(i_var)%herbivory(i_pos) &
Expand Down