Skip to content

Commit

Permalink
Merge pull request ESCOMP#8 from ekluzek/master
Browse files Browse the repository at this point in the history
Bring in NGEET update to sci.1.5.0_api.3.0.0
  • Loading branch information
ekluzek authored Apr 11, 2018
2 parents 52bad28 + 892f5d4 commit 6baebdc
Show file tree
Hide file tree
Showing 24 changed files with 2,741 additions and 837 deletions.
44 changes: 44 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<!--- Provide a general summary of your changes in the Title above -->

### Description:
<!--- Describe your changes in detail -->
<!--- please add issue number if one exists -->

### Collaborators:
<!--- List names of collaborators or people who have interacted -->
<!--- in bringing about this set of changes -->
<!--- consultation, discussions, etc. -->

### Expectation of Answer Changes:
<!--- Please describe under what conditions, if any, -->
<!--- the model is expected to generated different answers -->
<!--- from the master version of the code -->


### Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
- [ ] My change requires a change to the documentation.
- [ ] I have updated the in-code documentation AND wiki accordingly.
- [ ] I have read the [**CONTRIBUTING**](https://github.com/rgknox/fates/blob/rgknox-new-PR-template/CONTRIBUTING.md) document.
- [ ] FATES PASS/FAIL regression tests were run
- [ ] If answers were expected to change, evaluation was performed and provided


### Test Results:
<!--- Non-trivial changes require the PASS/FAIL regression tests. -->
<!--- If changes to code are NOT expected to change answers, tests must -->
<!--- be run against a baseline. -->

FATES-CLM (or) HLM test hash-tag:

FATES-CLM (or) HLM baseline hash-tag:

FATES baseline hash-tag:

Test Output:

<!--- paste in test results here -->


<!--this template is from https://www.talater.com/open-source-templates/#/page/99-->
52 changes: 52 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# How to contribute

Thank you for considering contributing to the development of FATES. There are a few guidelines that we need contributions to follow.

## Read and Understand the FATES license:

https://github.com/NGEET/fates/blob/master/LICENSE.txt

## If working with unreleased code, please read the use policy that governs the developer repository:

https://github.com/NGEET/fates/wiki/Use-and-distribution-policy-for-fates-developer-repository

## Getting Started

Those who wish to contribute code to FATES must have those changes integrated through the developer repository NGEET/fates. Changes that make it to public releases must go through this repository first, as well. Here are some basic first steps.

* All developers should create a fork of the NGEET/fates repository into their personal space on github
* Follow the developer work-flow described here: https://github.com/NGEET/fates/wiki/FATES-Development-Workflow
* Each set of changes should have its own feature branch that encapsulates your desired changes, following the conventions outlined here: https://github.com/NGEET/fates/wiki/Feature-Branch-Naming-Convention
* The work-flow will lead you eventually to submit a Pull-Request to NGEET/fates:master, please follow the template in the Pull Request and communicate as best you can if you are unsure how to fill out the text
* It is best to create an issue to describe the work you are undertaking prior to starting. This helps the community sync with your efforts, prevents duplication of efforts, and science is not done in a vaccuum!
* Expect peers to interact, help, discuss and eventually approve your submission (pull-request)


## Things to Remember

* Make commits in logical units (i.e. group changes)
* Changes that are submitted should be limited to 1 single feature (i.e. don't submit changes to the radiation code and the nutrient cycle simultaneous, pick one thing)
* Check for unnecessary whitespace with `git diff --check` before committing
* We have no standard protocol for commit messages, but try to make them meaningful, concise and succinct.
* You will most likely have to test (see workflow above), see: https://github.com/NGEET/fates/wiki/Testing-Protocols


## Coding Practices and Style

Please refer to the FATES style guide: https://github.com/NGEET/fates/wiki/Coding-Practices-and-Style-Guide


## Trivial Changes

If changes are trivial, it's possible testing will not be required. Conversations via the Pull Request will address if tests are not needed

## Documentation

Yes please! If you are creating new code, fixing existing code, anything. Please add comments in the code itself. Please also follow the style guide for comments. Also, please create and/or modify existing wiki documentation. You may be asked to add documtation prior to having a pull-request approved.


## Additional Resources

* [General GitHub documentation](https://help.github.com/)
* [GitHub pull request documentation](https://help.github.com/articles/creating-a-pull-request/)
* [FATES Wiki](https://github.com/NGEET/fates/wiki)
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Functionally Assembled Terrestrial Ecosystem Simulator (“FATES”)

Copyright (c) 2016-2017, The Regents of the University of California, through Lawrence
Copyright (c) 2016-2018, The Regents of the University of California, through Lawrence
Berkeley National Laboratory, University Corporation for Atmospheric Research, Los Alamos
National Security, LLC (LANS), as operator of Los Alamos National Laboratory (LANL), and
President and Fellows of Harvard College. All rights reserved.
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# NGEE-T fates repository
------------------------------

This is the developer repository of the Next Generation Ecosystem Experiment Tropics’ (NGEE-T) model: the Functionally Assembled Terrestrial Ecosystem Simulator (FATES).
This is the developer repository of the Next Generation Ecosystem Experiment Tropics’ (NGEE-T) model: the Functionally Assembled Terrestrial Ecosystem Simulator (FATES). (https://github.com/NGEET/fates)

For more information on the FATES model, see our wiki: https://github.com/NGEET/fates/wiki

Expand All @@ -20,3 +20,5 @@ http://www.cesm.ucar.edu/
The NGEE-T project maintains a mirror of CLM. That software system will automatically pull in the FATES software, and is where most users should go to clone the code:

https://github.com/NGEET/fates-clm


51 changes: 28 additions & 23 deletions biogeochem/EDCanopyStructureMod.F90
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ module EDCanopyStructureMod
use FatesConstantsMod , only : r8 => fates_r8
use FatesGlobals , only : fates_log
use EDPftvarcon , only : EDPftvarcon_inst
use EDGrowthFunctionsMod , only : c_area
use FatesAllometryMod , only : carea_allom
use EDCohortDynamicsMod , only : copy_cohort, terminate_cohorts, fuse_cohorts
use EDCohortDynamicsMod , only : tree_lai
use EDCohortDynamicsMod , only : tree_sai
use EDtypesMod , only : ed_site_type, ed_patch_type, ed_cohort_type, ncwd
use EDTypesMod , only : nclmax
use EDTypesMod , only : nlevleaf
Expand Down Expand Up @@ -317,7 +319,9 @@ subroutine DemoteFromLayer(currentSite,currentPatch,i_lyr)
rankordered_area_sofar = 0.0_r8
currentCohort => currentPatch%tallest
do while (associated(currentCohort))
currentCohort%c_area = c_area(currentCohort)

call carea_allom(currentCohort%dbh,currentCohort%n,currentSite%spread,currentCohort%pft,currentCohort%c_area)

if(arealayer > currentPatch%area.and.currentCohort%canopy_layer == i_lyr)then
if (ED_val_comp_excln .ge. 0.0_r8 ) then
! normal (stochastic) case. weight cohort demotion by inverse size to a constant power
Expand Down Expand Up @@ -443,9 +447,11 @@ subroutine DemoteFromLayer(currentSite,currentPatch,i_lyr)
currentCohort%n = 0.0_r8
currentCohort%c_area = 0._r8
else
currentCohort%c_area = c_area(currentCohort)
call carea_allom(currentCohort%dbh,currentCohort%n,currentSite%spread,currentCohort%pft, &
currentCohort%c_area)
endif
copyc%c_area = c_area(copyc)

call carea_allom(copyc%dbh,copyc%n,currentSite%spread,copyc%pft,copyc%c_area)


!----------- Insert copy into linked list ------------------------!
Expand Down Expand Up @@ -517,7 +523,8 @@ subroutine DemoteFromLayer(currentSite,currentPatch,i_lyr)
currentCohort%c_area = 0._r8

else
currentCohort%c_area = c_area(currentCohort)
call carea_allom(currentCohort%dbh,currentCohort%n,currentSite%spread, &
currentCohort%pft,currentCohort%c_area)
endif

endif ! matches: if (cc_loss < currentCohort%c_area)then
Expand Down Expand Up @@ -619,8 +626,7 @@ subroutine PromoteIntoLayer(currentSite,currentPatch,i_lyr)
do while (associated(currentCohort))
if(currentCohort%canopy_layer == i_lyr+1)then !look at the cohorts in the canopy layer below...
currentCohort%canopy_layer = i_lyr
currentCohort%c_area = c_area(currentCohort)

call carea_allom(currentCohort%dbh,currentCohort%n,currentSite%spread,currentCohort%pft,currentCohort%c_area)
! keep track of number and biomass of promoted cohort
currentSite%promotion_rate(currentCohort%size_class) = &
currentSite%promotion_rate(currentCohort%size_class) + currentCohort%n
Expand All @@ -639,7 +645,7 @@ subroutine PromoteIntoLayer(currentSite,currentPatch,i_lyr)
! This is the opposite of the demotion weighting...
currentCohort => currentPatch%tallest
do while (associated(currentCohort))
currentCohort%c_area = c_area(currentCohort)
call carea_allom(currentCohort%dbh,currentCohort%n,currentSite%spread,currentCohort%pft,currentCohort%c_area)
if(currentCohort%canopy_layer == i_lyr+1)then !look at the cohorts in the canopy layer below...
if (ED_val_comp_excln .ge. 0.0_r8 ) then
! normal (stochastic) case, as above.
Expand Down Expand Up @@ -720,8 +726,8 @@ subroutine PromoteIntoLayer(currentSite,currentPatch,i_lyr)
currentCohort%dbh = currentCohort%dbh - 0.000000000001_r8
copyc%dbh = copyc%dbh + 0.000000000001_r8

currentCohort%c_area = c_area(currentCohort)
copyc%c_area = c_area(copyc)
call carea_allom(currentCohort%dbh,currentCohort%n,currentSite%spread,currentCohort%pft,currentCohort%c_area)
call carea_allom(copyc%dbh,copyc%n,currentSite%spread,copyc%pft,copyc%c_area)

!----------- Insert copy into linked list ------------------------!
copyc%shorter => currentCohort
Expand All @@ -738,8 +744,8 @@ subroutine PromoteIntoLayer(currentSite,currentPatch,i_lyr)

! update area AFTER we sum up the losses. the cohort may shrink at this point,
! if the upper canopy spread is smaller. this shold be dealt with by the 'excess area' loop.
currentCohort%c_area = c_area(currentCohort)
call carea_allom(currentCohort%dbh,currentCohort%n,currentSite%spread,currentCohort%pft,currentCohort%c_area)

! keep track of number and biomass of promoted cohort
currentSite%promotion_rate(currentCohort%size_class) = &
currentSite%promotion_rate(currentCohort%size_class) + currentCohort%n
Expand Down Expand Up @@ -826,7 +832,7 @@ subroutine canopy_spread( currentSite )
!calculate canopy area in each patch...
currentCohort => currentPatch%tallest
do while (associated(currentCohort))
currentCohort%c_area = c_area(currentCohort)
call carea_allom(currentCohort%dbh,currentCohort%n,currentSite%spread,currentCohort%pft,currentCohort%c_area)
if(EDPftvarcon_inst%woody(currentCohort%pft) .eq. 1 .and. currentCohort%canopy_layer .eq. 1 ) then
sitelevel_canopyarea = sitelevel_canopyarea + currentCohort%c_area
endif
Expand Down Expand Up @@ -862,7 +868,6 @@ subroutine canopy_summarization( nsites, sites, bc_in )
use EDPatchDynamicsMod , only : set_patchno
use EDPatchDynamicsMod , only : set_root_fraction
use FatesSizeAgeTypeIndicesMod, only : sizetype_class_index
use EDGrowthFunctionsMod , only : tree_lai, c_area
use EDtypesMod , only : area
use EDPftvarcon , only : EDPftvarcon_inst

Expand Down Expand Up @@ -921,9 +926,9 @@ subroutine canopy_summarization( nsites, sites, bc_in )


currentCohort%b = currentCohort%balive+currentCohort%bdead+currentCohort%bstore
call carea_allom(currentCohort%dbh,currentCohort%n,sites(s)%spread,currentCohort%pft,currentCohort%c_area)
currentCohort%treelai = tree_lai(currentCohort)

currentCohort%c_area = c_area(currentCohort)

canopy_leaf_area = canopy_leaf_area + currentCohort%treelai *currentCohort%c_area

if(currentCohort%canopy_layer==1)then
Expand Down Expand Up @@ -976,7 +981,6 @@ subroutine leaf_area_profile( currentSite , snow_depth_si, frac_sno_eff_si)
!
! !USES:

use EDGrowthFunctionsMod , only : tree_lai, tree_sai, c_area
use EDtypesMod , only : area, dinc_ed, hitemax, n_hite_bins

!
Expand Down Expand Up @@ -1026,8 +1030,8 @@ subroutine leaf_area_profile( currentSite , snow_depth_si, frac_sno_eff_si)
currentPatch%canopy_layer_lai(:) = 0._r8
NC = 0
currentCohort => currentPatch%shortest
do while(associated(currentCohort))
currentCohort%c_area = c_area(currentCohort)
do while(associated(currentCohort))
call carea_allom(currentCohort%dbh,currentCohort%n,currentSite%spread,currentCohort%pft,currentCohort%c_area)
currentPatch%canopy_area = currentPatch%canopy_area + currentCohort%c_area
NC = NC+1
currentCohort => currentCohort%taller
Expand Down Expand Up @@ -1594,8 +1598,8 @@ subroutine CanopyLayerArea(currentPatch,layer_index,layer_area)

layer_area = 0.0_r8
currentCohort => currentPatch%tallest
do while (associated(currentCohort))
currentCohort%c_area = c_area(currentCohort) ! Reassess cohort area.
do while (associated(currentCohort))
call carea_allom(currentCohort%dbh,currentCohort%n,currentPatch%siteptr%spread,currentCohort%pft,currentCohort%c_area)
if (currentCohort%canopy_layer .eq. layer_index) then
layer_area = layer_area + currentCohort%c_area
end if
Expand Down Expand Up @@ -1623,7 +1627,7 @@ function NumPotentialCanopyLayers(currentPatch,include_substory) result(z)
type(ed_cohort_type),pointer :: currentCohort

integer :: z

real(r8) :: c_area
real(r8) :: arealayer

z = 1
Expand All @@ -1638,7 +1642,8 @@ function NumPotentialCanopyLayers(currentPatch,include_substory) result(z)
currentCohort => currentPatch%tallest
do while (associated(currentCohort))
if(currentCohort%canopy_layer == z) then
arealayer = arealayer + c_area(currentCohort)
call carea_allom(currentCohort%dbh,currentCohort%n,currentPatch%siteptr%spread,currentCohort%pft,c_area)
arealayer = arealayer + c_area
end if
currentCohort => currentCohort%shorter
enddo
Expand Down
Loading

0 comments on commit 6baebdc

Please sign in to comment.