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

fixes: step error and min/max args #391

Merged
merged 7 commits into from
Jun 7, 2018
11 changes: 5 additions & 6 deletions biogeochem/EDMortalityFunctionsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,9 @@ subroutine mortality_rates( cohort_in,bc_in,cmort,hmort,bmort,frmort )
real(r8) :: frac ! relativised stored carbohydrate
real(r8) :: b_leaf ! target leaf biomass kgC
real(r8) :: hf_sm_threshold ! hydraulic failure soil moisture threshold
real(r8) :: temp_dep ! Temp. function (freezing mortality)
real(r8) :: temp_dep_fraction ! Temp. function (freezing mortality)
real(r8) :: temp_in_C ! Daily averaged temperature in Celcius
real(r8),parameter :: frost_mort_buffer = 5.0_r8 ! 5deg buffer for freezing mortality

real(r8), parameter :: frost_mort_buffer = 5.0_r8 ! 5deg buffer for freezing mortality
logical, parameter :: test_zero_mortality = .false. ! Developer test which
! may help to debug carbon imbalances
! and the like
Expand Down Expand Up @@ -107,9 +106,9 @@ subroutine mortality_rates( cohort_in,bc_in,cmort,hmort,bmort,frmort )
! doi: 10.1111/j.1365-2486.2006.01254.x

temp_in_C = bc_in%t_veg24_si - tfrz
temp_dep = max(0.0,min(1.0,1.0 - (temp_in_C - &
EDPftvarcon_inst%freezetol(cohort_in%pft))/frost_mort_buffer) )
frmort = EDPftvarcon_inst%mort_scalar_coldstress(cohort_in%pft) * temp_dep
temp_dep_fraction = max(0.0_r8, min(1.0_r8, 1.0_r8 - (temp_in_C - &
EDPftvarcon_inst%freezetol(cohort_in%pft))/frost_mort_buffer) )
frmort = EDPftvarcon_inst%mort_scalar_coldstress(cohort_in%pft) * temp_dep_fraction


!mortality_rates = bmort + hmort + cmort
Expand Down
12 changes: 6 additions & 6 deletions biogeochem/EDPhysiologyMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,7 @@ subroutine PlantGrowth( currentSite, currentCohort, bc_in )
real(r8), parameter :: cbal_prec = 1.0e-15_r8 ! Desired precision in carbon balance
! non-integrator part
integer , parameter :: max_substeps = 300
real(r8), parameter :: max_trunc_error = 1.0_r8
real(r8), parameter :: max_trunc_error = 1000.0_r8 ! Effectively turned off right now (RGK 05-2018)
integer, parameter :: ODESolve = 2 ! 1=RKF45, 2=Euler

ipft = currentCohort%pft
Expand Down Expand Up @@ -1283,11 +1283,11 @@ subroutine PlantGrowth( currentSite, currentCohort, bc_in )
write(fates_log(),*) 'carbon_balance',carbon_balance
write(fates_log(),*) 'deltaC',deltaC
write(fates_log(),*) 'totalC',totalC
write(fates_log(),*) 'leaf:',grow_leaf,bt_leaf,bt_leaf-currentCohort%bl
write(fates_log(),*) 'froot:',grow_froot,bt_fineroot,bt_fineroot-currentCohort%br
write(fates_log(),*) 'sap:',grow_sap,bt_sap,bt_sap-currentCohort%bsw
write(fates_log(),*) 'store:',grow_store,bt_store,bt_store-currentCohort%bstore
write(fates_log(),*) 'dead:',bt_dead,bt_dead-currentCohort%bdead
write(fates_log(),*) 'leaf:',grow_leaf,c_pool_out(i_cleaf),bt_leaf,bt_leaf-currentCohort%bl
write(fates_log(),*) 'froot:',grow_froot,c_pool_out(i_cfroot),bt_fineroot,currentCohort%br
write(fates_log(),*) 'sap:',grow_sap,c_pool_out(i_csap),bt_sap,currentCohort%bsw
write(fates_log(),*) 'store:',grow_store, c_pool_out(i_cstore),bt_store,currentCohort%bstore
write(fates_log(),*) 'dead:',c_pool_out(i_cdead),bt_dead,currentCohort%bdead
call dump_cohort(currentCohort)
call endrun(msg=errMsg(sourcefile, __LINE__))
end if
Expand Down