From 4ef49f85e08019d5e68b321f3817d238dc38ac19 Mon Sep 17 00:00:00 2001 From: Joshua Rady Date: Tue, 22 Sep 2020 11:04:48 -0400 Subject: [PATCH 1/3] Add tolerance to disturbance check to resolve issue with precision error. --- biogeochem/EDPatchDynamicsMod.F90 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/biogeochem/EDPatchDynamicsMod.F90 b/biogeochem/EDPatchDynamicsMod.F90 index af0208cf43..84ea9258f6 100644 --- a/biogeochem/EDPatchDynamicsMod.F90 +++ b/biogeochem/EDPatchDynamicsMod.F90 @@ -481,6 +481,8 @@ subroutine spawn_patches( currentSite, bc_in) ! for both woody and grass species real(r8) :: leaf_m ! leaf mass during partial burn calculations logical :: found_youngest_primary ! logical for finding the first primary forest patch + + real(r8), parameter :: disturb_tolerance = 1.0e-14_r8 ! Allow for a small precision errors. !--------------------------------------------------------------------- storesmallcohort => null() ! storage of the smallest cohort for insertion routine @@ -500,7 +502,7 @@ subroutine spawn_patches( currentSite, bc_in) do while(associated(currentPatch)) - if(currentPatch%disturbance_rate>1.0_r8) then + if(currentPatch%disturbance_rate > (1.0_r8 + disturb_tolerance)) then write(fates_log(),*) 'patch disturbance rate > 1 ?',currentPatch%disturbance_rate call dump_patch(currentPatch) call endrun(msg=errMsg(sourcefile, __LINE__)) From 79632e1813dc217feef7b6fed168d4d5bf74d485 Mon Sep 17 00:00:00 2001 From: Joshua Rady Date: Wed, 21 Oct 2020 20:05:00 -0400 Subject: [PATCH 2/3] Correct grammar error. --- biogeochem/EDPatchDynamicsMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/biogeochem/EDPatchDynamicsMod.F90 b/biogeochem/EDPatchDynamicsMod.F90 index 84ea9258f6..2932b992e5 100644 --- a/biogeochem/EDPatchDynamicsMod.F90 +++ b/biogeochem/EDPatchDynamicsMod.F90 @@ -482,7 +482,7 @@ subroutine spawn_patches( currentSite, bc_in) real(r8) :: leaf_m ! leaf mass during partial burn calculations logical :: found_youngest_primary ! logical for finding the first primary forest patch - real(r8), parameter :: disturb_tolerance = 1.0e-14_r8 ! Allow for a small precision errors. + real(r8), parameter :: disturb_tolerance = 1.0e-14_r8 ! Allow for small precision errors. !--------------------------------------------------------------------- storesmallcohort => null() ! storage of the smallest cohort for insertion routine From 228039b44434aed4c05f9767c04f9e59b7cfa435 Mon Sep 17 00:00:00 2001 From: Joshua Rady Date: Sun, 7 Mar 2021 16:24:50 -0500 Subject: [PATCH 3/3] Replace tolerace threshold with rsnbl_math_prec. --- biogeochem/EDPatchDynamicsMod.F90 | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/biogeochem/EDPatchDynamicsMod.F90 b/biogeochem/EDPatchDynamicsMod.F90 index 9b2ffdbe8e..472c8eb48c 100644 --- a/biogeochem/EDPatchDynamicsMod.F90 +++ b/biogeochem/EDPatchDynamicsMod.F90 @@ -447,7 +447,8 @@ subroutine spawn_patches( currentSite, bc_in) ! !USES: use EDParamsMod , only : ED_val_understorey_death, logging_coll_under_frac - use EDCohortDynamicsMod , only : zero_cohort, copy_cohort, terminate_cohorts + use EDCohortDynamicsMod , only : zero_cohort, copy_cohort, terminate_cohorts + use FatesConstantsMod , only : rsnbl_math_prec ! ! !ARGUMENTS: @@ -481,8 +482,6 @@ subroutine spawn_patches( currentSite, bc_in) ! for both woody and grass species real(r8) :: leaf_m ! leaf mass during partial burn calculations logical :: found_youngest_primary ! logical for finding the first primary forest patch - - real(r8), parameter :: disturb_tolerance = 1.0e-14_r8 ! Allow for small precision errors. !--------------------------------------------------------------------- storesmallcohort => null() ! storage of the smallest cohort for insertion routine @@ -502,7 +501,7 @@ subroutine spawn_patches( currentSite, bc_in) do while(associated(currentPatch)) - if(currentPatch%disturbance_rate > (1.0_r8 + disturb_tolerance)) then + if(currentPatch%disturbance_rate > (1.0_r8 + rsnbl_math_prec)) then write(fates_log(),*) 'patch disturbance rate > 1 ?',currentPatch%disturbance_rate call dump_patch(currentPatch) call endrun(msg=errMsg(sourcefile, __LINE__))