Skip to content

Commit f847ef7

Browse files
committed
Merge branch 'nbp-gpp-restart-fix' of github.com:rgknox/fates into nbp-gpp-restart-fix
2 parents 638ae67 + 659b51b commit f847ef7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+4006
-1378
lines changed

.gitattributes

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,13 @@
55
# This is primarily being implemented to allow users to develop code with any operating system (OS)
66
# preferred and mitigates potential problems with end of line (eol) character differences.
77
# -----------------------------------------------------------------------------------------------------
8-
98
## Set the default end of line behavior (i.e. normalization to `lf` upon commit) for all files git recognizes as text
109
* text=auto
11-
1210
# Note that the above *only* applies to newly commited files. If the file previously existed with a `crlf` end of file
1311
# and was checked out to local, then git will not change the eol character during check-in (i.e. commit). For
1412
# windows users they will see a warning like this:
1513
# warning: CRLF will be replaced by LF in functional_unit_testing/allometry/drive_allomtests.py.
1614
# The file will have its original line endings in your working directory
17-
1815
## Explicitly declare to git which files should be normalized (i.e. treated as text files)
1916
*.cdl text
2017
*.F90 text
@@ -23,6 +20,6 @@
2320
*.sh text
2421
*.txt text
2522
*.xml text
26-
2723
## Declare to git which file types are binary files and should not have end of line modified
28-
*.mod binary
24+
*.mod binary
25+
testing/test_data/*.nc filter=lfs diff=lfs merge=lfs -text

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
*.zip
2525
*.nc
2626

27+
# Allow netcdf files in the test data directory
28+
!testing/test_data/*.nc
29+
2730
# Logs and databases #
2831
######################
2932
*.log
@@ -54,4 +57,4 @@ _run/
5457
# Old Files
5558
*~
5659
# Editor specific setting files
57-
*.vscode
60+
*.vscode

biogeochem/EDCanopyStructureMod.F90

Lines changed: 417 additions & 978 deletions
Large diffs are not rendered by default.

biogeochem/EDCohortDynamicsMod.F90

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -340,12 +340,13 @@ subroutine terminate_cohorts( currentSite, currentPatch, level , call_index, bc_
340340
terminate = itrue
341341
termination_type = i_term_mort_type_numdens
342342
if ( debug ) then
343-
write(fates_log(),*) 'terminating cohorts 0',currentCohort%n/currentPatch%area,currentCohort%dbh,currentCohort%pft,call_index
343+
write(fates_log(),*) 'terminating cohorts 0',currentCohort%n/currentPatch%area, &
344+
currentCohort%dbh,currentCohort%pft,call_index
344345
endif
345346
endif
346347

347348
! The rest of these are only allowed if we are not dealing with a recruit (level 2)
348-
if (.not.currentCohort%isnew .and. level == 2) then
349+
if_level_2: if (.not.currentCohort%isnew .and. level == 2) then
349350

350351
! Not enough n or dbh
351352
if (currentCohort%n/currentPatch%area <= min_npm2 .or. & !
@@ -354,18 +355,13 @@ subroutine terminate_cohorts( currentSite, currentPatch, level , call_index, bc_
354355
terminate = itrue
355356
termination_type = i_term_mort_type_numdens
356357
if ( debug ) then
357-
write(fates_log(),*) 'terminating cohorts 1',currentCohort%n/currentPatch%area,currentCohort%dbh,currentCohort%pft,call_index
358+
write(fates_log(),*) 'terminating cohorts 1', &
359+
currentCohort%n/currentPatch%area,currentCohort%dbh, &
360+
currentCohort%pft,call_index
358361
endif
359362
endif
360363

361-
! Outside the maximum canopy layer
362-
if (currentCohort%canopy_layer > nclmax ) then
363-
terminate = itrue
364-
termination_type = i_term_mort_type_canlev
365-
if ( debug ) then
366-
write(fates_log(),*) 'terminating cohorts 2', currentCohort%canopy_layer,currentCohort%pft,call_index
367-
endif
368-
endif
364+
369365

370366
! live biomass pools are terminally depleted
371367
if ( ( sapw_c+leaf_c+fnrt_c ) < 1e-10_r8 .or. &
@@ -387,8 +383,18 @@ subroutine terminate_cohorts( currentSite, currentPatch, level , call_index, bc_
387383
struct_c,sapw_c,leaf_c,fnrt_c,store_c,currentCohort%pft,call_index
388384
endif
389385

390-
endif
391-
endif ! if (.not.currentCohort%isnew .and. level == 2) then
386+
endif
387+
388+
end if if_level_2
389+
390+
! Outside the maximum canopy layer
391+
if (currentCohort%canopy_layer > nclmax .and. level == 3) then
392+
terminate = itrue
393+
termination_type = i_term_mort_type_canlev
394+
if ( debug ) then
395+
write(fates_log(),*) 'terminating cohorts 2', currentCohort%canopy_layer,currentCohort%pft,call_index
396+
endif
397+
endif
392398

393399
if (terminate == itrue) then
394400
call terminate_cohort(currentSite, currentPatch, currentCohort, bc_in, termination_type)
@@ -941,7 +947,7 @@ subroutine fuse_cohorts(currentSite, currentPatch, bc_in)
941947
currentCohort%size_class,currentCohort%size_by_pft_class)
942948

943949
if(hlm_use_planthydro.eq.itrue) then
944-
call FuseCohortHydraulics(currentSite,currentCohort,nextc,bc_in,newn)
950+
call FuseCohortHydraulics(currentSite,currentCohort,nextc,newn)
945951
endif
946952

947953
! recent canopy history
@@ -1020,6 +1026,12 @@ subroutine fuse_cohorts(currentSite, currentPatch, bc_in)
10201026

10211027
currentCohort%fire_mort = (currentCohort%n*currentCohort%fire_mort + &
10221028
nextc%n*nextc%fire_mort)/newn
1029+
1030+
currentCohort%nonrx_fire_mort = (currentCohort%n*currentCohort%nonrx_fire_mort + &
1031+
nextc%n*nextc%nonrx_fire_mort)/newn
1032+
1033+
currentCohort%rx_fire_mort = (currentCohort%n*currentCohort%rx_fire_mort + &
1034+
nextc%n*nextc%rx_fire_mort)/newn
10231035

10241036
! mortality diagnostics
10251037
currentCohort%cmort = (currentCohort%n*currentCohort%cmort + nextc%n*nextc%cmort)/newn
@@ -1118,7 +1130,7 @@ subroutine fuse_cohorts(currentSite, currentPatch, bc_in)
11181130
! update hydraulics quantities that are functions of height & biomasses
11191131
! deallocate the hydro structure of nextc
11201132
if (hlm_use_planthydro.eq.itrue) then
1121-
call UpdateSizeDepPlantHydProps(currentSite,currentCohort, bc_in)
1133+
call UpdateSizeDepPlantHydProps(currentSite,currentCohort)
11221134
endif
11231135

11241136
call nextc%FreeMemory()

biogeochem/EDLoggingMortalityMod.F90

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,9 +1145,6 @@ subroutine logging_litter_fluxes(currentSite, currentPatch, newPatch, patch_site
11451145
! This portion is known as "trunk_product_site
11461146

11471147
if(element_id .eq. carbon12_element) then
1148-
currentSite%resources_management%trunk_product_site = &
1149-
currentSite%resources_management%trunk_product_site + &
1150-
trunk_product_site
11511148

11521149
currentSite%resources_management%delta_litter_stock = &
11531150
currentSite%resources_management%delta_litter_stock + &

0 commit comments

Comments
 (0)