Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
148 commits
Select commit Hold shift + click to select a range
30541e7
Add FatesEcotypesMod and support infrastructure.
samsrabin Mar 13, 2024
436d0ef
Add useful parameter files.
samsrabin Aug 16, 2024
cdd5854
Add IS_FOREST* and other useful outputs.
samsrabin Aug 13, 2024
3a72788
Avoid arrays for experimental forest definitions.
samsrabin Oct 16, 2024
a1b7ee7
is_patch_forest_tcthresh(): Handle 0-area patches.
samsrabin Oct 17, 2024
60191cf
Combine isforest functions into one.
samsrabin Oct 17, 2024
d5e9642
Add FatesEdgeForestMod and testing.
samsrabin Mar 27, 2024
f3e4e2e
Add FATES_FOREST_AREA_EB history output.
samsrabin Mar 29, 2024
15291b8
Move edge bin parameters to FATES param file.
samsrabin Apr 15, 2024
ecf7ec1
My diagnostic outputs now use group_dyna_*.
samsrabin Oct 17, 2024
54e543d
Delete unneeded use "FatesIOVariableKindMod" in FatesHistoryInterface…
samsrabin Oct 18, 2024
aa3b3b9
Fix and rename edge forest bin variables.
samsrabin Oct 18, 2024
21efc2c
Cleanup
samsrabin Oct 18, 2024
d3cd1d4
Revert "My diagnostic outputs now use group_dyna_*."
samsrabin Oct 18, 2024
b1858ab
Revert "Delete unneeded use "FatesIOVariableKindMod" in FatesHistoryI…
samsrabin Oct 18, 2024
15112f8
Revert "Revert "My diagnostic outputs now use group_dyna_*.""
samsrabin Oct 20, 2024
870d928
Move FATES_IS_FOREST_AP calc to update_history_dyn2_ageclass().
samsrabin Oct 21, 2024
a8f9da0
Revert "Revert "Delete unneeded use "FatesIOVariableKindMod" in Fates…
samsrabin Oct 21, 2024
6e0d63f
Remove ED_val_edgeforest_decay from FatesConstantsMod.
samsrabin Oct 21, 2024
e200957
Add some .cdl parameter files.
samsrabin Oct 23, 2024
69a5946
Merge branch 'refactor-history-2' into edge-area-202410
samsrabin Nov 1, 2024
fe31f1d
Remove check that edge forest param lengths match nlevedgeforest.
samsrabin Nov 4, 2024
0f73382
Remove unused edge bin param use statements.
samsrabin Nov 4, 2024
7c2ae8a
Fix error from merge of refactor-history-2.
samsrabin Nov 4, 2024
bc6c6bd
Replace edge forest parameters in code. BROKEN (intentionally).
samsrabin Nov 4, 2024
7cd5631
Add param file to work with previous.
samsrabin Nov 4, 2024
f83e79c
Merge tag 'sci.1.78.0_api.36.0.0' into edge-area-202410
samsrabin Jun 23, 2025
6ae8443
Merge tag 'sci.1.78.1_api.36.0.0' into edge-area-202410
samsrabin Jun 23, 2025
784e050
Merge tag 'sci.1.78.2_api.36.0.0' into edge-area-202410
samsrabin Jun 23, 2025
ebefc1c
Merge tag 'sci.1.79.1_api.36.1.0' into edge-area-202410
samsrabin Jun 23, 2025
9faeb35
Merge tag 'sci.1.79.1_api.36.1.0_tools.2.1.0' into edge-area-202410
samsrabin Jun 23, 2025
e4e710c
Merge tag 'sci.1.79.2_api.36.1.0' into edge-area-202410
samsrabin Jun 23, 2025
b70d12f
Merge tag 'sci.1.79.3_api.37.0.0' into edge-area-202410
samsrabin Jun 23, 2025
a0f0619
Merge tag 'sci.1.80.0_api.37.0.0' into edge-area-202410
samsrabin Jun 23, 2025
14d854a
Merge tag 'sci.1.80.10_api.37.0.0' into edge-area-202410
samsrabin Jun 23, 2025
2bcf4ad
Merge tag 'sci.1.80.11_api.37.0.0' into edge-area-202410
samsrabin Jun 23, 2025
3fc52fd
Merge tag 'sci.1.80.12_api.37.0.0' into edge-area-202410
samsrabin Jun 23, 2025
826d246
Merge tag 'sci.1.80.13_api.37.0.0' into edge-area-202410
samsrabin Jun 23, 2025
4d5e9f4
Merge tag 'sci.1.80.14_api.37.0.0' into edge-area-202410
samsrabin Jun 23, 2025
c97f24d
Merge tag 'sci.1.81.0_api.37.1.0' into edge-area-202410
samsrabin Jun 23, 2025
25d788c
Merge tag 'sci.1.81.1_api.37.1.0' into edge-area-202410
samsrabin Jun 23, 2025
b086894
Merge tag 'sci.1.81.1_api.38.0.0' into edge-area-202410
samsrabin Jun 23, 2025
c7627a7
Merge tag 'sci.1.82.4_api.39.0.0' into edge-area-202410
samsrabin Jun 23, 2025
9eef47a
Merge tag 'sci.1.82.5_api.39.0.0' into edge-area-202410
samsrabin Jun 23, 2025
b959e46
Merge tag 'sci.1.83.0_api.39.0.0' into edge-area-202410
samsrabin Jun 23, 2025
f31ebbd
Merge tag 'sci.1.83.1_api.39.0.0' into edge-area-202410
samsrabin Jun 23, 2025
d9845cd
Merge tag 'sci.1.84.0_api.40.0.0' into edge-area-202410
samsrabin Jun 23, 2025
39cc40d
Move CalculateTreeGrassAreaSite() to FatesEdgeForestMod.
samsrabin Jun 23, 2025
87f618b
Fix FatesHistoryInterfaceMod.
samsrabin Jun 23, 2025
b11baa6
Update default edge params with values from dev .cdl file.
samsrabin Jun 23, 2025
1b74e78
get_fraction_of_edgeforest_in_each_bin() is now called and uses read-…
samsrabin Jun 23, 2025
0b21684
Factor out new subroutine assign_patch_to_bins().
samsrabin Jun 30, 2025
a138ca8
Slight refactor of assign_patch_to_bins() for testing.
samsrabin Jun 30, 2025
6053313
Add a unit test of assign_patch_to_bins().
samsrabin Jun 30, 2025
7fc7a20
Merge tag 'sci.1.85.2_api.40.0.0' into edge-area-202410
samsrabin Jun 30, 2025
fe6392c
Temporarily comment out some tests that need updating.
samsrabin Jun 30, 2025
ec6d636
Fix test_assign_patch_to_bins_01.
samsrabin Jun 30, 2025
e228dc3
Trim trailing whitespace from test_EdgeForest.pf.
samsrabin Jun 30, 2025
ff96724
Add more tests of assign_patch_to_bins().
samsrabin Jun 30, 2025
f438c80
Add test_get_fraction_of_edgeforest_in_each_bin_x0.
samsrabin Jul 1, 2025
d546b41
If cell is 100% forest, it's all deep forest.
samsrabin Jul 1, 2025
55cdedf
Fix gffeb_gaussian_numerator().
samsrabin Jul 1, 2025
323e770
Add tests of get_fraction_of_edgeforest_in_each_bin().
samsrabin Jul 1, 2025
927c138
Add test_get_fraction_of_edgeforest_in_each_bin_norm().
samsrabin Jul 1, 2025
82708f8
Add test_gffeb_quadratic().
samsrabin Jul 1, 2025
4ceb9bd
Combine gaussian and lognormal num/denom functions.
samsrabin Jul 1, 2025
f656191
Add test_gffeb_gaussian_numerator().
samsrabin Jul 1, 2025
d131ac9
Add gffeb_norm() and tests.
samsrabin Jul 1, 2025
84beddc
Add "edge forest" functional test (for now just does allometry tests).
samsrabin Jul 2, 2025
9a4c719
Edge forest test now does edge forest thing. Bad, though.
samsrabin Jul 2, 2025
35a3623
Add lognormal and quadratic fits. Also bad.
samsrabin Jul 2, 2025
5583964
Print parameters for each fit.
samsrabin Jul 2, 2025
2f2f21f
Add function is_param_set().
samsrabin Jul 2, 2025
ded84c4
is_param_set(): Compare against fates_check_param_set instead of just…
samsrabin Jul 2, 2025
3b34506
Add bin num to test printout.
samsrabin Jul 2, 2025
70c8632
Fix quadratic test printout.
samsrabin Jul 2, 2025
abdcf86
Add plot of forest fraction in every bin.
samsrabin Jul 7, 2025
c1940a9
It's FRACTION nonforest, not percent.
samsrabin Jul 7, 2025
97a180f
Fix gffeb_norm_denominator().
samsrabin Jul 7, 2025
ed8d688
Fit is fraction FOREST, not fraction nonforest.
samsrabin Jul 7, 2025
3fc2a31
Replace one test values with something independent.
samsrabin Jul 7, 2025
12f21da
Add checks of edge forest parameters.
samsrabin Jul 7, 2025
9759e2f
FatesInterfaceMod: Refactor a confusing nested if-block.
samsrabin Jul 8, 2025
af1eb80
Add hlm_use_edge_forest flag.
samsrabin Jul 8, 2025
01b8be2
Explicitly import shr_infnan_isnan.
samsrabin Jul 10, 2025
2dc6817
Compare hlm_use_edge_forest to itrue.
samsrabin Jul 10, 2025
cab8e6f
Add newlines at end of new files.
samsrabin Jul 14, 2025
a72885a
Add and use utility function logical_to_real().
samsrabin Jul 14, 2025
8462bf2
Merge branch 'fix_testing_ssr' into edge-area-202410
samsrabin Jul 14, 2025
61a24ed
Make logical_to_real() public.
samsrabin Jul 14, 2025
235c88f
Functional tests: Import utils_plotting.
samsrabin Jul 16, 2025
26fb9a0
Edge forest functional test: Use new sample_colormap().
samsrabin Jul 16, 2025
471ed00
Edge forest functional test: Edge distances in legend.
samsrabin Jul 16, 2025
f8a62fd
Edge forest functional testing: Add dashed line for normalized.
samsrabin Jul 16, 2025
ec60dfb
Change longname of fates_levedge.
samsrabin Jul 16, 2025
e30b402
Delete experimental parameter files.
samsrabin Jul 16, 2025
824ec00
Clean up FATES edge forest work.
samsrabin Jul 16, 2025
118d799
Testing Python: Prep for unit tests reading param files.
samsrabin Jul 18, 2025
e88ca2a
Testing bugfix: Convert use_param_file to boolean.
samsrabin Jul 23, 2025
efcf267
GetSyntheticPatchData(): Optionally specify one patch name.
samsrabin Jul 18, 2025
3ed9356
Add Ecotypes unit test. FAILING!
samsrabin Jul 18, 2025
1327b01
Fix is_patch_forest() w/ grass biomass. FIXES ecotypes test.
samsrabin Jul 19, 2025
2b63956
Testing: Print final parameter file path.
samsrabin Jul 23, 2025
db5bea4
Merge branch 'main' into edge-area-202410
samsrabin Jul 23, 2025
a5f5a3b
Merge tag 'sci.1.87.0_api.41.0.0' into edge-area-202410
samsrabin Aug 25, 2025
4d3b7d4
Don't set nlevedgeforest=1 if hlm_use_edge_forest false.
samsrabin Sep 9, 2025
bd774ca
Save fire weather vars in fire_weather type.
samsrabin Sep 8, 2025
8075fb0
Move some fire things from Site to Patch.
samsrabin Sep 10, 2025
b00d726
Avoid avoiding bareground.
samsrabin Sep 11, 2025
bc47ef0
Separate UpdateIndex() and UpdateFireWeatherData().
samsrabin Sep 11, 2025
ceb7823
Fix UpdateRxfireBurnWindow: Wind m/s, not m/min.
samsrabin Sep 11, 2025
005b130
UpdateFireWeather: Use weather from oldest veg patch.
samsrabin Sep 12, 2025
1556cde
On patch creation, copy fire info from youngest patch (if any).
samsrabin Sep 15, 2025
9ad9f12
Ignitions outputs: Ampersands, not backslashes.
samsrabin Sep 15, 2025
f0d8e85
Bugfix: Don't double-weight NF_successful by patch area.
samsrabin Sep 15, 2025
75439f5
Append _edge to var names of per-edgebin outputs.
samsrabin Sep 16, 2025
bacfc63
Add 15 per-edgebin outputs related to fire.
samsrabin Sep 16, 2025
9b9f5d5
Bugfix: Start all area_in_edgeforest_bins at 0.
samsrabin Sep 17, 2025
56ab154
init_patches(): Don't pass younger patch in call of Patch%Create().
samsrabin Sep 17, 2025
f253eca
Add some extra error messaging at bad sum_bin_weight_of_all_patches.
samsrabin Sep 18, 2025
333fe86
Add extra condition for edge bin weight discrepancy check.
samsrabin Sep 18, 2025
d7c2556
Bugfix: Restore currentSite%rxfire_area_fuel update.
samsrabin Sep 18, 2025
a77c4c3
Initialize site%rxfire_area_f* variables to 0.
samsrabin Sep 19, 2025
18fde9b
Add output FATES_FOREST_ANYAREA_EB.
samsrabin Sep 22, 2025
b4c9732
Add outputs for 24-hour RH and wind speed of oldest veg patch.
samsrabin Sep 24, 2025
68c52f3
FatesEdgeForestMod: Add procedures for applying fire weather enhancem…
samsrabin Sep 24, 2025
1a68c3e
FatesEdgeForestMod: Add apply_edgeforest_flammability_to_patch_onevar().
samsrabin Sep 24, 2025
84dc19e
FatesEdgeForestMod: Add a TODO.
samsrabin Sep 24, 2025
6d057c4
Add edge flam enh params for temp, RH, and wind to default CDL.
samsrabin Sep 24, 2025
f4e49d3
Add fates_params_edgeflam.cdl.
samsrabin Sep 24, 2025
c0cf431
Apply edge flam enhs if doing edge forest.
samsrabin Sep 24, 2025
9917ba2
test_EdgeForest.pf: Add some no-change tests.
samsrabin Sep 26, 2025
2dad362
apply_edgeforest_flammability_to_site(): Avoid rounding diffs when no…
samsrabin Sep 26, 2025
12e8bc0
Don't enhance flammability of deep forest.
samsrabin Sep 27, 2025
d61873e
Handle fireWeather in fuse_2_patches().
samsrabin Sep 29, 2025
cbabffa
Call UpdateFireWeather() after making new patches from disturbed.
samsrabin Oct 2, 2025
5f1b0bb
Refactor to make check_change_intended().
samsrabin Oct 3, 2025
8932a70
Apply physical constraints on fire weather changes.
samsrabin Oct 3, 2025
233e525
Remove an unused 'use hlm_use_tree_damage'.
samsrabin Oct 3, 2025
7ffd6f0
Change procedure names from snake_case to PascalCase.
samsrabin Oct 3, 2025
4ac9ac1
Move GetNumberOfPatches() from FatesEdgeForestMod to ed_site_type.
samsrabin Oct 3, 2025
a8c0c35
Expand description of RankForestEdgeProximity().
samsrabin Oct 3, 2025
1476eb3
Fix docstring in edge_forest_test.py.
samsrabin Oct 3, 2025
a88bfb0
test_EdgeForest.pf: Fix test name conflict.
samsrabin Oct 3, 2025
131d93a
Ecotypes unit test: Don't read parameter file.
samsrabin Oct 3, 2025
de669c9
Revert some now-unneeded changes to testing scripts.
samsrabin Oct 4, 2025
ce99611
Merge branch 'edge-area-202410' into edge-flammability
samsrabin Oct 4, 2025
e5e8240
FatesEdgeForestMod: Convert procedures from snake_case to PascalCase.
samsrabin Oct 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions biogeochem/EDCanopyStructureMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ module EDCanopyStructureMod
use FatesInterfaceTypesMod , only : hlm_use_planthydro
use FatesInterfaceTypesMod , only : hlm_use_cohort_age_tracking
use FatesInterfaceTypesMod , only : hlm_use_sp
use FatesInterfaceTypesMod , only : hlm_use_edge_forest
use FatesInterfaceTypesMod , only : numpft
use FatesInterfaceTypesMod, only : bc_in_type
use FatesPlantHydraulicsMod, only : UpdateH2OVeg,InitHydrCohort, RecruitWaterStorage
Expand Down Expand Up @@ -1319,6 +1320,9 @@ subroutine canopy_summarization( nsites, sites, bc_in )
use FatesSizeAgeTypeIndicesMod, only : coagetype_class_index
use EDtypesMod , only : area
use FatesConstantsMod , only : itrue
use FatesEcotypesMod , only : IsPatchForest
use EDParamsMod , only : forest_tree_fraction_threshold
use FatesEdgeForestMod , only : CalculateEdgeForestArea

