From d98f99bc0616c1459de297bc72501164d6d8d26a Mon Sep 17 00:00:00 2001 From: rosiealice Date: Thu, 14 Mar 2024 04:32:19 -0600 Subject: [PATCH 01/33] title for emission factors parameter --- parameter_files/fates_params_default.cdl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/parameter_files/fates_params_default.cdl b/parameter_files/fates_params_default.cdl index e288664751..e38e2e7271 100644 --- a/parameter_files/fates_params_default.cdl +++ b/parameter_files/fates_params_default.cdl @@ -261,6 +261,9 @@ variables: double fates_fire_crown_kill(fates_pft) ; fates_fire_crown_kill:units = "NA" ; fates_fire_crown_kill:long_name = "fire parameter, see equation 22 in Thonicke et al 2010" ; + double fates_fire_emission_factors(fates_pft,n_fire_emissions) ; + fates_fire_emission_factors:units = "kg emission/m2/s" ; + fates_fire_emission_factors:long_name = "Emissions factors for FATES PFTs" ; double fates_frag_fnrt_fcel(fates_pft) ; fates_frag_fnrt_fcel:units = "fraction" ; fates_frag_fnrt_fcel:long_name = "Fine root litter cellulose fraction" ; From ea19afe3105c0da1703f0b566a8169f3853a408e Mon Sep 17 00:00:00 2001 From: rosiealice Date: Thu, 14 Mar 2024 05:25:54 -0600 Subject: [PATCH 02/33] created variables for emission factors and injection heights --- parameter_files/fates_params_default.cdl | 27 +++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/parameter_files/fates_params_default.cdl b/parameter_files/fates_params_default.cdl index e38e2e7271..44f50f8245 100644 --- a/parameter_files/fates_params_default.cdl +++ b/parameter_files/fates_params_default.cdl @@ -14,6 +14,7 @@ dimensions: fates_plant_organs = 4 ; fates_string_length = 60 ; fates_landuseclass = 5 ; + fates_nemission_factors = 10 ; variables: double fates_history_ageclass_bin_edges(fates_history_age_bins) ; fates_history_ageclass_bin_edges:units = "yr" ; @@ -261,9 +262,14 @@ variables: double fates_fire_crown_kill(fates_pft) ; fates_fire_crown_kill:units = "NA" ; fates_fire_crown_kill:long_name = "fire parameter, see equation 22 in Thonicke et al 2010" ; - double fates_fire_emission_factors(fates_pft,n_fire_emissions) ; + double fates_fire_emission_factors(fates_pft,fates_nemission_factors) ; fates_fire_emission_factors:units = "kg emission/m2/s" ; - fates_fire_emission_factors:long_name = "Emissions factors for FATES PFTs" ; + fates_fire_emission_factors:long_name = "Emissions factors for FATES PFTs" ; + + double fates_fire_emission_height(fates_pft) ; + fates_fire_emission_height:units = "m" ; + fates_fire_emission_height:long_name = "Height of emissions from fire per PFT" ; + double fates_frag_fnrt_fcel(fates_pft) ; fates_frag_fnrt_fcel:units = "fraction" ; fates_frag_fnrt_fcel:long_name = "Fine root litter cellulose fraction" ; @@ -1141,6 +1147,21 @@ data: fates_fire_crown_kill = 0.775, 0.775, 0.775, 0.775, 0.775, 0.775, 0.775, 0.775, 0.775, 0.775, 0.775, 0.775 ; +fates_fire_emission_factors = + 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, + 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, + 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, + 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, + 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, + 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, + 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, + 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, + 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, + 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5 ; + +fates_fire_emission_heights = + 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5 ; + fates_frag_fnrt_fcel = 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5 ; @@ -1366,7 +1387,7 @@ data: fates_phen_drought_threshold = -152957.4, -152957.4, -152957.4, -152957.4, -152957.4, -152957.4, -152957.4, -152957.4, -152957.4, -152957.4, - -152957.4, -152957.4 ; + -152957.4, -152957.4 ; fates_phen_evergreen = 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0 ; From b0113a337a9f6b897b3724397cb5bf130707ef88 Mon Sep 17 00:00:00 2001 From: rosiealice Date: Thu, 14 Mar 2024 06:07:08 -0600 Subject: [PATCH 03/33] added compound names to PFT file --- parameter_files/fates_params_default.cdl | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/parameter_files/fates_params_default.cdl b/parameter_files/fates_params_default.cdl index 44f50f8245..2ee718905b 100644 --- a/parameter_files/fates_params_default.cdl +++ b/parameter_files/fates_params_default.cdl @@ -14,7 +14,7 @@ dimensions: fates_plant_organs = 4 ; fates_string_length = 60 ; fates_landuseclass = 5 ; - fates_nemission_factors = 10 ; + fates_nemission_factors = 13 ; variables: double fates_history_ageclass_bin_edges(fates_history_age_bins) ; fates_history_ageclass_bin_edges:units = "yr" ; @@ -262,6 +262,10 @@ variables: double fates_fire_crown_kill(fates_pft) ; fates_fire_crown_kill:units = "NA" ; fates_fire_crown_kill:long_name = "fire parameter, see equation 22 in Thonicke et al 2010" ; + char fates_fire_emission_compound_name)(fates_pft, fates_string_length) ; + fates_fire_emission_compound_name:units = "unitless - string" ; + fates_fire_emission_compound_name = "Description of fire emission compounds" ; + double fates_fire_emission_factors(fates_pft,fates_nemission_factors) ; fates_fire_emission_factors:units = "kg emission/m2/s" ; fates_fire_emission_factors:long_name = "Emissions factors for FATES PFTs" ; @@ -1147,6 +1151,21 @@ data: fates_fire_crown_kill = 0.775, 0.775, 0.775, 0.775, 0.775, 0.775, 0.775, 0.775, 0.775, 0.775, 0.775, 0.775 ; +fates_fire_emission_compound_name = + "CO2", + "CO", + "CH4", + "NHMC", + "H2", + "NOX", + "N2O", + "PM25", + "TPM", + "TC", + "OC", + "BC", + "SO2" ; + fates_fire_emission_factors = 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, From 42d8cf33febcea71167c5aaf5bcd67266bc8a392 Mon Sep 17 00:00:00 2001 From: rosiealice Date: Thu, 14 Mar 2024 06:39:13 -0600 Subject: [PATCH 04/33] mapped emission factors into FATES PFT space --- parameter_files/fates_params_default.cdl | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/parameter_files/fates_params_default.cdl b/parameter_files/fates_params_default.cdl index 2ee718905b..050fcbfb5c 100644 --- a/parameter_files/fates_params_default.cdl +++ b/parameter_files/fates_params_default.cdl @@ -1165,18 +1165,20 @@ fates_fire_emission_compound_name = "OC", "BC", "SO2" ; - + fates_fire_emission_factors = - 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, - 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, - 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, - 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, - 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, - 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, - 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, - 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, - 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, - 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5 ; + 1580, 103.2, 6.8, 8.1, 3.8, 1.85, 0.2, 9.1, 8.5, 6, 5.2, 0.63, 0.5 7, + 1569, 106.7, 4.7, 5.7, 1.81, 3, 0.26, 13, 17.6, 8.3, 9.1, 0.56, 1, + 1569, 106.7, 4.7, 5.7, 1.81, 3, 0.26, 13, 17.6, 8.3, 9.1, 0.56, 1, + 1569, 106.7, 4.7, 5.7, 1.81, 3, 0.26, 13, 17.6, 8.3, 9.1, 0.56, 1, + 1580, 103.2, 6.8, 8.1, 3.8, 1.85, 0.2, 9.1, 8.5, 6, 5.2, 0.63, 0.5, 7, + 1569, 106.7, 4.7, 5.7, 1.81, 3, 0.26, 13, 17.6, 8.3, 9.1, 0.56, 1, + 1663, 61.6, 2.2, 3.4, 0.99, 2.35, 0.21, 4.9, 8.5, 3.7, 3.2, 0.46, 0.71, + 1663, 61.6, 2.2, 3.4, 0.99, 2.35, 0.21, 4.9, 8.5, 3.7, 3.2, 0.46, 0.71, + 1663, 61.6, 2.2, 3.4, 0.99, 2.35, 0.21, 4.9, 8.5, 3.7, 3.2, 0.46, 0.71, + 1663, 61.6, 2.2, 3.4, 0.99, 2.35, 0.21, 4.9, 8.5, 3.7, 3.2, 0.46, 0.71, + 1663, 61.6, 2.2, 3.4, 0.99, 2.35, 0.21, 4.9, 8.5, 3.7, 3.2, 0.46, 0.71, + 1663, 61.6, 2.2, 3.4, 0.99, 2.35, 0.21, 4.9, 8.5, 3.7, 3.2, 0.46, 0.71, fates_fire_emission_heights = 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5 ; From bcd874a81b4c47e99ae6b49d216e2de09612ac7f Mon Sep 17 00:00:00 2001 From: rosiealice Date: Thu, 14 Mar 2024 07:06:13 -0600 Subject: [PATCH 05/33] mapped fates emission heights from CTSM --- parameter_files/fates_params_default.cdl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/parameter_files/fates_params_default.cdl b/parameter_files/fates_params_default.cdl index 050fcbfb5c..96e4d3e40d 100644 --- a/parameter_files/fates_params_default.cdl +++ b/parameter_files/fates_params_default.cdl @@ -1180,8 +1180,7 @@ fates_fire_emission_factors = 1663, 61.6, 2.2, 3.4, 0.99, 2.35, 0.21, 4.9, 8.5, 3.7, 3.2, 0.46, 0.71, 1663, 61.6, 2.2, 3.4, 0.99, 2.35, 0.21, 4.9, 8.5, 3.7, 3.2, 0.46, 0.71, -fates_fire_emission_heights = - 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5 ; + fates_fire_emission_heights = 2500, 4000, 3000, 3000, 2500, 3000, 2000, 2000, 2000, 1000, 1000, 1000 ; fates_frag_fnrt_fcel = 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5 ; From 5bdc569bba54be48b6ffe3ab979cdbc99d904969 Mon Sep 17 00:00:00 2001 From: rosiealice Date: Thu, 14 Mar 2024 07:11:46 -0600 Subject: [PATCH 06/33] minor whitespace correction --- parameter_files/fates_params_default.cdl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parameter_files/fates_params_default.cdl b/parameter_files/fates_params_default.cdl index 96e4d3e40d..832f348c94 100644 --- a/parameter_files/fates_params_default.cdl +++ b/parameter_files/fates_params_default.cdl @@ -1407,7 +1407,7 @@ fates_fire_emission_factors = fates_phen_drought_threshold = -152957.4, -152957.4, -152957.4, -152957.4, -152957.4, -152957.4, -152957.4, -152957.4, -152957.4, -152957.4, - -152957.4, -152957.4 ; + -152957.4, -152957.4 ; fates_phen_evergreen = 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0 ; From 57c5e7a0a6692578bb4f0593635dd64166c339c3 Mon Sep 17 00:00:00 2001 From: rosiealice Date: Thu, 14 Mar 2024 07:14:16 -0600 Subject: [PATCH 07/33] more whitespace changes --- parameter_files/fates_params_default.cdl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parameter_files/fates_params_default.cdl b/parameter_files/fates_params_default.cdl index 832f348c94..f57ae2ecdf 100644 --- a/parameter_files/fates_params_default.cdl +++ b/parameter_files/fates_params_default.cdl @@ -1407,7 +1407,7 @@ fates_fire_emission_factors = fates_phen_drought_threshold = -152957.4, -152957.4, -152957.4, -152957.4, -152957.4, -152957.4, -152957.4, -152957.4, -152957.4, -152957.4, - -152957.4, -152957.4 ; + -152957.4, -152957.4 ; fates_phen_evergreen = 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0 ; From b8ec55519c1dab0ab9e2c5960deff642acdf6dcd Mon Sep 17 00:00:00 2001 From: rosiealice Date: Thu, 14 Mar 2024 07:15:29 -0600 Subject: [PATCH 08/33] more whitespace changes --- parameter_files/fates_params_default.cdl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parameter_files/fates_params_default.cdl b/parameter_files/fates_params_default.cdl index f57ae2ecdf..832f348c94 100644 --- a/parameter_files/fates_params_default.cdl +++ b/parameter_files/fates_params_default.cdl @@ -1407,7 +1407,7 @@ fates_fire_emission_factors = fates_phen_drought_threshold = -152957.4, -152957.4, -152957.4, -152957.4, -152957.4, -152957.4, -152957.4, -152957.4, -152957.4, -152957.4, - -152957.4, -152957.4 ; + -152957.4, -152957.4 ; fates_phen_evergreen = 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0 ; From 3048976e5a3cacf792b7beac9e6bb9904d2dbfe6 Mon Sep 17 00:00:00 2001 From: rosiealice Date: Thu, 14 Mar 2024 08:04:16 -0600 Subject: [PATCH 09/33] Code now should read in the PFT indexed emission variables --- main/EDPftvarcon.F90 | 32 +++++++++++++++++++++--- main/FatesParametersInterface.F90 | 1 + parameter_files/fates_params_default.cdl | 4 +-- 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/main/EDPftvarcon.F90 b/main/EDPftvarcon.F90 index 5745141c70..945ae7f56f 100644 --- a/main/EDPftvarcon.F90 +++ b/main/EDPftvarcon.F90 @@ -147,7 +147,9 @@ module EDPftvarcon ! ------------------------------------------------------------------------------------------- real(r8), allocatable :: fire_alpha_SH(:) ! spitfire parameter, alpha scorch height ! Equation 16 Thonicke et al 2010 - + real(r8), allocatable :: fire_emission_factors(:,:) ! emission factorss indexed by PFT and emission type/species. g emissions/m2/s per kg biomass burned. + real(r8), allocatable :: fire_emission_heights(:) ! heights that fire emissions are injected into the atmosphere (m) + ! Non-PARTEH Allometry Parameters ! -------------------------------------------------------------------------------------------- @@ -352,7 +354,8 @@ subroutine Register_PFT(this, fates_params) use FatesParametersInterface, only : fates_parameters_type, param_string_length use FatesParametersInterface, only : dimension_name_pft, dimension_shape_1d - use FatesParametersInterface, only : dimension_name_hlm_pftno, dimension_shape_2d + use FatesParametersInterface, only : dimension_name_hlm_pftno, dimension_name_nemission_compounds + use FatesParametersInterface, only : dimension_shape_2d implicit none @@ -361,7 +364,8 @@ subroutine Register_PFT(this, fates_params) character(len=param_string_length), parameter :: dim_names(1) = (/dimension_name_pft/) character(len=param_string_length) :: pftmap_dim_names(2) - + character(len=param_string_length) :: emission_factors_dim_names(2) + integer, parameter :: dim_lower_bound(1) = (/ lower_bound_pft /) @@ -511,6 +515,18 @@ subroutine Register_PFT(this, fates_params) call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, & dimension_names=dim_names, lower_bounds=dim_lower_bound) + ! adding the hlm_pft_map variable with two dimensions - FATES PFTno and N emission factors + emission_factors_dim_names(1) = dimension_name_pft + emission_factors_dim_names(2) = dimension_name_nemission_compounds + + name = 'fates_fire_emission_factors' + call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_2d, & + dimension_names=emission_factors_dim_names, lower_bounds=dim_lower_bound) + + name = 'fates_fire_emission_heights' + call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, & + dimension_names=dim_names, lower_bounds=dim_lower_bound) + name = 'fates_allom_frbstor_repro' call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_1d, & dimension_names=dim_names, lower_bounds=dim_lower_bound) @@ -952,6 +968,14 @@ subroutine Receive_PFT(this, fates_params) call fates_params%RetrieveParameterAllocate(name=name, & data=this%fire_alpha_SH) + name = 'fates_fire_emission_factors' + call fates_params%RetrieveParameterAllocate(name=name, & + data=this%fire_emission_factors) + + name = 'fates_fire_emission_heights' + call fates_params%RetrieveParameterAllocate(name=name, & + data=this%fates_fire_emission_heights) + name = 'fates_allom_frbstor_repro' call fates_params%RetrieveParameterAllocate(name=name, & data=this%allom_frbstor_repro) @@ -1716,6 +1740,8 @@ subroutine FatesReportPFTParams(is_master) write(fates_log(),fmt0) 'phen_flush_fraction',EDpftvarcon_inst%phenflush_fraction write(fates_log(),fmt0) 'phen_cold_size_threshold = ',EDPftvarcon_inst%phen_cold_size_threshold write(fates_log(),fmt0) 'fire_alpha_SH = ',EDPftvarcon_inst%fire_alpha_SH + write(fates_log(),fmt0) 'fire_emission_factors = ',EDPftvarcon_inst%fire_emission_factors + write(fates_log(),fmt0) 'fire_emission_factors = ',EDPftvarcon_inst%fire_emission_heights write(fates_log(),fmt0) 'allom_frbstor_repro = ',EDPftvarcon_inst%allom_frbstor_repro write(fates_log(),fmt0) 'hydro_p_taper = ',EDPftvarcon_inst%hydr_p_taper write(fates_log(),fmt0) 'hydro_rs2 = ',EDPftvarcon_inst%hydr_rs2 diff --git a/main/FatesParametersInterface.F90 b/main/FatesParametersInterface.F90 index aa0ef85287..019304725f 100644 --- a/main/FatesParametersInterface.F90 +++ b/main/FatesParametersInterface.F90 @@ -39,6 +39,7 @@ module FatesParametersInterface character(len=*), parameter, public :: dimension_name_history_damage_bins = 'fates_history_damage_bins' character(len=*), parameter, public :: dimension_name_damage = 'fates_damage_class' character(len=*), parameter, public :: dimension_name_landuse = 'fates_landuseclass' + character(len=*), parameter, public :: dimension_name_nemission_factors = 'fates_nemission_compounds' ! Dimensions in the host namespace: character(len=*), parameter, public :: dimension_name_host_allpfts = 'allpfts' diff --git a/parameter_files/fates_params_default.cdl b/parameter_files/fates_params_default.cdl index 832f348c94..cdc00eb4ac 100644 --- a/parameter_files/fates_params_default.cdl +++ b/parameter_files/fates_params_default.cdl @@ -14,7 +14,7 @@ dimensions: fates_plant_organs = 4 ; fates_string_length = 60 ; fates_landuseclass = 5 ; - fates_nemission_factors = 13 ; + fates_nemission_compounds = 13 ; variables: double fates_history_ageclass_bin_edges(fates_history_age_bins) ; fates_history_ageclass_bin_edges:units = "yr" ; @@ -266,7 +266,7 @@ variables: fates_fire_emission_compound_name:units = "unitless - string" ; fates_fire_emission_compound_name = "Description of fire emission compounds" ; - double fates_fire_emission_factors(fates_pft,fates_nemission_factors) ; + double fates_fire_emission_factors(fates_pft,fates_nemission_compounds) ; fates_fire_emission_factors:units = "kg emission/m2/s" ; fates_fire_emission_factors:long_name = "Emissions factors for FATES PFTs" ; From 3351e640ceddf6af675306adacb1e31bc916162d Mon Sep 17 00:00:00 2001 From: rosiealice Date: Thu, 14 Mar 2024 08:47:32 -0600 Subject: [PATCH 10/33] bug fixes --- main/EDPftvarcon.F90 | 4 ++-- main/FatesParametersInterface.F90 | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/main/EDPftvarcon.F90 b/main/EDPftvarcon.F90 index 945ae7f56f..34028f2f8d 100644 --- a/main/EDPftvarcon.F90 +++ b/main/EDPftvarcon.F90 @@ -974,7 +974,7 @@ subroutine Receive_PFT(this, fates_params) name = 'fates_fire_emission_heights' call fates_params%RetrieveParameterAllocate(name=name, & - data=this%fates_fire_emission_heights) + data=this%fire_emission_heights) name = 'fates_allom_frbstor_repro' call fates_params%RetrieveParameterAllocate(name=name, & @@ -1275,7 +1275,7 @@ subroutine Register_PFT_numrad(this, fates_params) ! arrays. We have to register the parameters as 1-d arrays as they ! are on the parameter file. We store them as 2-d in the receive step. use FatesParametersInterface, only : fates_parameters_type, param_string_length - use FatesParametersInterface, only : dimension_name_pft, dimension_shape_1d + use FatesParametersInterface, only : dimension_name_pft, dimension_name_nemission_compounds, dimension_shape_1d implicit none diff --git a/main/FatesParametersInterface.F90 b/main/FatesParametersInterface.F90 index 019304725f..51112d1bf9 100644 --- a/main/FatesParametersInterface.F90 +++ b/main/FatesParametersInterface.F90 @@ -39,7 +39,7 @@ module FatesParametersInterface character(len=*), parameter, public :: dimension_name_history_damage_bins = 'fates_history_damage_bins' character(len=*), parameter, public :: dimension_name_damage = 'fates_damage_class' character(len=*), parameter, public :: dimension_name_landuse = 'fates_landuseclass' - character(len=*), parameter, public :: dimension_name_nemission_factors = 'fates_nemission_compounds' + character(len=*), parameter, public :: dimension_name_nemission_compounds = 'fates_nemission_compounds' ! Dimensions in the host namespace: character(len=*), parameter, public :: dimension_name_host_allpfts = 'allpfts' From ae75ff27dcd9d5df36f4c5cfcdd0a50fa7eb4566 Mon Sep 17 00:00:00 2001 From: rosiealice Date: Thu, 14 Mar 2024 10:53:20 -0600 Subject: [PATCH 11/33] skeleton fire emissions subroutine --- fire/SFMainMod.F90 | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/fire/SFMainMod.F90 b/fire/SFMainMod.F90 index ef245b04f9..4af5aef69a 100644 --- a/fire/SFMainMod.F90 +++ b/fire/SFMainMod.F90 @@ -62,6 +62,7 @@ module SFMainMod public :: crown_damage public :: cambial_damage_kill public :: post_fire_mortality + public :: fire_emissions ! The following parameter represents one of the values of hlm_spitfire_mode ! and more of these appear in subroutine area_burnt_intensity below @@ -1118,5 +1119,37 @@ subroutine post_fire_mortality ( currentSite ) end subroutine post_fire_mortality + !***************************************************************** + subroutine fire_emissions ( currentSite ) + !***************************************************************** + type(ed_site_type), intent(in), target :: currentSite + + type(fates_patch_type), pointer :: currentPatch + type(fates_cohort_type), pointer :: currentCohort + + currentPatch => currentSite%oldest_patch + if(use_fates_nocomp.eq.true)then + ! Do not do fire emissions if we are not in nocomp mode + !this capability has not been added yet. + + do while(associated(currentPatch)) + if(currentPatch%nocomp_pft_label .ne. nocomp_bareground)then + biomass_burned = currentPatch%TFC_ROS / 0.45_r8 ! kg biomass/m2/day + !n.b. does this also need to include the amount of tree canopy consumed? + + do c = 1, nemission_compounds + emission_factor = EDPftvarcon_inst%fire_emission_factors(currentPatch%nocomp_pft_label,c) + currentPatch%fire_emissions(c) = biomass_burned * emission_factor + end do + + currentPatch%fire_emission_height = EDPftvarcon_inst%fire_emission_height(currentPatch%nocomp_pft_label) + + currentPatch => currentPatch%younger + + enddo !end patch loop + end if ! is nocomp + + end subroutine fire_emissions + ! ============================================================================ end module SFMainMod From eaa0e694bbea9cd8dd312c1285abcf62488bc26b Mon Sep 17 00:00:00 2001 From: rosiealice Date: Thu, 14 Mar 2024 15:37:29 -0600 Subject: [PATCH 12/33] add hardwired num_emission_compounds --- main/EDTypesMod.F90 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main/EDTypesMod.F90 b/main/EDTypesMod.F90 index 34e5f319d7..8881f6c273 100644 --- a/main/EDTypesMod.F90 +++ b/main/EDTypesMod.F90 @@ -1,4 +1,5 @@ module EDTypesMod + 1;95;0c use FatesConstantsMod, only : r8 => fates_r8 use FatesGlobals, only : endrun => fates_endrun @@ -82,7 +83,8 @@ module EDTypesMod ! The actual number of soil layers should not exceed this - + ! FIRE EMISSIONS + integer , parameter, public :: num_emission_compounds = 13 ! BIOLOGY/BIOGEOCHEMISTRY integer , parameter, public :: num_vegtemp_mem = 10 ! Window of time over which we track temp for cold sensecence (days) @@ -340,6 +342,7 @@ module EDTypesMod real(r8) :: NF ! daily ignitions in km2 real(r8) :: NF_successful ! daily ignitions in km2 that actually lead to fire + ! PLANT HYDRAULICS type(ed_site_hydr_type), pointer :: si_hydr From cef84f4ffb94442751b5028e317a131c7b67d687 Mon Sep 17 00:00:00 2001 From: rosiealice Date: Thu, 14 Mar 2024 15:38:31 -0600 Subject: [PATCH 13/33] register dimension_name_nemission_compounds --- main/EDParamsMod.F90 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main/EDParamsMod.F90 b/main/EDParamsMod.F90 index beaf11e140..04ce1fb007 100644 --- a/main/EDParamsMod.F90 +++ b/main/EDParamsMod.F90 @@ -369,7 +369,7 @@ subroutine FatesRegisterParams(fates_params) use FatesParametersInterface, only : dimension_name_history_size_bins, dimension_name_history_age_bins use FatesParametersInterface, only : dimension_name_history_height_bins, dimension_name_hydr_organs use FatesParametersInterface, only : dimension_name_history_coage_bins, dimension_name_history_damage_bins - use FatesParametersInterface, only : dimension_shape_scalar, dimension_name_landuse + use FatesParametersInterface, only : dimension_shape_scalar, dimension_name_landuse, dimension_name_nemission_compounds implicit none @@ -384,7 +384,8 @@ subroutine FatesRegisterParams(fates_params) character(len=param_string_length), parameter :: dim_names_hydro_organs(1) = (/dimension_name_hydr_organs/) character(len=param_string_length), parameter :: dim_names_damageclass(1)= (/dimension_name_history_damage_bins/) character(len=param_string_length), parameter :: dim_names_landuse(1)= (/dimension_name_landuse/) - + character(len=param_string_length), parameter :: dim_names_nemission_compounds(1)= (/dimension_name_nemission_compounds/) + call FatesParamsInit() call fates_params%RegisterParameter(name=ED_name_photo_temp_acclim_timescale, dimension_shape=dimension_shape_scalar, & From 21171aea2f0415d6a13ddad73f41298fa3e1290e Mon Sep 17 00:00:00 2001 From: rosiealice Date: Thu, 14 Mar 2024 15:45:48 -0600 Subject: [PATCH 14/33] created fire_emissions_pa variable --- main/FatesInterfaceMod.F90 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/main/FatesInterfaceMod.F90 b/main/FatesInterfaceMod.F90 index 7b5b72ad9e..f4de824add 100644 --- a/main/FatesInterfaceMod.F90 +++ b/main/FatesInterfaceMod.F90 @@ -25,6 +25,7 @@ module FatesInterfaceMod use EDParamsMod , only : maxpft use EDTypesMod , only : do_fates_salinity use EDTypesMod , only : numWaterMem + use EDTypesMod , only : num_emission_compounds use EDTypesMod , only : numlevsoil_max use EDTypesMod , only : ed_site_type use FatesPatchMod , only : fates_patch_type @@ -386,6 +387,7 @@ subroutine zero_bcs(fates,s) fates%bc_out(s)%htop_pa(:) = 0.0_r8 fates%bc_out(s)%hbot_pa(:) = 0.0_r8 fates%bc_out(s)%displa_pa(:) = 0.0_r8 + fates%bc_out(s)%fire_emissions_pa(:,:) = 0.0_r8 fates%bc_out(s)%z0m_pa(:) = 0.0_r8 fates%bc_out(s)%dleaf_pa(:) = 0.0_r8 fates%bc_out(s)%nocomp_pft_label_pa(:) = 0 @@ -705,12 +707,15 @@ subroutine allocate_bcout(bc_out, nlevsoil_in, nlevdecomp_in) allocate(bc_out%displa_pa(maxpatch_total)) allocate(bc_out%z0m_pa(maxpatch_total)) - + allocate(bc_out%canopy_fraction_pa(maxpatch_total)) allocate(bc_out%frac_veg_nosno_alb_pa(maxpatch_total)) allocate(bc_out%nocomp_pft_label_pa(maxpatch_total)) + ! Fire emissions + allocate(bc_out%fire_emissions_pa(maxpatch_total,num_emission_compounds)) + ! Plant-Hydro BC's if (hlm_use_planthydro.eq.itrue) then allocate(bc_out%qflx_soil2root_sisl(nlevsoil_in)) From f899aa53782c7bce6b713ad70b4364a310954d5f Mon Sep 17 00:00:00 2001 From: rosiealice Date: Thu, 14 Mar 2024 15:46:54 -0600 Subject: [PATCH 15/33] create fire_emisions_pa --- main/FatesInterfaceTypesMod.F90 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main/FatesInterfaceTypesMod.F90 b/main/FatesInterfaceTypesMod.F90 index 6e9779dcac..b7e919719f 100644 --- a/main/FatesInterfaceTypesMod.F90 +++ b/main/FatesInterfaceTypesMod.F90 @@ -715,6 +715,8 @@ module FatesInterfaceTypesMod real(r8), allocatable :: htop_pa(:) ! top of the canopy [m] real(r8), allocatable :: hbot_pa(:) ! bottom of canopy? [m] + real(r8), allocatable :: fire_emisions_pa(:,:) ! Fire emissions per compound + real(r8), allocatable :: z0m_pa(:) ! roughness length [m] real(r8), allocatable :: displa_pa(:) ! displacement height [m] real(r8), allocatable :: dleaf_pa(:) ! leaf characteristic dimension/width/diameter [m] From 694f49d699a57696d95370fea36f746536f2355e Mon Sep 17 00:00:00 2001 From: rosiealice Date: Thu, 14 Mar 2024 15:48:03 -0600 Subject: [PATCH 16/33] link to num_emission_compounds in SFMain --- fire/SFMainMod.F90 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fire/SFMainMod.F90 b/fire/SFMainMod.F90 index 4af5aef69a..ddbb0e3360 100644 --- a/fire/SFMainMod.F90 +++ b/fire/SFMainMod.F90 @@ -1122,6 +1122,8 @@ end subroutine post_fire_mortality !***************************************************************** subroutine fire_emissions ( currentSite ) !***************************************************************** + + use EDTypesMod , only : num_emission_compounds type(ed_site_type), intent(in), target :: currentSite type(fates_patch_type), pointer :: currentPatch @@ -1137,7 +1139,7 @@ subroutine fire_emissions ( currentSite ) biomass_burned = currentPatch%TFC_ROS / 0.45_r8 ! kg biomass/m2/day !n.b. does this also need to include the amount of tree canopy consumed? - do c = 1, nemission_compounds + do c = 1, num_emission_compounds emission_factor = EDPftvarcon_inst%fire_emission_factors(currentPatch%nocomp_pft_label,c) currentPatch%fire_emissions(c) = biomass_burned * emission_factor end do From aca34a36cea1a0764152018367fda504da318eac Mon Sep 17 00:00:00 2001 From: rosiealice Date: Thu, 14 Mar 2024 15:56:48 -0600 Subject: [PATCH 17/33] add fire emission variables to FatesPatch type. --- biogeochem/FatesPatchMod.F90 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/biogeochem/FatesPatchMod.F90 b/biogeochem/FatesPatchMod.F90 index d86e5c5d51..6eb93c9456 100644 --- a/biogeochem/FatesPatchMod.F90 +++ b/biogeochem/FatesPatchMod.F90 @@ -17,6 +17,7 @@ module FatesPatchMod use PRTGenericMod, only : num_elements use PRTGenericMod, only : element_list use EDParamsMod, only : nlevleaf, nclmax, maxpft + use EDTypesMod, only : num_emission_compounds use FatesConstantsMod, only : n_dbh_bins, n_dist_types use FatesConstantsMod, only : t_water_freeze_k_1atm use FatesRunningMeanMod, only : ema_24hr, fixed_24hr, ema_lpa, ema_longterm @@ -216,7 +217,9 @@ module FatesPatchMod real(r8) :: frac_burnt ! fraction burnt [0-1/day] real(r8) :: tfc_ros ! total intensity-relevant fuel consumed - no trunks [kgC/m2 of burned ground/day] real(r8) :: burnt_frac_litter(nfsc) ! fraction of each litter pool burned, conditional on it being burned [0-1] - + real(r8) :: fire_emission_height ! Height of fire emissions into the atmsophere. m. + real(r8) :: fire_emissions(num_emission_compounds) ! Emissions from fires. g emissions/m2/day + !--------------------------------------------------------------------------- ! PLANT HYDRAULICS (not currently used in hydraulics RGK 03-2018) From a6d0f4db67ee167473e610ebef9b6d4f8a2c6876 Mon Sep 17 00:00:00 2001 From: rosiealice Date: Thu, 14 Mar 2024 16:15:01 -0600 Subject: [PATCH 18/33] link FATES patch emission variable to bc_out fates interface emission variable --- biogeochem/EDCanopyStructureMod.F90 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/biogeochem/EDCanopyStructureMod.F90 b/biogeochem/EDCanopyStructureMod.F90 index 23d851ea92..aaba10ffef 100644 --- a/biogeochem/EDCanopyStructureMod.F90 +++ b/biogeochem/EDCanopyStructureMod.F90 @@ -1879,6 +1879,7 @@ subroutine update_hlm_dynamics(nsites,sites,fcolumn,bc_out) bc_out(s)%dleaf_pa(:) = 0._r8 bc_out(s)%z0m_pa(:) = 0._r8 bc_out(s)%displa_pa(:) = 0._r8 + bc_out(s)%fire_emissions_pa(:,:) = 0._r8 currentPatch => sites(s)%oldest_patch c = fcolumn(s) @@ -1933,6 +1934,12 @@ subroutine update_hlm_dynamics(nsites,sites,fcolumn,bc_out) currentCohort => currentCohort%taller end do + do c = 1, num_emission_compounds + !is this in the right place in the code? + !what else do we need to do with restarts to not mess up the first day of emissions? + bc_out(s)%fire_emissions_pa(ifp,c) = currentPatch%fire_emissions(c) / secs_per_day + end do + ! make sure there is some leaf and stem area if (total_patch_leaf_stem_area > nearzero) then currentCohort => currentPatch%shortest From df3a1c3131c33d42a329c4148433d8731f03781f Mon Sep 17 00:00:00 2001 From: rosiealice Date: Thu, 14 Mar 2024 16:16:50 -0600 Subject: [PATCH 19/33] link FATES patch emission height variable to bc_out fates interface emission height variable --- biogeochem/EDCanopyStructureMod.F90 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/biogeochem/EDCanopyStructureMod.F90 b/biogeochem/EDCanopyStructureMod.F90 index aaba10ffef..f0795f4769 100644 --- a/biogeochem/EDCanopyStructureMod.F90 +++ b/biogeochem/EDCanopyStructureMod.F90 @@ -1880,6 +1880,7 @@ subroutine update_hlm_dynamics(nsites,sites,fcolumn,bc_out) bc_out(s)%z0m_pa(:) = 0._r8 bc_out(s)%displa_pa(:) = 0._r8 bc_out(s)%fire_emissions_pa(:,:) = 0._r8 + bc_out(s)%fire_emission_height_pa = 0._r8 currentPatch => sites(s)%oldest_patch c = fcolumn(s) @@ -1939,6 +1940,7 @@ subroutine update_hlm_dynamics(nsites,sites,fcolumn,bc_out) !what else do we need to do with restarts to not mess up the first day of emissions? bc_out(s)%fire_emissions_pa(ifp,c) = currentPatch%fire_emissions(c) / secs_per_day end do + bc_out(s)%fire_emission_height_pa(ifp) = currentPatch%fire_emission_height ! make sure there is some leaf and stem area if (total_patch_leaf_stem_area > nearzero) then From ea7948c89b02b5ee4faec3e3cff2cf2331edbef6 Mon Sep 17 00:00:00 2001 From: rosiealice Date: Thu, 14 Mar 2024 16:25:14 -0600 Subject: [PATCH 20/33] added patch operations for patch fire_emissions and fire_emission_height variables --- biogeochem/EDPatchDynamicsMod.F90 | 4 ++++ main/EDInitMod.F90 | 3 +++ 2 files changed, 7 insertions(+) diff --git a/biogeochem/EDPatchDynamicsMod.F90 b/biogeochem/EDPatchDynamicsMod.F90 index 140c108d66..ed0167673d 100644 --- a/biogeochem/EDPatchDynamicsMod.F90 +++ b/biogeochem/EDPatchDynamicsMod.F90 @@ -2763,6 +2763,10 @@ subroutine fuse_2_patches(csite, dp, rp) rp%tau_l = (dp%tau_l*dp%area + rp%tau_l*rp%area) * inv_sum_area rp%fuel_frac(:) = (dp%fuel_frac(:)*dp%area + rp%fuel_frac(:)*rp%area) * inv_sum_area rp%tfc_ros = (dp%tfc_ros*dp%area + rp%tfc_ros*rp%area) * inv_sum_area + rp%fire_emission_height = (dp%fire_emission_height*dp%area + rp%fire_emission_height*rp%area) * inv_sum_area + do c = 1, num_emission_compounds + rp%fire_emissions(c) = (dp%fire_emissions(c)*dp%area + rp%fire_emissions(c)*rp%area) * inv_sum_area + enddo rp%fi = (dp%fi*dp%area + rp%fi*rp%area) * inv_sum_area rp%fd = (dp%fd*dp%area + rp%fd*rp%area) * inv_sum_area rp%ros_back = (dp%ros_back*dp%area + rp%ros_back*rp%area) * inv_sum_area diff --git a/main/EDInitMod.F90 b/main/EDInitMod.F90 index fd44f07bbe..5d772725af 100644 --- a/main/EDInitMod.F90 +++ b/main/EDInitMod.F90 @@ -831,6 +831,9 @@ subroutine init_patches( nsites, sites, bc_in) currentPatch%scorch_ht(:) = 0._r8 currentPatch%frac_burnt = 0._r8 currentPatch%burnt_frac_litter(:) = 0._r8 + currentPatch%fire_emissions(:) = 0._r8 + currentPatch%fire_emission_height = 0._r8 + currentPatch => currentPatch%older enddo From 884962dfa7bde50fb5327b6b40e1d0754762d1e8 Mon Sep 17 00:00:00 2001 From: rosiealice Date: Thu, 14 Mar 2024 17:04:07 -0600 Subject: [PATCH 21/33] bug fixes to fates parameter file --- parameter_files/fates_params_default.cdl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/parameter_files/fates_params_default.cdl b/parameter_files/fates_params_default.cdl index cdc00eb4ac..07c1e09da7 100644 --- a/parameter_files/fates_params_default.cdl +++ b/parameter_files/fates_params_default.cdl @@ -262,9 +262,9 @@ variables: double fates_fire_crown_kill(fates_pft) ; fates_fire_crown_kill:units = "NA" ; fates_fire_crown_kill:long_name = "fire parameter, see equation 22 in Thonicke et al 2010" ; - char fates_fire_emission_compound_name)(fates_pft, fates_string_length) ; + char fates_fire_emission_compound_name(fates_nemission_compounds, fates_string_length) ; fates_fire_emission_compound_name:units = "unitless - string" ; - fates_fire_emission_compound_name = "Description of fire emission compounds" ; + fates_fire_emission_compound_name:long_name = "Description of fire emission compounds" ; double fates_fire_emission_factors(fates_pft,fates_nemission_compounds) ; fates_fire_emission_factors:units = "kg emission/m2/s" ; @@ -1167,7 +1167,7 @@ fates_fire_emission_compound_name = "SO2" ; fates_fire_emission_factors = - 1580, 103.2, 6.8, 8.1, 3.8, 1.85, 0.2, 9.1, 8.5, 6, 5.2, 0.63, 0.5 7, + 1580, 103.2, 6.8, 8.1, 3.8, 1.85, 0.2, 9.1, 8.5, 6, 5.2, 0.63, 0.5, 7, 1569, 106.7, 4.7, 5.7, 1.81, 3, 0.26, 13, 17.6, 8.3, 9.1, 0.56, 1, 1569, 106.7, 4.7, 5.7, 1.81, 3, 0.26, 13, 17.6, 8.3, 9.1, 0.56, 1, 1569, 106.7, 4.7, 5.7, 1.81, 3, 0.26, 13, 17.6, 8.3, 9.1, 0.56, 1, @@ -1178,7 +1178,7 @@ fates_fire_emission_factors = 1663, 61.6, 2.2, 3.4, 0.99, 2.35, 0.21, 4.9, 8.5, 3.7, 3.2, 0.46, 0.71, 1663, 61.6, 2.2, 3.4, 0.99, 2.35, 0.21, 4.9, 8.5, 3.7, 3.2, 0.46, 0.71, 1663, 61.6, 2.2, 3.4, 0.99, 2.35, 0.21, 4.9, 8.5, 3.7, 3.2, 0.46, 0.71, - 1663, 61.6, 2.2, 3.4, 0.99, 2.35, 0.21, 4.9, 8.5, 3.7, 3.2, 0.46, 0.71, + 1663, 61.6, 2.2, 3.4, 0.99, 2.35, 0.21, 4.9, 8.5, 3.7, 3.2, 0.46, 0.71; fates_fire_emission_heights = 2500, 4000, 3000, 3000, 2500, 3000, 2000, 2000, 2000, 1000, 1000, 1000 ; From 45ff801272f2db492dc4708b9fb10d3e2c04c67a Mon Sep 17 00:00:00 2001 From: rosiealice Date: Fri, 15 Mar 2024 05:31:33 -0600 Subject: [PATCH 22/33] patch operations, take II --- biogeochem/FatesPatchMod.F90 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/biogeochem/FatesPatchMod.F90 b/biogeochem/FatesPatchMod.F90 index 6eb93c9456..4a460e373b 100644 --- a/biogeochem/FatesPatchMod.F90 +++ b/biogeochem/FatesPatchMod.F90 @@ -393,7 +393,9 @@ subroutine NanValues(this) this%frac_burnt = nan this%tfc_ros = nan this%burnt_frac_litter(:) = nan - + this%fire_emissions(:) = nan + this%fire_emission_height = nan + end subroutine NanValues !=========================================================================== @@ -469,7 +471,9 @@ subroutine ZeroValues(this) this%frac_burnt = 0.0_r8 this%tfc_ros = 0.0_r8 this%burnt_frac_litter(:) = 0.0_r8 - + this%fire_emissions(:) = 0.0_r8 + this%fire_emission_height = 0.0_r8 + end subroutine ZeroValues !=========================================================================== From 1cbb306150675fc6adbc6ffb0c4763e02dd2146a Mon Sep 17 00:00:00 2001 From: rosiealice Date: Fri, 15 Mar 2024 06:28:23 -0600 Subject: [PATCH 23/33] compilation error fixes --- main/EDPftvarcon.F90 | 2 +- main/FatesParametersInterface.F90 | 2 +- parameter_files/fates_params_default.cdl | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/main/EDPftvarcon.F90 b/main/EDPftvarcon.F90 index 945ae7f56f..6d89830694 100644 --- a/main/EDPftvarcon.F90 +++ b/main/EDPftvarcon.F90 @@ -974,7 +974,7 @@ subroutine Receive_PFT(this, fates_params) name = 'fates_fire_emission_heights' call fates_params%RetrieveParameterAllocate(name=name, & - data=this%fates_fire_emission_heights) + data=this%fire_emission_heights) name = 'fates_allom_frbstor_repro' call fates_params%RetrieveParameterAllocate(name=name, & diff --git a/main/FatesParametersInterface.F90 b/main/FatesParametersInterface.F90 index 019304725f..51112d1bf9 100644 --- a/main/FatesParametersInterface.F90 +++ b/main/FatesParametersInterface.F90 @@ -39,7 +39,7 @@ module FatesParametersInterface character(len=*), parameter, public :: dimension_name_history_damage_bins = 'fates_history_damage_bins' character(len=*), parameter, public :: dimension_name_damage = 'fates_damage_class' character(len=*), parameter, public :: dimension_name_landuse = 'fates_landuseclass' - character(len=*), parameter, public :: dimension_name_nemission_factors = 'fates_nemission_compounds' + character(len=*), parameter, public :: dimension_name_nemission_compounds = 'fates_nemission_compounds' ! Dimensions in the host namespace: character(len=*), parameter, public :: dimension_name_host_allpfts = 'allpfts' diff --git a/parameter_files/fates_params_default.cdl b/parameter_files/fates_params_default.cdl index 07c1e09da7..2f92e53ef5 100644 --- a/parameter_files/fates_params_default.cdl +++ b/parameter_files/fates_params_default.cdl @@ -1180,7 +1180,7 @@ fates_fire_emission_factors = 1663, 61.6, 2.2, 3.4, 0.99, 2.35, 0.21, 4.9, 8.5, 3.7, 3.2, 0.46, 0.71, 1663, 61.6, 2.2, 3.4, 0.99, 2.35, 0.21, 4.9, 8.5, 3.7, 3.2, 0.46, 0.71; - fates_fire_emission_heights = 2500, 4000, 3000, 3000, 2500, 3000, 2000, 2000, 2000, 1000, 1000, 1000 ; + fates_fire_emission_height = 2500, 4000, 3000, 3000, 2500, 3000, 2000, 2000, 2000, 1000, 1000, 1000 ; fates_frag_fnrt_fcel = 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5 ; From d3f00671fc5a6ec1546948751b135c4a9db9b573 Mon Sep 17 00:00:00 2001 From: rosiealice Date: Fri, 15 Mar 2024 08:37:45 -0600 Subject: [PATCH 24/33] typo in EDParams --- main/EDParamsMod.F90 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/main/EDParamsMod.F90 b/main/EDParamsMod.F90 index beaf11e140..dd2339c588 100644 --- a/main/EDParamsMod.F90 +++ b/main/EDParamsMod.F90 @@ -369,7 +369,7 @@ subroutine FatesRegisterParams(fates_params) use FatesParametersInterface, only : dimension_name_history_size_bins, dimension_name_history_age_bins use FatesParametersInterface, only : dimension_name_history_height_bins, dimension_name_hydr_organs use FatesParametersInterface, only : dimension_name_history_coage_bins, dimension_name_history_damage_bins - use FatesParametersInterface, only : dimension_shape_scalar, dimension_name_landuse + use FatesParametersInterface, only : dimension_shape_scalar, dimension_name_landuse, dimension_name_nemission_compounds implicit none @@ -384,7 +384,8 @@ subroutine FatesRegisterParams(fates_params) character(len=param_string_length), parameter :: dim_names_hydro_organs(1) = (/dimension_name_hydr_organs/) character(len=param_string_length), parameter :: dim_names_damageclass(1)= (/dimension_name_history_damage_bins/) character(len=param_string_length), parameter :: dim_names_landuse(1)= (/dimension_name_landuse/) - + character(len=param_string_length), parameter :: dim_names_nemission_compounds(1)= (/dimension_name_nemission_compounds/) + call FatesParamsInit() call fates_params%RegisterParameter(name=ED_name_photo_temp_acclim_timescale, dimension_shape=dimension_shape_scalar, & @@ -586,7 +587,8 @@ subroutine FatesRegisterParams(fates_params) call fates_params%RegisterParameter(name=ED_name_maxpatches_by_landuse, dimension_shape=dimension_shape_1d, & dimension_names=dim_names_landuse) - + + end subroutine FatesRegisterParams From 060000c8c3b44a15caed01d1073f1701ddb06b58 Mon Sep 17 00:00:00 2001 From: rosiealice Date: Fri, 15 Mar 2024 09:41:10 -0600 Subject: [PATCH 25/33] working 2d parameter inputs :) --- main/EDPftvarcon.F90 | 4 ++-- parameter_files/fates_params_default.cdl | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/main/EDPftvarcon.F90 b/main/EDPftvarcon.F90 index 6d89830694..75af37a2db 100644 --- a/main/EDPftvarcon.F90 +++ b/main/EDPftvarcon.F90 @@ -516,8 +516,8 @@ subroutine Register_PFT(this, fates_params) dimension_names=dim_names, lower_bounds=dim_lower_bound) ! adding the hlm_pft_map variable with two dimensions - FATES PFTno and N emission factors - emission_factors_dim_names(1) = dimension_name_pft - emission_factors_dim_names(2) = dimension_name_nemission_compounds + emission_factors_dim_names(2) = dimension_name_pft + emission_factors_dim_names(1) = dimension_name_nemission_compounds name = 'fates_fire_emission_factors' call fates_params%RegisterParameter(name=name, dimension_shape=dimension_shape_2d, & diff --git a/parameter_files/fates_params_default.cdl b/parameter_files/fates_params_default.cdl index 2f92e53ef5..edc5223e89 100644 --- a/parameter_files/fates_params_default.cdl +++ b/parameter_files/fates_params_default.cdl @@ -270,9 +270,9 @@ variables: fates_fire_emission_factors:units = "kg emission/m2/s" ; fates_fire_emission_factors:long_name = "Emissions factors for FATES PFTs" ; - double fates_fire_emission_height(fates_pft) ; - fates_fire_emission_height:units = "m" ; - fates_fire_emission_height:long_name = "Height of emissions from fire per PFT" ; + double fates_fire_emission_heights(fates_pft) ; + fates_fire_emission_heights:units = "m" ; + fates_fire_emission_heights:long_name = "Height of emissions from fire per PFT" ; double fates_frag_fnrt_fcel(fates_pft) ; fates_frag_fnrt_fcel:units = "fraction" ; @@ -1180,7 +1180,7 @@ fates_fire_emission_factors = 1663, 61.6, 2.2, 3.4, 0.99, 2.35, 0.21, 4.9, 8.5, 3.7, 3.2, 0.46, 0.71, 1663, 61.6, 2.2, 3.4, 0.99, 2.35, 0.21, 4.9, 8.5, 3.7, 3.2, 0.46, 0.71; - fates_fire_emission_height = 2500, 4000, 3000, 3000, 2500, 3000, 2000, 2000, 2000, 1000, 1000, 1000 ; + fates_fire_emission_heights = 2500, 4000, 3000, 3000, 2500, 3000, 2000, 2000, 2000, 1000, 1000, 1000 ; fates_frag_fnrt_fcel = 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5 ; From bbe27fd5e0279a858d3413ef58f712df569aa3c6 Mon Sep 17 00:00:00 2001 From: rosiealice Date: Fri, 15 Mar 2024 15:01:25 -0600 Subject: [PATCH 26/33] bug fixes to allow compliation --- biogeochem/EDCanopyStructureMod.F90 | 6 ++++-- biogeochem/EDPatchDynamicsMod.F90 | 1 + biogeochem/FatesPatchMod.F90 | 2 +- fire/SFMainMod.F90 | 18 +++++++++++------- main/EDParamsMod.F90 | 2 ++ main/EDTypesMod.F90 | 4 ---- main/FatesInterfaceMod.F90 | 6 ++++-- main/FatesInterfaceTypesMod.F90 | 5 +++-- 8 files changed, 26 insertions(+), 18 deletions(-) diff --git a/biogeochem/EDCanopyStructureMod.F90 b/biogeochem/EDCanopyStructureMod.F90 index f0795f4769..bc4c0adc31 100644 --- a/biogeochem/EDCanopyStructureMod.F90 +++ b/biogeochem/EDCanopyStructureMod.F90 @@ -1852,6 +1852,8 @@ subroutine update_hlm_dynamics(nsites,sites,fcolumn,bc_out) use EDTypesMod , only : ed_site_type, AREA use FatesPatchMod, only : fates_patch_type use FatesInterfaceTypesMod , only : bc_out_type + use EDParamsMod, only : num_emission_compounds + use FatesConstantsMod , only : sec_per_day ! ! !ARGUMENTS @@ -1880,7 +1882,7 @@ subroutine update_hlm_dynamics(nsites,sites,fcolumn,bc_out) bc_out(s)%z0m_pa(:) = 0._r8 bc_out(s)%displa_pa(:) = 0._r8 bc_out(s)%fire_emissions_pa(:,:) = 0._r8 - bc_out(s)%fire_emission_height_pa = 0._r8 + bc_out(s)%fire_emission_height_pa(:) = 0._r8 currentPatch => sites(s)%oldest_patch c = fcolumn(s) @@ -1938,7 +1940,7 @@ subroutine update_hlm_dynamics(nsites,sites,fcolumn,bc_out) do c = 1, num_emission_compounds !is this in the right place in the code? !what else do we need to do with restarts to not mess up the first day of emissions? - bc_out(s)%fire_emissions_pa(ifp,c) = currentPatch%fire_emissions(c) / secs_per_day + bc_out(s)%fire_emissions_pa(ifp,c) = currentPatch%fire_emissions(c) / sec_per_day end do bc_out(s)%fire_emission_height_pa(ifp) = currentPatch%fire_emission_height diff --git a/biogeochem/EDPatchDynamicsMod.F90 b/biogeochem/EDPatchDynamicsMod.F90 index ed0167673d..f8dcc11623 100644 --- a/biogeochem/EDPatchDynamicsMod.F90 +++ b/biogeochem/EDPatchDynamicsMod.F90 @@ -2688,6 +2688,7 @@ subroutine fuse_2_patches(csite, dp, rp) ! ! !USES: use FatesSizeAgeTypeIndicesMod, only: get_age_class_index + use EDParamsMod, only: num_emission_compounds ! ! !ARGUMENTS: type (ed_site_type), intent(inout),target :: csite ! Current site diff --git a/biogeochem/FatesPatchMod.F90 b/biogeochem/FatesPatchMod.F90 index 4a460e373b..6252638c65 100644 --- a/biogeochem/FatesPatchMod.F90 +++ b/biogeochem/FatesPatchMod.F90 @@ -17,7 +17,7 @@ module FatesPatchMod use PRTGenericMod, only : num_elements use PRTGenericMod, only : element_list use EDParamsMod, only : nlevleaf, nclmax, maxpft - use EDTypesMod, only : num_emission_compounds + use EDParamsMod, only : num_emission_compounds use FatesConstantsMod, only : n_dbh_bins, n_dist_types use FatesConstantsMod, only : t_water_freeze_k_1atm use FatesRunningMeanMod, only : ema_24hr, fixed_24hr, ema_lpa, ema_longterm diff --git a/fire/SFMainMod.F90 b/fire/SFMainMod.F90 index ddbb0e3360..bb19fdced3 100644 --- a/fire/SFMainMod.F90 +++ b/fire/SFMainMod.F90 @@ -1123,14 +1123,18 @@ end subroutine post_fire_mortality subroutine fire_emissions ( currentSite ) !***************************************************************** - use EDTypesMod , only : num_emission_compounds - type(ed_site_type), intent(in), target :: currentSite + use EDParamsMod , only : num_emission_compounds + use FatesInterfaceTypesMod , only : hlm_use_nocomp + type(ed_site_type), intent(in), target :: currentSite type(fates_patch_type), pointer :: currentPatch type(fates_cohort_type), pointer :: currentCohort - + real(r8) biomass_burned ! Local biomass burned variable + real(r8) emission_factor ! Local emission factor variable + integer c + currentPatch => currentSite%oldest_patch - if(use_fates_nocomp.eq.true)then + if(hlm_use_nocomp.eq..true.)then ! Do not do fire emissions if we are not in nocomp mode !this capability has not been added yet. @@ -1142,12 +1146,12 @@ subroutine fire_emissions ( currentSite ) do c = 1, num_emission_compounds emission_factor = EDPftvarcon_inst%fire_emission_factors(currentPatch%nocomp_pft_label,c) currentPatch%fire_emissions(c) = biomass_burned * emission_factor - end do + enddo - currentPatch%fire_emission_height = EDPftvarcon_inst%fire_emission_height(currentPatch%nocomp_pft_label) + currentPatch%fire_emission_height = EDPftvarcon_inst%fire_emission_heights(currentPatch%nocomp_pft_label) currentPatch => currentPatch%younger - + endif enddo !end patch loop end if ! is nocomp diff --git a/main/EDParamsMod.F90 b/main/EDParamsMod.F90 index dd2339c588..4e17345dc6 100644 --- a/main/EDParamsMod.F90 +++ b/main/EDParamsMod.F90 @@ -108,6 +108,8 @@ module EDParamsMod integer, parameter, public :: maxpft = 16 ! maximum number of PFTs allowed + integer, parameter, public :: num_emission_compounds = 13 ! number of fire emission fields calculated + real(r8),protected,public :: q10_mr ! Q10 for respiration rate (for soil fragmenation and plant respiration) (unitless) real(r8),protected,public :: q10_froz ! Q10 for frozen-soil respiration rates (for soil fragmentation) (unitless) diff --git a/main/EDTypesMod.F90 b/main/EDTypesMod.F90 index 8881f6c273..023b6e6de5 100644 --- a/main/EDTypesMod.F90 +++ b/main/EDTypesMod.F90 @@ -1,5 +1,4 @@ module EDTypesMod - 1;95;0c use FatesConstantsMod, only : r8 => fates_r8 use FatesGlobals, only : endrun => fates_endrun @@ -83,9 +82,6 @@ module EDTypesMod ! The actual number of soil layers should not exceed this - ! FIRE EMISSIONS - integer , parameter, public :: num_emission_compounds = 13 - ! BIOLOGY/BIOGEOCHEMISTRY integer , parameter, public :: num_vegtemp_mem = 10 ! Window of time over which we track temp for cold sensecence (days) diff --git a/main/FatesInterfaceMod.F90 b/main/FatesInterfaceMod.F90 index f4de824add..3f256cdd95 100644 --- a/main/FatesInterfaceMod.F90 +++ b/main/FatesInterfaceMod.F90 @@ -25,7 +25,7 @@ module FatesInterfaceMod use EDParamsMod , only : maxpft use EDTypesMod , only : do_fates_salinity use EDTypesMod , only : numWaterMem - use EDTypesMod , only : num_emission_compounds + use EDParamsMod , only : num_emission_compounds use EDTypesMod , only : numlevsoil_max use EDTypesMod , only : ed_site_type use FatesPatchMod , only : fates_patch_type @@ -388,6 +388,7 @@ subroutine zero_bcs(fates,s) fates%bc_out(s)%hbot_pa(:) = 0.0_r8 fates%bc_out(s)%displa_pa(:) = 0.0_r8 fates%bc_out(s)%fire_emissions_pa(:,:) = 0.0_r8 + fates%bc_out(s)%fire_emission_height_pa(:) = 0.0_r8 fates%bc_out(s)%z0m_pa(:) = 0.0_r8 fates%bc_out(s)%dleaf_pa(:) = 0.0_r8 fates%bc_out(s)%nocomp_pft_label_pa(:) = 0 @@ -715,7 +716,8 @@ subroutine allocate_bcout(bc_out, nlevsoil_in, nlevdecomp_in) ! Fire emissions allocate(bc_out%fire_emissions_pa(maxpatch_total,num_emission_compounds)) - + allocate(bc_out%fire_emission_height_pa(maxpatch_total)) + ! Plant-Hydro BC's if (hlm_use_planthydro.eq.itrue) then allocate(bc_out%qflx_soil2root_sisl(nlevsoil_in)) diff --git a/main/FatesInterfaceTypesMod.F90 b/main/FatesInterfaceTypesMod.F90 index b7e919719f..8c08d6cf25 100644 --- a/main/FatesInterfaceTypesMod.F90 +++ b/main/FatesInterfaceTypesMod.F90 @@ -715,8 +715,9 @@ module FatesInterfaceTypesMod real(r8), allocatable :: htop_pa(:) ! top of the canopy [m] real(r8), allocatable :: hbot_pa(:) ! bottom of canopy? [m] - real(r8), allocatable :: fire_emisions_pa(:,:) ! Fire emissions per compound - + real(r8), allocatable :: fire_emissions_pa(:,:) ! Fire emissions per compound + real(r8), allocatable :: fire_emission_height_pa(:) ! Fire emission height in atmosphere (m) + real(r8), allocatable :: z0m_pa(:) ! roughness length [m] real(r8), allocatable :: displa_pa(:) ! displacement height [m] real(r8), allocatable :: dleaf_pa(:) ! leaf characteristic dimension/width/diameter [m] From f573816d688a513ff3f5aaff6a17af99ff8fa07e Mon Sep 17 00:00:00 2001 From: Rosie Fisher Date: Mon, 18 Mar 2024 10:57:45 +0100 Subject: [PATCH 27/33] Corrected logic of the nocomp flag in fire emissions subroutine --- fire/SFMainMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fire/SFMainMod.F90 b/fire/SFMainMod.F90 index bb19fdced3..b6050f0dcc 100644 --- a/fire/SFMainMod.F90 +++ b/fire/SFMainMod.F90 @@ -1134,7 +1134,7 @@ subroutine fire_emissions ( currentSite ) integer c currentPatch => currentSite%oldest_patch - if(hlm_use_nocomp.eq..true.)then + if(hlm_use_nocomp == itrue)then ! Do not do fire emissions if we are not in nocomp mode !this capability has not been added yet. From 96559fab3122df9ae14de8b577174cfdd477cbe2 Mon Sep 17 00:00:00 2001 From: rosiealice Date: Tue, 19 Mar 2024 02:28:41 -0600 Subject: [PATCH 28/33] adding fire emissions call to this branch --- fire/SFMainMod.F90 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fire/SFMainMod.F90 b/fire/SFMainMod.F90 index b6050f0dcc..8ce8b9395d 100644 --- a/fire/SFMainMod.F90 +++ b/fire/SFMainMod.F90 @@ -111,6 +111,7 @@ subroutine fire_model( currentSite, bc_in) call crown_damage(currentSite) call cambial_damage_kill(currentSite) call post_fire_mortality(currentSite) + call fire_emissions(currentSite) end if end subroutine fire_model @@ -1149,7 +1150,9 @@ subroutine fire_emissions ( currentSite ) enddo currentPatch%fire_emission_height = EDPftvarcon_inst%fire_emission_heights(currentPatch%nocomp_pft_label) - + if(currentPatch%fire_emissions(c).gt.0.0_r8)then + write(*,*) 'postivie emissionssf',currentPatch%fire_emissions(1),biomass_burned + endif currentPatch => currentPatch%younger endif enddo !end patch loop From 9b0fab5a146bc289c6644accb914aaf94e80f833 Mon Sep 17 00:00:00 2001 From: rosiealice Date: Tue, 19 Mar 2024 05:32:40 -0600 Subject: [PATCH 29/33] new history variable code. compiles --- main/FatesHistoryInterfaceMod.F90 | 78 ++++++++++++++++++++++++++++--- main/FatesHistoryVariableType.F90 | 8 +++- main/FatesIODimensionsMod.F90 | 8 +++- main/FatesIOVariableKindMod.F90 | 1 + 4 files changed, 86 insertions(+), 9 deletions(-) diff --git a/main/FatesHistoryInterfaceMod.F90 b/main/FatesHistoryInterfaceMod.F90 index 41ab2ca1b6..e2cfa5c259 100644 --- a/main/FatesHistoryInterfaceMod.F90 +++ b/main/FatesHistoryInterfaceMod.F90 @@ -406,7 +406,8 @@ module FatesHistoryInterfaceMod integer :: ih_fire_fuel_mef_si integer :: ih_sum_fuel_si integer :: ih_fragmentation_scaler_sl - + integer :: ih_fire_emission_height_si + integer :: ih_nplant_si_scpf integer :: ih_gpp_si_scpf integer :: ih_npp_totl_si_scpf @@ -666,6 +667,9 @@ module FatesHistoryInterfaceMod integer :: ih_burnt_frac_litter_si_fuel integer :: ih_fuel_amount_si_fuel + ! indices to (site x emissions) variables + integer :: ih_fire_emissions_si_emis + ! indices to (site x cwd size class) variables integer :: ih_cwd_ag_si_cwdsc integer :: ih_cwd_bg_si_cwdsc @@ -761,7 +765,8 @@ module FatesHistoryInterfaceMod integer, private :: levscls_index_, levpft_index_, levage_index_ integer, private :: levfuel_index_, levcwdsc_index_, levscag_index_ integer, private :: levcan_index_, levcnlf_index_, levcnlfpft_index_ - integer, private :: levcdpf_index_, levcdsc_index_, levcdam_index_ + integer, private :: levcdpf_index_, levcdsc_index_, levcdam_index_ + integer, private :: levemis_index_ integer, private :: levscagpft_index_, levagepft_index_ integer, private :: levheight_index_, levagefuel_index_ integer, private :: levelem_index_, levelpft_index_ @@ -793,6 +798,7 @@ module FatesHistoryInterfaceMod procedure :: levcacls_index procedure :: levpft_index procedure :: levage_index + procedure :: levemis_index procedure :: levfuel_index procedure :: levcwdsc_index procedure :: levcan_index @@ -828,6 +834,7 @@ module FatesHistoryInterfaceMod procedure, private :: set_levscls_index procedure, private :: set_levpft_index procedure, private :: set_levage_index + procedure, private :: set_levemis_index procedure, private :: set_levfuel_index procedure, private :: set_levcwdsc_index procedure, private :: set_levcan_index @@ -874,7 +881,7 @@ subroutine Init(this, num_threads, fates_bounds) use FatesIODimensionsMod, only : column, levsoil, levscpf use FatesIODimensionsMod, only : levscls, levpft, levage - use FatesIODimensionsMod, only : levcacls, levcapf + use FatesIODimensionsMod, only : levcacls, levcapf, levemis use FatesIODimensionsMod, only : levfuel, levcwdsc, levscag use FatesIODimensionsMod, only : levscagpft, levagepft use FatesIODimensionsMod, only : levcan, levcnlf, levcnlfpft @@ -933,6 +940,11 @@ subroutine Init(this, num_threads, fates_bounds) call this%dim_bounds(dim_count)%Init(levage, num_threads, & fates_bounds%age_class_begin, fates_bounds%age_class_end) + dim_count = dim_count + 1 + call this%set_levemis_index(dim_count) + call this%dim_bounds(dim_count)%Init(levemis, num_threads, & + fates_bounds%emis_class_begin, fates_bounds%emis_class_end) + dim_count = dim_count + 1 call this%set_levfuel_index(dim_count) call this%dim_bounds(dim_count)%Init(levfuel, num_threads, & @@ -1086,6 +1098,10 @@ subroutine SetThreadBoundsEach(this, thread_index, thread_bounds) call this%dim_bounds(index)%SetThreadBounds(thread_index, & thread_bounds%age_class_begin, thread_bounds%age_class_end) + index = this%levemis_index() + call this%dim_bounds(index)%SetThreadBounds(thread_index, & + thread_bounds%emis_class_begin, thread_bounds%emis_class_end) + index = this%levfuel_index() call this%dim_bounds(index)%SetThreadBounds(thread_index, & thread_bounds%fuel_begin, thread_bounds%fuel_end) @@ -1177,7 +1193,7 @@ subroutine assemble_history_output_types(this) use FatesIOVariableKindMod, only : site_r8, site_soil_r8, site_size_pft_r8 use FatesIOVariableKindMod, only : site_size_r8, site_pft_r8, site_age_r8 - use FatesIOVariableKindMod, only : site_coage_r8, site_coage_pft_r8 + use FatesIOVariableKindMod, only : site_coage_r8, site_coage_pft_r8, site_emis_r8 use FatesIOVariableKindMod, only : site_fuel_r8, site_cwdsc_r8, site_scag_r8 use FatesIOVariableKindMod, only : site_scagpft_r8, site_agepft_r8 use FatesIOVariableKindMod, only : site_can_r8, site_cnlf_r8, site_cnlfpft_r8 @@ -1216,6 +1232,9 @@ subroutine assemble_history_output_types(this) call this%set_dim_indices(site_age_r8, 1, this%column_index()) call this%set_dim_indices(site_age_r8, 2, this%levage_index()) + call this%set_dim_indices(site_emis_r8, 1, this%column_index()) + call this%set_dim_indices(site_emis_r8, 2, this%levemis_index()) + call this%set_dim_indices(site_fuel_r8, 1, this%column_index()) call this%set_dim_indices(site_fuel_r8, 2, this%levfuel_index()) @@ -1432,6 +1451,21 @@ integer function levage_index(this) class(fates_history_interface_type), intent(in) :: this levage_index = this%levage_index_ end function levage_index + +! ======================================================================= + subroutine set_levemis_index(this, index) + implicit none + class(fates_history_interface_type), intent(inout) :: this + integer, intent(in) :: index + this%levemis_index_ = index + end subroutine set_levemis_index + + integer function levemis_index(this) + implicit none + class(fates_history_interface_type), intent(in) :: this + levemis_index = this%levemis_index_ + end function levemis_index + ! ======================================================================= subroutine set_levfuel_index(this, index) @@ -1875,7 +1909,7 @@ subroutine init_dim_kinds_maps(this) ! ---------------------------------------------------------------------------------- use FatesIOVariableKindMod, only : site_r8, site_soil_r8, site_size_pft_r8 use FatesIOVariableKindMod, only : site_size_r8, site_pft_r8, site_age_r8 - use FatesIOVariableKindMod, only : site_coage_r8, site_coage_pft_r8 + use FatesIOVariableKindMod, only : site_coage_r8, site_coage_pft_r8, site_emis_r8 use FatesIOVariableKindMod, only : site_fuel_r8, site_cwdsc_r8, site_scag_r8 use FatesIOVariableKindMod, only : site_scagpft_r8, site_agepft_r8 use FatesIOVariableKindMod, only : site_can_r8, site_cnlf_r8, site_cnlfpft_r8 @@ -1924,6 +1958,10 @@ subroutine init_dim_kinds_maps(this) ! site x patch-age class index = index + 1 call this%dim_kinds(index)%Init(site_age_r8, 2) + + ! site x patch-age class + index = index + 1 + call this%dim_kinds(index)%Init(site_emis_r8, 2) ! site x fuel size class index = index + 1 @@ -2228,7 +2266,7 @@ subroutine update_history_dyn(this,nc,nsites,sites,bc_in) use FatesSizeAgeTypeIndicesMod, only : get_cdamagesize_class_index use FatesSizeAgeTypeIndicesMod, only : get_cdamagesizepft_class_index use FatesSizeAgeTypeIndicesMod, only : coagetype_class_index - + use EDParamsMod , only : num_emission_compounds use EDParamsMod , only : nlevleaf use EDParamsMod , only : ED_val_history_height_bin_edges use FatesInterfaceTypesMod , only : nlevdamage @@ -2258,6 +2296,7 @@ subroutine update_history_dyn(this,nc,nsites,sites,bc_in) integer :: i_scpf,i_pft,i_scls ! iterators for scpf, pft, and scls dims integer :: i_cacls, i_capf ! iterators for cohort age and cohort age x pft integer :: i_cwd,i_fuel ! iterators for cwd and fuel dims + integer :: i_emis ! iterators for emissions class integer :: iscag ! size-class x age index integer :: iscagpft ! size-class x age x pft index integer :: iagepft ! age x pft index @@ -2366,6 +2405,8 @@ subroutine update_history_dyn(this,nc,nsites,sites,bc_in) hio_fire_fuel_eff_moist_si => this%hvars(ih_fire_fuel_eff_moist_si)%r81d, & hio_fire_fuel_sav_si => this%hvars(ih_fire_fuel_sav_si)%r81d, & hio_fire_fuel_mef_si => this%hvars(ih_fire_fuel_mef_si)%r81d, & + hio_fire_emissions_si_em => this%hvars(ih_fire_emissions_si_emis)%r82d, & + hio_fire_emission_height_si => this%hvars(ih_fire_emission_height_si)%r81d, & hio_sum_fuel_si => this%hvars(ih_sum_fuel_si)%r81d, & hio_fragmentation_scaler_sl => this%hvars(ih_fragmentation_scaler_sl)%r82d, & hio_litter_in_si => this%hvars(ih_litter_in_si)%r81d, & @@ -3808,7 +3849,16 @@ subroutine update_history_dyn(this,nc,nsites,sites,bc_in) cpatch%burnt_frac_litter(i_fuel) * cpatch%frac_burnt * cpatch%area * AREA_INV end do + ! Update fire emissions variables + + do i_emis = 1,num_emission_compounds + hio_fire_emissions_si_em(io_si, i_emis) = hio_fire_emissions_si_em(io_si,i_emis) + & + cpatch%fire_emissions(i_emis) * cpatch%area * AREA_INV + enddo + hio_fire_emission_height_si(io_si) = hio_fire_emission_height_si(io_si) + & + cpatch%fire_emission_height * cpatch%area * AREA_INV + hio_fire_intensity_area_product_si(io_si) = hio_fire_intensity_area_product_si(io_si) + & cpatch%FI * cpatch%frac_burnt * cpatch%area * AREA_INV * J_per_kJ @@ -5351,7 +5401,7 @@ subroutine define_history_vars(this, initialize_variables) use FatesIOVariableKindMod, only : site_r8, site_soil_r8, site_size_pft_r8 use FatesIOVariableKindMod, only : site_size_r8, site_pft_r8, site_age_r8 - use FatesIOVariableKindMod, only : site_coage_pft_r8, site_coage_r8 + use FatesIOVariableKindMod, only : site_coage_pft_r8, site_coage_r8, site_emis_r8 use FatesIOVariableKindMod, only : site_height_r8, site_agefuel_r8 use FatesInterfaceTypesMod , only : hlm_use_planthydro @@ -5382,6 +5432,7 @@ subroutine define_history_vars(this, initialize_variables) ! canopy layer (site_can_r8) : CL ! coarse woody debris size (site_cwdsc_r8) : DC ! element (site_elem_r8) : EL + ! fire emissions class (site_emis_r8) : EM ! leaf layer : LL ! fuel class (site_fuel_r8) : FC ! height (site_height_r8) : HT @@ -5925,6 +5976,19 @@ subroutine define_history_vars(this, initialize_variables) hlms='CLM:ALM', upfreq=1, ivar=ivar, initialize=initialize_variables, & index = ih_burnt_frac_litter_si_fuel) + call this%set_history_var(vname='FATES_FIRE_EMISSIONS_EM', units='kg m-2 s-1', & + long='Fire emissions per emissions compound. ', & + use_default='active', avgflag='A', vtype=site_emis_r8, hlms='CLM:ALM', & + upfreq=1, ivar=ivar, initialize=initialize_variables, & + index = ih_fire_emissions_si_emis) + + call this%set_history_var(vname='FATES_FIRE_EMISSION_HEIGHT', units='m', & + long='Fire emissions per emissions compound. ', & + use_default='active', avgflag='A', vtype=site_r8, hlms='CLM:ALM', & + upfreq=1, ivar=ivar, initialize=initialize_variables, & + index = ih_fire_emission_height_si) + + ! Litter Variables call this%set_history_var(vname='FATES_LITTER_IN', units='kg m-2 s-1', & diff --git a/main/FatesHistoryVariableType.F90 b/main/FatesHistoryVariableType.F90 index 83cbdb8c1c..f7c96dab14 100644 --- a/main/FatesHistoryVariableType.F90 +++ b/main/FatesHistoryVariableType.F90 @@ -7,7 +7,7 @@ module FatesHistoryVariableType use FatesIOVariableKindMod, only : fates_io_variable_kind_type use FatesIOVariableKindMod, only : site_r8, site_soil_r8, site_size_pft_r8 use FatesIOVariableKindMod, only : site_size_r8, site_pft_r8, site_age_r8 - use FatesIOVariableKindMod, only : site_coage_r8, site_coage_pft_r8 + use FatesIOVariableKindMod, only : site_coage_r8, site_coage_pft_r8, site_emis_r8 use FatesIOVariableKindMod, only : site_height_r8 use FatesIOVariableKindMod, only : site_fuel_r8, site_cwdsc_r8, site_scag_r8 use FatesIOVariableKindMod, only : site_scagpft_r8, site_agepft_r8 @@ -145,6 +145,10 @@ subroutine Init(this, vname, units, long, use_default, & allocate(this%r82d(lb1:ub1, lb2:ub2)) this%r82d(:,:) = flushval + case(site_emis_r8) + allocate(this%r82d(lb1:ub1, lb2:ub2)) + this%r82d(:,:) = flushval + case(site_height_r8) allocate(this%r82d(lb1:ub1, lb2:ub2)) this%r82d(:,:) = flushval @@ -313,6 +317,8 @@ subroutine Flush(this, thread, dim_bounds, dim_kinds) this%r82d(lb1:ub1, lb2:ub2) = this%flushval case(site_age_r8) this%r82d(lb1:ub1, lb2:ub2) = this%flushval + case(site_emis_r8) + this%r82d(lb1:ub1, lb2:ub2) = this%flushval case(site_height_r8) this%r82d(lb1:ub1, lb2:ub2) = this%flushval case(site_fuel_r8) diff --git a/main/FatesIODimensionsMod.F90 b/main/FatesIODimensionsMod.F90 index ed487d7eed..a132914088 100644 --- a/main/FatesIODimensionsMod.F90 +++ b/main/FatesIODimensionsMod.F90 @@ -20,6 +20,7 @@ module FatesIODimensionsMod character(*), parameter, public :: levscls = 'fates_levscls' ! matches histFileMod character(*), parameter, public :: levpft = 'fates_levpft' ! matches histFileMod character(*), parameter, public :: levage = 'fates_levage' ! matches histFileMod + character(*), parameter, public :: levemis = 'fates_levemis' ! matches histFileMod character(*), parameter, public :: levheight = 'fates_levheight' ! matches histFileMod character(*), parameter, public :: levfuel = 'fates_levfuel' ! matches histFileMod character(*), parameter, public :: levcwdsc = 'fates_levcwdsc' ! matches histFileMod @@ -67,6 +68,9 @@ module FatesIODimensionsMod ! levheight = This is a structure that records the boundaries for the ! number of height dimension + ! levemis = This is a structure that records the boundaries for the + ! number of emission compounds dimension + ! levfuel = This is a structure that records the boundaries for the ! number of fuel-size-class dimension @@ -109,7 +113,7 @@ module FatesIODimensionsMod ! levelpft = This records the boundaries for elements x pft ! levelcwd = This records the boundaries for element x cwd ! levelage = This records the boundaries for element x age - + ! levcdsc = This is a structure that records the boundaries for the ! number of crown damage x size classes dimension @@ -155,6 +159,8 @@ module FatesIODimensionsMod integer :: age_class_end integer :: height_begin integer :: height_end + integer :: emis_class_begin + integer :: emis_class_end integer :: fuel_begin integer :: fuel_end integer :: cwdsc_begin diff --git a/main/FatesIOVariableKindMod.F90 b/main/FatesIOVariableKindMod.F90 index 07df7b8270..6b7d02db48 100644 --- a/main/FatesIOVariableKindMod.F90 +++ b/main/FatesIOVariableKindMod.F90 @@ -27,6 +27,7 @@ module FatesIOVariableKindMod character(*), parameter, public :: cohort_int = 'CO_INT' character(*), parameter, public :: site_pft_r8 = 'SI_PFT_R8' character(*), parameter, public :: site_age_r8 = 'SI_AGE_R8' + character(*), parameter, public :: site_emis_r8 = 'SI_EMIS_R8' character(*), parameter, public :: site_height_r8 = 'SI_HEIGHT_R8' character(*), parameter, public :: site_fuel_r8 = 'SI_FUEL_R8' character(*), parameter, public :: site_cwdsc_r8 = 'SI_CWDSC_R8' From 0dc8dfdd0ee7c1f02f23e37df175f2ddbf9302a5 Mon Sep 17 00:00:00 2001 From: rosiealice Date: Tue, 19 Mar 2024 07:06:38 -0600 Subject: [PATCH 30/33] creates history variables --- main/FatesHistoryInterfaceMod.F90 | 2 +- main/FatesInterfaceMod.F90 | 8 +++++++- main/FatesInterfaceTypesMod.F90 | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/main/FatesHistoryInterfaceMod.F90 b/main/FatesHistoryInterfaceMod.F90 index e2cfa5c259..787e9f4671 100644 --- a/main/FatesHistoryInterfaceMod.F90 +++ b/main/FatesHistoryInterfaceMod.F90 @@ -2406,7 +2406,7 @@ subroutine update_history_dyn(this,nc,nsites,sites,bc_in) hio_fire_fuel_sav_si => this%hvars(ih_fire_fuel_sav_si)%r81d, & hio_fire_fuel_mef_si => this%hvars(ih_fire_fuel_mef_si)%r81d, & hio_fire_emissions_si_em => this%hvars(ih_fire_emissions_si_emis)%r82d, & - hio_fire_emission_height_si => this%hvars(ih_fire_emission_height_si)%r81d, & + hio_fire_emission_height_si => this%hvars(ih_fire_emission_height_si)%r81d, & hio_sum_fuel_si => this%hvars(ih_sum_fuel_si)%r81d, & hio_fragmentation_scaler_sl => this%hvars(ih_fragmentation_scaler_sl)%r82d, & hio_litter_in_si => this%hvars(ih_litter_in_si)%r81d, & diff --git a/main/FatesInterfaceMod.F90 b/main/FatesInterfaceMod.F90 index 3f256cdd95..c3334ffcbb 100644 --- a/main/FatesInterfaceMod.F90 +++ b/main/FatesInterfaceMod.F90 @@ -1123,7 +1123,7 @@ subroutine fates_history_maps use FatesLitterMod, only : NFSC use EDParamsMod, only : nclmax - use EDParamsMod, only : nlevleaf + use EDParamsMod, only : nlevleaf, num_emission_compounds use EDParamsMod, only : ED_val_history_sizeclass_bin_edges use EDParamsMod, only : ED_val_history_ageclass_bin_edges use EDParamsMod, only : ED_val_history_height_bin_edges @@ -1142,6 +1142,7 @@ subroutine fates_history_maps integer :: ipft integer :: icwd integer :: ifuel + integer :: iemis integer :: ican integer :: icdam integer :: ileaf @@ -1157,6 +1158,7 @@ subroutine fates_history_maps allocate( fates_hdim_levpft(1:numpft )) allocate( fates_hdim_levlanduse(1:n_landuse_cats)) allocate( fates_hdim_levfuel(1:NFSC )) + allocate( fates_hdim_levemis(1:num_emission_compounds )) allocate( fates_hdim_levcwdsc(1:NCWD )) allocate( fates_hdim_levage(1:nlevage )) allocate( fates_hdim_levheight(1:nlevheight )) @@ -1214,6 +1216,10 @@ subroutine fates_history_maps fates_hdim_levfuel(ifuel) = ifuel end do + do iemis=1,num_emission_compounds + fates_hdim_levemis(iemis) = iemis + end do + ! make cwd array do icwd=1,NCWD fates_hdim_levcwdsc(icwd) = icwd diff --git a/main/FatesInterfaceTypesMod.F90 b/main/FatesInterfaceTypesMod.F90 index 8c08d6cf25..0686bf4923 100644 --- a/main/FatesInterfaceTypesMod.F90 +++ b/main/FatesInterfaceTypesMod.F90 @@ -264,6 +264,7 @@ module FatesInterfaceTypesMod integer , public, allocatable :: fates_hdim_levpft(:) ! plant pft dimension integer , public, allocatable :: fates_hdim_levlanduse(:) ! land use label dimension integer , public, allocatable :: fates_hdim_levfuel(:) ! fire fuel size class (fsc) dimension + integer , public, allocatable :: fates_hdim_levemis(:) ! fire emissions class dimensionn integer , public, allocatable :: fates_hdim_levcwdsc(:) ! cwd class dimension integer , public, allocatable :: fates_hdim_levcan(:) ! canopy-layer dimension real(r8), public, allocatable :: fates_hdim_levleaf(:) ! leaf-layer dimension, integrated VAI [m2/m2] From 1c249c31d32a4e3986b0179cecbd959a22855591 Mon Sep 17 00:00:00 2001 From: rosiealice Date: Tue, 19 Mar 2024 17:05:13 -0600 Subject: [PATCH 31/33] Corrected infinite loop issue in fixed biogeog mode :) --- fire/SFMainMod.F90 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fire/SFMainMod.F90 b/fire/SFMainMod.F90 index 8ce8b9395d..f44f5b8e67 100644 --- a/fire/SFMainMod.F90 +++ b/fire/SFMainMod.F90 @@ -1153,8 +1153,9 @@ subroutine fire_emissions ( currentSite ) if(currentPatch%fire_emissions(c).gt.0.0_r8)then write(*,*) 'postivie emissionssf',currentPatch%fire_emissions(1),biomass_burned endif - currentPatch => currentPatch%younger - endif + endif ! bare ground + currentPatch => currentPatch%younger + enddo !end patch loop end if ! is nocomp From ab52f06e6029b3ec3e0940b9d27ed23de02297fc Mon Sep 17 00:00:00 2001 From: rosiealice Date: Tue, 19 Mar 2024 17:37:38 -0600 Subject: [PATCH 32/33] typo in the emissions factors --- parameter_files/fates_params_default.cdl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/parameter_files/fates_params_default.cdl b/parameter_files/fates_params_default.cdl index edc5223e89..4dc6f4dcc5 100644 --- a/parameter_files/fates_params_default.cdl +++ b/parameter_files/fates_params_default.cdl @@ -1167,11 +1167,11 @@ fates_fire_emission_compound_name = "SO2" ; fates_fire_emission_factors = - 1580, 103.2, 6.8, 8.1, 3.8, 1.85, 0.2, 9.1, 8.5, 6, 5.2, 0.63, 0.5, 7, + 1580, 103.2, 6.8, 8.1, 3.8, 1.85, 0.2, 9.1, 8.5, 6, 5.2, 0.63, 0.57, 1569, 106.7, 4.7, 5.7, 1.81, 3, 0.26, 13, 17.6, 8.3, 9.1, 0.56, 1, 1569, 106.7, 4.7, 5.7, 1.81, 3, 0.26, 13, 17.6, 8.3, 9.1, 0.56, 1, 1569, 106.7, 4.7, 5.7, 1.81, 3, 0.26, 13, 17.6, 8.3, 9.1, 0.56, 1, - 1580, 103.2, 6.8, 8.1, 3.8, 1.85, 0.2, 9.1, 8.5, 6, 5.2, 0.63, 0.5, 7, + 1580, 103.2, 6.8, 8.1, 3.8, 1.85, 0.2, 9.1, 8.5, 6, 5.2, 0.63, 0.57, 1569, 106.7, 4.7, 5.7, 1.81, 3, 0.26, 13, 17.6, 8.3, 9.1, 0.56, 1, 1663, 61.6, 2.2, 3.4, 0.99, 2.35, 0.21, 4.9, 8.5, 3.7, 3.2, 0.46, 0.71, 1663, 61.6, 2.2, 3.4, 0.99, 2.35, 0.21, 4.9, 8.5, 3.7, 3.2, 0.46, 0.71, From 9b3ec7c39e14e2cd4155018dea7fbab8c155894a Mon Sep 17 00:00:00 2001 From: rosiealice Date: Thu, 21 Mar 2024 03:26:13 -0600 Subject: [PATCH 33/33] added fire emissions to FATES restart file --- main/FatesRestartInterfaceMod.F90 | 34 ++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/main/FatesRestartInterfaceMod.F90 b/main/FatesRestartInterfaceMod.F90 index a2e7089c76..2ccf3ee017 100644 --- a/main/FatesRestartInterfaceMod.F90 +++ b/main/FatesRestartInterfaceMod.F90 @@ -42,6 +42,7 @@ module FatesRestartInterfaceMod use FatesLitterMod, only : ndcmpy use EDTypesMod, only : area use EDParamsMod, only : nlevleaf + use EDParamsMod, only : num_emission_compounds use PRTGenericMod, only : prt_global use PRTGenericMod, only : num_elements use FatesRunningMeanMod, only : rmean_type @@ -81,6 +82,7 @@ module FatesRestartInterfaceMod ! pa: patch dimension ! co: cohort dimension ! ft: functional type dimension + ! em: emission compounds dimension ! cl: canopy layer dimension (upper, lower, etc) ! ls: layer sublayer dimension (fine discretization of upper,lower) ! wm: the number of memory slots for water (currently 10) @@ -214,7 +216,11 @@ module FatesRestartInterfaceMod integer :: ir_scorch_ht_pa_pft integer :: ir_litter_moisture_pa_nfsc - + + ! Emission fluxes + integer :: ir_fire_emissions_pa_em + integer :: ir_fire_emission_height_pa + ! Site level integer :: ir_dd_status_sift integer :: ir_dleafondate_sift @@ -1022,6 +1028,15 @@ subroutine define_restart_vars(this, initialize_variables) call this%set_restart_var(vname='fates_litter_moisture_pa_nfsc', vtype=cohort_r8, & long_name='scorch height', units='m', flushval = flushzero, & hlms='CLM:ALM', initialize=initialize_variables, ivar=ivar, index = ir_litter_moisture_pa_nfsc) + + call this%set_restart_var(vname='fates_fire_emissions_pa_em', vtype=cohort_r8, & + long_name='fire emissions', units='kg emissions/m2/s', flushval = flushzero, & + hlms='CLM:ALM', initialize=initialize_variables, ivar=ivar, index = ir_fire_emissions_pa_em) + + call this%set_restart_var(vname='fates_fire_emission_height_pa', vtype=cohort_r8, & + long_name='fire emissions height', units='m', flushval = flushzero, & + hlms='CLM:ALM', initialize=initialize_variables, ivar=ivar, index = ir_fire_emission_height_pa) + end if @@ -1974,6 +1989,7 @@ subroutine set_restart_vectors(this,nc,nsites,sites) integer :: io_idx_co ! cohort index integer :: io_idx_pa_pft ! each pft within each patch (pa_pft) integer :: io_idx_pa_cwd ! each cwd class within each patch (pa_cwd) + integer :: io_idx_pa_em ! each emission class within each patch (pa_em) integer :: io_idx_pa_cwsl ! each cwd x soil layer integer :: io_idx_pa_dcsl ! each decomposability x soil layer integer :: io_idx_pa_dc ! each decomposability index @@ -2480,6 +2496,13 @@ subroutine set_restart_vectors(this,nc,nsites,sites) io_idx_pa_cwd = io_idx_pa_cwd + 1 end do + ! Restart fire emissions (to populate the first day until they are recalculated. + io_idx_pa_em = io_idx_co_1st + do i = 1,nfsc + this%rvars(ir_fire_emissions_pa_em)%r81d(io_idx_pa_em) = cpatch%fire_emissions(i) + io_idx_pa_em = io_idx_pa_em + 1 + end do + ! -------------------------------------------------------------------------- ! Send litter to the restart arrays ! Each element has its own variable, so we have to make sure @@ -2937,6 +2960,7 @@ subroutine get_restart_vectors(this, nc, nsites, sites) integer :: io_idx_co ! cohort index integer :: io_idx_pa_pft ! each pft within each patch (pa_pft) integer :: io_idx_pa_cwd ! each cwd class within each patch (pa_cwd) + integer :: io_idx_pa_em ! each emission class within each patch (pa_em) integer :: io_idx_pa_cwsl ! each cwd x soil layer integer :: io_idx_pa_dcsl ! each decomposability x soil layer integer :: io_idx_pa_dc ! each decomposability index @@ -3420,6 +3444,14 @@ subroutine get_restart_vectors(this, nc, nsites, sites) io_idx_pa_cwd = io_idx_pa_cwd + 1 end do + ! Pull fire emissions from the restart arrays. + io_idx_pa_em = io_idx_co_1st + do i = 1,num_emission_compounds + cpatch%fire_emissions(i) = this%rvars(ir_fire_emissions_pa_em)%r81d(io_idx_pa_em) + io_idx_pa_em = io_idx_pa_em + 1 + end do + cpatch%fire_emission_height = this%rvars(ir_fire_emission_height_pa)%r81d(io_idx_co_1st) + ! -------------------------------------------------------------------------- ! Pull litter from the restart arrays ! Each element has its own variable, so we have to make sure