-
Notifications
You must be signed in to change notification settings - Fork 105
Diagnostically track forest edge #1432
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
base: main
Are you sure you want to change the base?
Changes from 104 commits
30541e7
436d0ef
cdd5854
3a72788
a1b7ee7
60191cf
d5e9642
f3e4e2e
15291b8
ecf7ec1
54e543d
aa3b3b9
21efc2c
d3cd1d4
b1858ab
15112f8
870d928
a8f9da0
6e0d63f
e200957
69a5946
fe31f1d
0f73382
7c2ae8a
bc6c6bd
7cd5631
f83e79c
6ae8443
784e050
ebefc1c
9faeb35
e4e710c
b70d12f
a0f0619
14d854a
2bcf4ad
3fc52fd
826d246
4d5e9f4
c97f24d
25d788c
b086894
c7627a7
9eef47a
b959e46
f31ebbd
d9845cd
39cc40d
87f618b
b11baa6
1b74e78
0b21684
a138ca8
6053313
7fc7a20
fe6392c
ec6d636
e228dc3
ff96724
f438c80
d546b41
55cdedf
323e770
927c138
82708f8
4ceb9bd
f656191
d131ac9
84beddc
9a4c719
35a3623
5583964
2f2f21f
ded84c4
3b34506
70c8632
abdcf86
c1940a9
97a180f
ed8d688
3fc2a31
12f21da
9759e2f
af1eb80
01b8be2
2dc6817
cab8e6f
a72885a
8462bf2
61a24ed
235c88f
26fb9a0
471ed00
f8a62fd
ec60dfb
e30b402
824ec00
118d799
e88ca2a
efcf267
3ed9356
1327b01
2b63956
db5bea4
a5f5a3b
4d3b7d4
233e525
7ffd6f0
4ac9ac1
a8c0c35
1476eb3
a88bfb0
131d93a
de669c9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -574,7 +574,6 @@ module EDTypesMod | |
|
|
||
| ! Make public necessary subroutines and functions | ||
| public :: dump_site | ||
| public :: CalculateTreeGrassAreaSite | ||
| public :: set_patchno | ||
|
|
||
| contains | ||
|
|
@@ -701,39 +700,6 @@ end subroutine ZeroMassBalFlux | |
|
|
||
| ! ===================================================================================== | ||
|
|
||
| subroutine CalculateTreeGrassAreaSite(csite, tree_fraction, grass_fraction, bare_fraction) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moved to FatesEdgeForestMod, I think because of circular dependencies. |
||
| ! | ||
| ! DESCRIPTION: | ||
| ! Calculates total grass, tree, and bare fractions for a site | ||
|
|
||
| ! ARGUMENTS: | ||
| type(ed_site_type), intent(inout) :: csite ! site object | ||
| real(r8), intent(out) :: tree_fraction ! total site tree fraction | ||
| real(r8), intent(out) :: grass_fraction ! total site grass fraction | ||
| real(r8), intent(out) :: bare_fraction ! total site bare fraction | ||
|
|
||
| ! LOCALS: | ||
| type(fates_patch_type), pointer :: currentPatch ! patch object | ||
|
|
||
| tree_fraction = 0.0_r8 | ||
| grass_fraction = 0.0_r8 | ||
|
|
||
| currentPatch => csite%oldest_patch | ||
| do while(associated(currentPatch)) | ||
| if (currentPatch%nocomp_pft_label /= nocomp_bareground) then | ||
| call currentPatch%UpdateTreeGrassArea() | ||
| tree_fraction = tree_fraction + currentPatch%total_tree_area/AREA | ||
| grass_fraction = grass_fraction + currentPatch%total_grass_area/AREA | ||
| end if | ||
| currentPatch => currentPatch%younger | ||
| end do | ||
|
|
||
| ! if cover > 1.0, grasses are under the trees | ||
| grass_fraction = min(grass_fraction, 1.0_r8 - tree_fraction) | ||
| bare_fraction = 1.0_r8 - tree_fraction - grass_fraction | ||
|
|
||
| end subroutine CalculateTreeGrassAreaSite | ||
|
|
||
| !--------------------------------------------------------------------------------------- | ||
|
|
||
| subroutine dump_site(csite) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| module FatesEcotypesMod | ||
rgknox marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| use FatesConstantsMod, only : r8 => fates_r8 | ||
| use EDTypesMod, only : ed_site_type | ||
| use FatesPatchMod, only : fates_patch_type | ||
|
|
||
| implicit none | ||
| private ! By default everything is private | ||
|
|
||
| ! Make public necessary subroutines and functions | ||
| public :: is_patch_forest | ||
| ! For unit testing | ||
| public :: does_patch_have_forest_tcthresh | ||
| public :: does_patch_have_grass_bmthresh | ||
samsrabin marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| contains | ||
|
|
||
| ! ===================================================================================== | ||
|
|
||
| function does_patch_have_forest_tcthresh(patchptr, forest_tree_fraction_threshold) | ||
| ! DESCRIPTION: | ||
| ! Return boolean: Is this patch "forest"? | ||
| ! | ||
| ! ARGUMENTS: | ||
| type(fates_patch_type), intent(in), pointer :: patchptr ! pointer to patch object | ||
| real(r8), intent(in) :: forest_tree_fraction_threshold ! Tree fraction above which a patch is "forest" | ||
| ! | ||
| ! RETURN VALUE | ||
| logical :: does_patch_have_forest_tcthresh | ||
| ! | ||
| ! LOCAL VARIABLES | ||
| real(r8) :: tree_fraction = 0._r8 | ||
|
|
||
| if (patchptr%area > 0._r8) then | ||
| tree_fraction = patchptr%total_tree_area / patchptr%area | ||
| else | ||
| tree_fraction = 0._r8 | ||
| end if | ||
|
|
||
| does_patch_have_forest_tcthresh = tree_fraction > forest_tree_fraction_threshold | ||
|
|
||
| end function does_patch_have_forest_tcthresh | ||
|
|
||
|
|
||
| function does_patch_have_grass_bmthresh(patchptr, grass_biomass_threshold) | ||
| ! DESCRIPTION: | ||
| ! Return boolean: Does this patch have grass biomass above a threshold? | ||
| ! | ||
| ! ARGUMENTS: | ||
| type(fates_patch_type), intent(in), pointer :: patchptr ! pointer to patch object | ||
| real(r8), intent(in) :: grass_biomass_threshold ! Live grass biomass (kgC/m2) above which a patch is considered to "have grass" | ||
| ! | ||
| ! RETURN VALUE | ||
| logical :: does_patch_have_grass_bmthresh | ||
|
|
||
| does_patch_have_grass_bmthresh = patchptr%livegrass > grass_biomass_threshold | ||
|
|
||
| end function does_patch_have_grass_bmthresh | ||
|
|
||
|
|
||
| function is_patch_forest(patchptr, forest_tree_fraction_threshold, grass_biomass_threshold) | ||
| ! DESCRIPTION: | ||
| ! Return boolean: Is this patch forest according to tree cover and, optionally, grass biomass? | ||
| ! | ||
| ! ARGUMENTS: | ||
| type(fates_patch_type), intent(in), pointer :: patchptr ! pointer to patch object | ||
| real(r8), intent(in) :: forest_tree_fraction_threshold ! Tree fraction above which a patch is "forest" | ||
| real(r8), intent(in), optional :: grass_biomass_threshold ! Live grass biomass (kgC/m2) above which a patch is considered to "have grass" | ||
| ! | ||
| ! RETURN VALUE | ||
| logical :: is_patch_forest | ||
|
|
||
| is_patch_forest = does_patch_have_forest_tcthresh(patchptr, forest_tree_fraction_threshold) | ||
| if (is_patch_forest .and. present(grass_biomass_threshold)) then | ||
| is_patch_forest = .not. does_patch_have_grass_bmthresh(patchptr, grass_biomass_threshold) | ||
| end if | ||
|
||
|
|
||
| end function is_patch_forest | ||
|
|
||
|
|
||
| end module FatesEcotypesMod | ||
Uh oh!
There was an error while loading. Please reload this page.