! !ARGUMENTS
integer , intent(in) :: nsites
Expand Down Expand Up @@ -1447,9 +1451,15 @@ subroutine canopy_summarization( nsites, sites, bc_in )
currentPatch%total_canopy_area = currentPatch%area
endif

currentPatch%is_forest = IsPatchForest(currentPatch, forest_tree_fraction_threshold)

currentPatch => currentPatch%younger
end do !patch loop

if (hlm_use_edge_forest == itrue) then
call CalculateEdgeForestArea(sites(s))
end if

call leaf_area_profile(sites(s))

if(hlm_radiation_model.eq.twostr_solver) then
Expand Down
15 changes: 12 additions & 3 deletions biogeochem/EDPatchDynamicsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,8 @@ subroutine spawn_patches( currentSite, bc_in )

call newPatch%Create(age, site_areadis, i_landusechange_receiverpatchlabel, i_nocomp_pft, &
num_swb, numpft, currentSite%nlevsoil, hlm_current_tod, &
hlm_regeneration_model)
hlm_regeneration_model, &
currentSite%youngest_patch)

! Initialize the litter pools to zero, these
! pools will be populated by looping over the existing patches
Expand Down Expand Up @@ -1442,7 +1443,7 @@ subroutine spawn_patches( currentSite, bc_in )

call buffer_patch%Create(0._r8, 0._r8, i_land_use_label, 0, &
num_swb, numpft, currentSite%nlevsoil, hlm_current_tod, &
hlm_regeneration_model)
hlm_regeneration_model, currentSite%youngest_patch)

! Initialize the litter pools to zero
do el=1,num_elements
Expand Down Expand Up @@ -1735,7 +1736,7 @@ subroutine split_patch(currentSite, currentPatch, new_patch, fraction_to_keep, a
call new_patch%Create(0._r8, temp_area, &
currentPatch%land_use_label, currentPatch%nocomp_pft_label, &
num_swb, numpft, currentSite%nlevsoil, hlm_current_tod, &
hlm_regeneration_model)
hlm_regeneration_model, currentSite%youngest_patch)

! Initialize the litter pools to zero, these
! pools will be populated shortly
Expand Down Expand Up @@ -3272,6 +3273,14 @@ subroutine fuse_2_patches(csite, dp, rp)
! Radiation
rp%rad_error(1) = (dp%rad_error(1)*dp%area + rp%rad_error(1)*rp%area) * inv_sum_area
rp%rad_error(2) = (dp%rad_error(2)*dp%area + rp%rad_error(2)*rp%area) * inv_sum_area

! Fire weather
rp%fireWeather%precip = (dp%fireWeather%precip*dp%area + rp%fireWeather%precip*rp%area) * inv_sum_area
rp%fireWeather%rh = (dp%fireWeather%rh*dp%area + rp%fireWeather%rh*rp%area) * inv_sum_area
rp%fireWeather%temp_C = (dp%fireWeather%temp_C*dp%area + rp%fireWeather%temp_C*rp%area) * inv_sum_area
rp%fireWeather%wind = (dp%fireWeather%wind*dp%area + rp%fireWeather%wind*rp%area) * inv_sum_area
rp%fireWeather%fire_weather_index = (dp%fireWeather%fire_weather_index*dp%area + rp%fireWeather%fire_weather_index*rp%area) * inv_sum_area
rp%fireWeather%effective_windspeed = (dp%fireWeather%effective_windspeed*dp%area + rp%fireWeather%effective_windspeed*rp%area) * inv_sum_area

rp%area = rp%area + dp%area !THIS MUST COME AT THE END!

Expand Down
50 changes: 47 additions & 3 deletions biogeochem/FatesPatchMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ module FatesPatchMod
use FatesRadiationMemMod, only : num_rad_stream_types
use FatesInterfaceTypesMod, only : hlm_hio_ignore_val
use FatesInterfaceTypesMod, only : numpft
use FatesInterfaceTypesMod, only : nlevedgeforest
use SFFireWeatherMod, only : fire_weather
use SFNesterovMod, only : nesterov_index
use shr_infnan_mod, only : nan => shr_infnan_nan, assignment(=)
use shr_log_mod, only : errMsg => shr_log_errMsg

Expand Down Expand Up @@ -74,6 +77,12 @@ module FatesPatchMod

!---------------------------------------------------------------------------

! FOREST INFO
logical :: is_forest ! whether the patch is "forest" according to FATES param file criteria
real(r8), dimension(:), allocatable :: area_in_edgeforest_bins

!---------------------------------------------------------------------------

! RUNNING MEANS
!class(rmean_type), pointer :: t2m ! place-holder for 2m air temperature (variable window-size)
class(rmean_type), pointer :: tveg24 ! 24-hour mean vegetation temperature [K]
Expand Down Expand Up @@ -201,9 +210,17 @@ module FatesPatchMod
!---------------------------------------------------------------------------

! FUELS AND FIRE
! fire weather
class(fire_weather), pointer :: fireWeather ! fire weather object

! fuel characteristics
real(r8) :: livegrass ! total aboveground grass biomass in patch [kgC/m2]

! number of fires
real(r8) :: fdi ! daily probability an ignition event will start a fire
real(r8) :: NF ! daily ignitions in km2
real(r8) :: NF_successful ! daily ignitions in km2 that actually lead to fire

! fire spread
real(r8) :: ros_front ! rate of forward spread of fire [m/min]
real(r8) :: ros_back ! rate of backward spread of fire [m/min]
Expand Down Expand Up @@ -258,7 +275,7 @@ module FatesPatchMod

!===========================================================================

subroutine Init(this, num_swb, num_levsoil)
subroutine Init(this, num_swb, num_levsoil, from_patch_for_fire)
!
! DESCRIPTION:
! Initialize a new patch - allocate arrays and set values to nan and/or 0.0
Expand All @@ -268,6 +285,7 @@ subroutine Init(this, num_swb, num_levsoil)
class(fates_patch_type), intent(inout) :: this ! patch object
integer, intent(in) :: num_swb ! number of shortwave broad-bands to track
integer, intent(in) :: num_levsoil ! number of soil layers
class(fates_patch_type), intent(in), optional :: from_patch_for_fire ! patch to take fire info from

! allocate arrays
allocate(this%tr_soil_dir(num_swb))
Expand All @@ -279,6 +297,21 @@ subroutine Init(this, num_swb, num_levsoil)
allocate(this%sabs_dir(num_swb))
allocate(this%sabs_dif(num_swb))
allocate(this%fragmentation_scaler(num_levsoil))
allocate(this%area_in_edgeforest_bins(nlevedgeforest))

! allocate and copy or initialize patch-level fire info
allocate(nesterov_index :: this%fireWeather)
if (present(from_patch_for_fire)) then
call this%fireWeather%CopyFrom(from_patch_for_fire%fireWeather)
this%FDI = from_patch_for_fire%FDI
this%NF = from_patch_for_fire%NF
this%NF_successful = from_patch_for_fire%NF_successful
else
call this%fireWeather%Init()
this%FDI = 0.0_r8
this%NF = 0.0_r8
this%NF_successful = 0.0_r8
end if

! initialize all values to nan
call this%NanValues()
Expand Down Expand Up @@ -453,6 +486,10 @@ subroutine NanValues(this)
this%ncl_p = fates_unset_int
this%land_use_label = fates_unset_int
this%age_since_anthro_disturbance = nan

! FOREST INFO
this%is_forest = .false.
this%area_in_edgeforest_bins(:) = nan

! LEAF ORGANIZATION
this%pft_agb_profile(:,:) = nan
Expand Down Expand Up @@ -706,7 +743,7 @@ end subroutine InitLitter
!===========================================================================

subroutine Create(this, age, area, land_use_label, nocomp_pft, num_swb, num_pft, &
num_levsoil, current_tod, regeneration_model)
num_levsoil, current_tod, regeneration_model, from_patch_for_fire)
!
! DESCRIPTION:
! create a new patch with input and default values
Expand All @@ -723,10 +760,15 @@ subroutine Create(this, age, area, land_use_label, nocomp_pft, num_swb, num_pft,
integer, intent(in) :: num_levsoil ! number of soil layers
integer, intent(in) :: current_tod ! time of day [seconds past 0Z]
integer, intent(in) :: regeneration_model ! regeneration model version
class(fates_patch_type), intent(in), optional :: from_patch_for_fire ! patch to take fire info from

! initialize patch
! sets all values to nan, then some values to zero
call this%Init(num_swb, num_levsoil)
if (present(from_patch_for_fire)) then
call this%Init(num_swb, num_levsoil, from_patch_for_fire)
else
call this%Init(num_swb, num_levsoil)
end if

! initialize running means for patch
call this%InitRunningMeans(current_tod, regeneration_model, num_pft)
Expand Down Expand Up @@ -898,6 +940,7 @@ subroutine FreeMemory(this, regeneration_model, numpft)
this%sabs_dir, &
this%sabs_dif, &
this%fragmentation_scaler, &
this%area_in_edgeforest_bins, &
stat=istat, errmsg=smsg)

! These arrays are allocated via a call from EDCanopyStructureMod
Expand Down Expand Up @@ -1227,6 +1270,7 @@ subroutine Dump(this)
write(fates_log(),*) 'pa%ncl_p = ',this%ncl_p
write(fates_log(),*) 'pa%total_canopy_area = ',this%total_canopy_area
write(fates_log(),*) 'pa%total_tree_area = ',this%total_tree_area
write(fates_log(),*) 'pa%is_forest = ',this%is_forest
write(fates_log(),*) 'pa%total_grass_area = ',this%total_grass_area
write(fates_log(),*) 'pa%zstar = ',this%zstar
write(fates_log(),*) 'pa%gnd_alb_dif = ',this%gnd_alb_dif(:)
Expand Down
4 changes: 0 additions & 4 deletions fire/SFEquationsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -442,10 +442,6 @@ real(r8) function AreaBurnt(fire_size, num_ignitions, FDI)
! daily area burnt = size fires in m2 * num ignitions per day per km2 * prob ignition starts fire
! Thonicke 2010 Eq. 1
!
! the denominator in the units of currentSite%NF is total gridcell area, but since we assume that ignitions
! are equally probable across patches, currentSite%NF is equivalently per area of a given patch
! thus AreaBurnt has units of m2 burned area per km2 patch area per day
!
! TO DO: Connect here with the Li & Levis GDP fire suppression algorithm.
! Equation 16 in arora and boer model JGR 2005
!
Expand Down
67 changes: 50 additions & 17 deletions fire/SFFireWeatherMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,17 @@ module SFFireWeatherMod
real(r8) :: effective_windspeed ! effective wind speed, corrected for by tree/grass cover [m/min]
integer :: rx_flag ! prescribed fire burn window flag [1=burn window present; 0=no burn window]

real(r8) :: temp_C ! daily averaged temperature [deg C]
real(r8) :: precip ! daily precip [mm/day]
real(r8) :: rh ! daily relative humidity [%]
real(r8) :: wind ! wind speed [m/min]

contains

procedure(initialize_fire_weather), public, deferred :: Init
procedure(update_fire_weather), public, deferred :: UpdateIndex
procedure(copy_fire_weather), public, deferred :: CopyFrom
procedure(update_fire_weather_index), public, deferred :: UpdateIndex
procedure, public :: UpdateFireWeatherData
procedure, public :: UpdateEffectiveWindSpeed
procedure, public :: UpdateRxfireBurnWindow

Expand All @@ -30,25 +37,49 @@ subroutine initialize_fire_weather(this)

end subroutine initialize_fire_weather

subroutine update_fire_weather(this, temp_C, precip, rh, wind)
subroutine copy_fire_weather(this, from)

import :: fire_weather

class(fire_weather), intent(inout) :: this
class(fire_weather), intent(in) :: from

end subroutine copy_fire_weather

subroutine update_fire_weather_index(this)

use FatesConstantsMod, only : r8 => fates_r8

import :: fire_weather

class(fire_weather), intent(inout) :: this
real(r8), intent(in) :: temp_C
real(r8), intent(in) :: precip
real(r8), intent(in) :: rh
real(r8), intent(in) :: wind

end subroutine update_fire_weather
end subroutine update_fire_weather_index

end interface

contains

subroutine UpdateEffectiveWindSpeed(this, wind_speed, tree_fraction, grass_fraction, &
subroutine UpdateFireWeatherData(this, temp_C, precip, rh, wind)
!
! DESCRIPTION:
! Updates fire weather variables

! ARGUMENTS
class(fire_weather), intent(inout) :: this ! fire weather class
real(r8), intent(in) :: temp_C ! daily averaged temperature [degrees C]
real(r8), intent(in) :: precip ! daily precipitation [mm]
real(r8), intent(in) :: rh ! daily relative humidity [%]
real(r8), intent(in) :: wind ! daily wind speed [m/min]

this%temp_C = temp_C
this%precip = precip
this%rh = rh
this%wind = wind

end subroutine UpdateFireWeatherData

subroutine UpdateEffectiveWindSpeed(this, tree_fraction, grass_fraction, &
bare_fraction)
!
! DESCRIPTION:
Expand All @@ -60,25 +91,23 @@ subroutine UpdateEffectiveWindSpeed(this, wind_speed, tree_fraction, grass_fract

! ARGUMENTS
class(fire_weather), intent(inout) :: this ! fire weather class
real(r8), intent(in) :: wind_speed ! wind speed [m/min]
real(r8), intent(in) :: tree_fraction ! tree fraction [0-1]
real(r8), intent(in) :: grass_fraction ! grass fraction [0-1]
real(r8), intent(in) :: bare_fraction ! bare ground fraction [0-1]

this%effective_windspeed = wind_speed*(tree_fraction*wind_atten_treed + &
this%effective_windspeed = this%wind * (tree_fraction*wind_atten_treed + &
(grass_fraction + bare_fraction)*wind_atten_grass)

end subroutine UpdateEffectiveWindSpeed

subroutine UpdateRxfireBurnWindow(this, rxfire_switch, temp_C, rh, wind, temp_up, &
subroutine UpdateRxfireBurnWindow(this, rxfire_switch, temp_up, &
temp_low,rh_up, rh_low, wind_up, wind_low)

use FatesConstantsMod, only : sec_per_min

! ARGUMENTS
class(fire_weather), intent(inout) :: this ! fire weather class
real(r8), intent(in) :: temp_C ! daily averaged temperature [degrees C]
integer, intent(in) :: rxfire_switch ! whether prescribed fire is turned on
real(r8), intent(in) :: rh ! daily relative humidity [%]
real(r8), intent(in) :: wind ! wind speed [m/min]
real(r8), intent(in) :: temp_up ! user defined upper bound for temp when define a burn window
real(r8), intent(in) :: temp_low ! user defined lower bound for temp when define a burn window
real(r8), intent(in) :: rh_up ! user defined upper bound for relative humidity
Expand All @@ -87,21 +116,25 @@ subroutine UpdateRxfireBurnWindow(this, rxfire_switch, temp_C, rh, wind, temp_up
real(r8), intent(in) :: wind_low ! user defined lower bound for wind speed

! LOCAL VARIABLES
real(r8) :: wind_m_per_s ! wind speed (m/s)
real(r8) :: t_check ! intermediate value derived from temp condition check
real(r8) :: rh_check ! intermediate value derived from RH condition check
real(r8) :: ws_check ! intermediate value derived from wind speed condition check

if (rxfire_switch .eq. ifalse) return

! Convert from m/min to m/s
wind_m_per_s = this%wind / sec_per_min

! check if ambient temperature, relative humidity, and wind speed
! are within user defined ranges by comparing current weather
! condition to the lower and upper bounds defined. when within range,
! it should result in negative value or zero (at the boundary condition)
! for each check below

t_check = (temp_C - temp_low)*(temp_C - temp_up)
rh_check = (rh - rh_low)*(rh - rh_up)
ws_check = (wind - wind_low)*(wind - wind_up)
t_check = (this%temp_C - temp_low)*(this%temp_C - temp_up)
rh_check = (this%rh - rh_low)*(this%rh - rh_up)
ws_check = (wind_m_per_s - wind_low)*(wind_m_per_s - wind_up)

if (t_check <= 0.0_r8 .and. rh_check <= 0.0_r8 .and. ws_check <= 0.0_r8) then
this%rx_flag = 1
Expand Down
Loading