-
Notifications
You must be signed in to change notification settings - Fork 108
Add some biophysical variables by land-use type #1407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+232
−12
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
baadc32
added biophys vars by land use: LH, SH, LW, SW, TV, TSA
ckoven 093b3b2
merged main and resolved conflicts
ckoven 125c01b
moved FATES_GPP_LU hist var to the hifrq landuse call
ckoven deed888
updates per code review comments
ckoven f074855
merged main and resolved conflicts
ckoven File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ module FatesHistoryInterfaceMod | |
| use FatesConstantsMod , only : mg_per_kg | ||
| use FatesConstantsMod , only : pi_const | ||
| use FatesConstantsMod , only : nearzero | ||
| use FatesConstantsMod , only : rsnbl_math_prec | ||
| use FatesConstantsMod , only : t_water_freeze_k_1atm | ||
| use FatesConstantsMod , only : n_term_mort_types | ||
| use FatesConstantsMod , only : i_term_mort_type_cstarv | ||
|
|
@@ -138,6 +139,7 @@ module FatesHistoryInterfaceMod | |
| use FatesSizeAgeTypeIndicesMod, only : get_cdamagesize_class_index | ||
| use FatesSizeAgeTypeIndicesMod, only : get_cdamagesizepft_class_index | ||
| use FatesSizeAgeTypeIndicesMod, only : coagetype_class_index | ||
| use FatesInterfaceTypesMod , only : hlm_use_luh | ||
|
|
||
| implicit none | ||
| private ! By default everything is private | ||
|
|
@@ -362,6 +364,12 @@ module FatesHistoryInterfaceMod | |
| integer :: ih_burnedarea_si_landuse | ||
| integer :: ih_gpp_si_landuse | ||
| integer :: ih_npp_si_landuse | ||
| integer :: ih_tveg_si_landuse | ||
| integer :: ih_tsa_si_landuse | ||
| integer :: ih_sw_abs_si_landuse | ||
| integer :: ih_lw_net_si_landuse | ||
| integer :: ih_shflux_si_landuse | ||
| integer :: ih_lhflux_si_landuse | ||
|
|
||
| ! land use by land use variables | ||
| integer :: ih_disturbance_rate_si_lulu | ||
|
|
@@ -838,6 +846,7 @@ module FatesHistoryInterfaceMod | |
| procedure :: update_history_hifrq_sitelevel | ||
| procedure :: update_history_hifrq_subsite | ||
| procedure :: update_history_hifrq_subsite_ageclass | ||
| procedure :: update_history_hifrq_landuse | ||
| procedure :: update_history_hydraulics | ||
| procedure :: update_history_nutrflux | ||
|
|
||
|
|
@@ -5007,6 +5016,9 @@ subroutine update_history_hifrq(this,nc,nsites,sites,bc_in,bc_out,dt_tstep) | |
|
|
||
| if(hlm_hist_level_hifrq>0) then | ||
| call update_history_hifrq_sitelevel(this,nc,nsites,sites,bc_in,bc_out,dt_tstep) | ||
| if (hlm_use_luh .eq. itrue) then | ||
| call update_history_hifrq_landuse(this,nc,nsites,sites,bc_in,dt_tstep) | ||
| end if | ||
| if(hlm_hist_level_hifrq>1) then | ||
| call update_history_hifrq_subsite(this,nc,nsites,sites,bc_in,bc_out,dt_tstep) | ||
| call update_history_hifrq_subsite_ageclass(this,nsites,sites,dt_tstep) | ||
|
|
@@ -5240,6 +5252,160 @@ end subroutine update_history_hifrq_sitelevel | |
|
|
||
| ! =============================================================================================== | ||
|
|
||
| subroutine update_history_hifrq_landuse(this,nc,nsites,sites,bc_in,dt_tstep) | ||
|
|
||
| ! | ||
| ! Arguments | ||
| class(fates_history_interface_type) :: this | ||
| integer , intent(in) :: nc ! clump index | ||
| integer , intent(in) :: nsites | ||
| type(ed_site_type) , intent(inout), target :: sites(nsites) | ||
| type(bc_in_type) , intent(in) :: bc_in(nsites) | ||
| real(r8) , intent(in) :: dt_tstep | ||
|
|
||
| ! Locals | ||
| integer :: s ! The local site index | ||
| integer :: io_si ! The site index of the IO array | ||
|
|
||
| real(r8) :: landuse_statevector(n_landuse_cats) | ||
| real(r8) :: canopy_area_bylanduse(n_landuse_cats) | ||
| integer :: i_lu | ||
| logical :: foundbaregroundpatch | ||
|
samsrabin marked this conversation as resolved.
|
||
|
|
||
| type(fates_patch_type),pointer :: cpatch | ||
| type(fates_cohort_type),pointer :: ccohort | ||
| real(r8) :: dt_tstep_inv ! Time step in frequency units (/s) | ||
|
|
||
| associate( hio_tveg_si_landuse => this%hvars(ih_tveg_si_landuse)%r82d,& | ||
| hio_gpp_si_landuse => this%hvars(ih_gpp_si_landuse)%r82d, & | ||
| hio_tsa_si_landuse => this%hvars(ih_tsa_si_landuse)%r82d,& | ||
| hio_sw_abs_si_landuse => this%hvars(ih_sw_abs_si_landuse)%r82d,& | ||
| hio_lw_net_si_landuse => this%hvars(ih_lw_net_si_landuse)%r82d,& | ||
| hio_shflux_si_landuse => this%hvars(ih_shflux_si_landuse)%r82d,& | ||
| hio_lhflux_si_landuse => this%hvars(ih_lhflux_si_landuse)%r82d) | ||
|
|
||
| do_sites: do s = 1,nsites | ||
|
|
||
| io_si = sites(s)%h_gid | ||
|
|
||
| dt_tstep_inv = 1.0_r8/dt_tstep | ||
|
|
||
| ! biophysical properties that are indexed by land use | ||
| landuse_statevector(:) = sites(s)%get_current_landuse_statevector() * AREA | ||
|
|
||
| ! get the total canopy area for each land use type | ||
| canopy_area_bylanduse(:) = 0._r8 | ||
| cpatch => sites(s)%oldest_patch | ||
| do while(associated(cpatch)) | ||
| if ( cpatch%land_use_label .ne. nocomp_bareground_land ) then | ||
| canopy_area_bylanduse(cpatch%land_use_label) = canopy_area_bylanduse(cpatch%land_use_label) + & | ||
| cpatch%total_canopy_area | ||
| endif | ||
| cpatch => cpatch%younger | ||
| end do | ||
|
|
||
| cpatch => sites(s)%oldest_patch | ||
| do while(associated(cpatch)) | ||
| if (cpatch%total_canopy_area .gt. rsnbl_math_prec) then | ||
|
Comment on lines
+5427
to
+5429
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Copying @rgknox question here from #1529 (comment) |
||
| ! for TVEG, since it is only defined on vegetated area of vegetated patches, normalize by the total vegetated area | ||
| hio_tveg_si_landuse(io_si,cpatch%land_use_label) = hio_tveg_si_landuse(io_si,cpatch%land_use_label) + & | ||
| bc_in(s)%t_veg_pa(cpatch%patchno) * cpatch%total_canopy_area/canopy_area_bylanduse(cpatch%land_use_label) | ||
|
|
||
| ! for the rest of these, first weight by the vegetated area of each patch over the total patch area for each land use type | ||
| hio_tsa_si_landuse(io_si,cpatch%land_use_label) = hio_tsa_si_landuse(io_si,cpatch%land_use_label) + & | ||
| bc_in(s)%t2m_pa(cpatch%patchno) * cpatch%total_canopy_area/landuse_statevector(cpatch%land_use_label) | ||
|
samsrabin marked this conversation as resolved.
Outdated
|
||
|
|
||
| hio_sw_abs_si_landuse(io_si,cpatch%land_use_label) = hio_sw_abs_si_landuse(io_si,cpatch%land_use_label) + & | ||
| bc_in(s)%swabs_pa(cpatch%patchno) * cpatch%total_canopy_area/landuse_statevector(cpatch%land_use_label) | ||
|
|
||
| hio_lw_net_si_landuse(io_si,cpatch%land_use_label) = hio_lw_net_si_landuse(io_si,cpatch%land_use_label) + & | ||
| bc_in(s)%netlw_pa(cpatch%patchno) * cpatch%total_canopy_area/landuse_statevector(cpatch%land_use_label) | ||
|
|
||
| hio_shflux_si_landuse(io_si,cpatch%land_use_label) = hio_shflux_si_landuse(io_si,cpatch%land_use_label) + & | ||
| bc_in(s)%shflux_pa(cpatch%patchno) * cpatch%total_canopy_area/landuse_statevector(cpatch%land_use_label) | ||
|
|
||
| hio_lhflux_si_landuse(io_si,cpatch%land_use_label) = hio_lhflux_si_landuse(io_si,cpatch%land_use_label) + & | ||
| bc_in(s)%lhflux_pa(cpatch%patchno) * cpatch%total_canopy_area/landuse_statevector(cpatch%land_use_label) | ||
| endif | ||
| cpatch => cpatch%younger | ||
| end do | ||
|
|
||
| ! for all the land-use indexed variables, excpet for TVEG, also add in the component for the unvegetated area of each land use | ||
|
samsrabin marked this conversation as resolved.
Outdated
|
||
| foundbaregroundpatch = .false. | ||
| cpatch => sites(s)%oldest_patch | ||
| do while(associated(cpatch)) | ||
| if (cpatch%land_use_label .eq. nocomp_bareground_land .and. .not. foundbaregroundpatch) then | ||
| foundbaregroundpatch = .true. | ||
| do i_lu = 1, n_landuse_cats | ||
| if ( landuse_statevector(i_lu) .gt. rsnbl_math_prec ) then | ||
|
samsrabin marked this conversation as resolved.
|
||
| hio_tsa_si_landuse(io_si,i_lu) = hio_tsa_si_landuse(io_si,i_lu) + & | ||
| bc_in(s)%t2m_pa(cpatch%patchno) * & | ||
| (landuse_statevector(i_lu) - canopy_area_bylanduse(i_lu)) / landuse_statevector(i_lu) | ||
|
|
||
| hio_sw_abs_si_landuse(io_si,i_lu) = hio_sw_abs_si_landuse(io_si,i_lu) + & | ||
| bc_in(s)%swabs_pa(cpatch%patchno) * & | ||
| (landuse_statevector(i_lu) - canopy_area_bylanduse(i_lu)) / landuse_statevector(i_lu) | ||
|
|
||
| hio_lw_net_si_landuse(io_si,i_lu) = hio_lw_net_si_landuse(io_si,i_lu) + & | ||
| bc_in(s)%netlw_pa(cpatch%patchno) * & | ||
| (landuse_statevector(i_lu) - canopy_area_bylanduse(i_lu)) / landuse_statevector(i_lu) | ||
|
|
||
| hio_shflux_si_landuse(io_si,i_lu) = hio_shflux_si_landuse(io_si,i_lu) + & | ||
| bc_in(s)%shflux_pa(cpatch%patchno) * & | ||
| (landuse_statevector(i_lu) - canopy_area_bylanduse(i_lu)) / landuse_statevector(i_lu) | ||
|
|
||
| hio_lhflux_si_landuse(io_si,i_lu) = hio_lhflux_si_landuse(io_si,i_lu) + & | ||
| bc_in(s)%lhflux_pa(cpatch%patchno) * & | ||
| (landuse_statevector(i_lu) - canopy_area_bylanduse(i_lu)) / landuse_statevector(i_lu) | ||
| end if | ||
| end do | ||
| end if | ||
| cpatch => cpatch%younger | ||
| end do | ||
|
|
||
| ! instead of leaving the values for unoccupied areas as zero, set as missing values | ||
| do i_lu = 1, n_landuse_cats | ||
|
|
||
| ! if a given land use type is not present, set the value as missing | ||
| if ( landuse_statevector(i_lu) .le. rsnbl_math_prec ) then | ||
| hio_tsa_si_landuse(io_si,i_lu) = hlm_hio_ignore_val | ||
| hio_sw_abs_si_landuse(io_si,i_lu) = hlm_hio_ignore_val | ||
| hio_lw_net_si_landuse(io_si,i_lu) = hlm_hio_ignore_val | ||
| hio_shflux_si_landuse(io_si,i_lu) = hlm_hio_ignore_val | ||
| hio_lhflux_si_landuse(io_si,i_lu) = hlm_hio_ignore_val | ||
| end if | ||
|
|
||
| ! for tveg, ignore if there is no vegetation present on any patches of a given land use type | ||
| if ( canopy_area_bylanduse(i_lu) .le. rsnbl_math_prec ) then | ||
| hio_tveg_si_landuse(io_si,i_lu) = hlm_hio_ignore_val | ||
| end if | ||
|
|
||
| end do | ||
|
|
||
|
|
||
| cpatch => sites(s)%oldest_patch | ||
| do while(associated(cpatch)) | ||
|
samsrabin marked this conversation as resolved.
|
||
| ccohort => cpatch%shortest | ||
| do while(associated(ccohort)) | ||
| if ( .not. ccohort%isnew ) then | ||
| if (cpatch%land_use_label .gt. nocomp_bareground_land) then | ||
|
samsrabin marked this conversation as resolved.
Outdated
|
||
| hio_gpp_si_landuse(io_si,cpatch%land_use_label) = hio_gpp_si_landuse(io_si,cpatch%land_use_label) & | ||
| + ccohort%gpp_tstep * ccohort%n * dt_tstep_inv | ||
| end if | ||
| end if | ||
| ccohort => ccohort%taller | ||
| end do | ||
| cpatch => cpatch%younger | ||
| end do | ||
|
|
||
| end do do_sites | ||
|
|
||
| end associate | ||
| return | ||
| end subroutine update_history_hifrq_landuse | ||
|
|
||
| ! =============================================================================================== | ||
|
|
||
| subroutine update_history_hifrq_subsite(this,nc,nsites,sites,bc_in,bc_out,dt_tstep) | ||
|
|
||
| ! --------------------------------------------------------------------------------- | ||
|
|
@@ -5298,7 +5464,6 @@ subroutine update_history_hifrq_subsite(this,nc,nsites,sites,bc_in,bc_out,dt_tst | |
| hio_froot_mr_understory_si_scls => this%hvars(ih_froot_mr_understory_si_scls)%r82d, & | ||
| hio_resp_g_understory_si_scls => this%hvars(ih_resp_g_understory_si_scls)%r82d, & | ||
| hio_resp_m_understory_si_scls => this%hvars(ih_resp_m_understory_si_scls)%r82d, & | ||
| hio_gpp_si_landuse => this%hvars(ih_gpp_si_landuse)%r82d, & | ||
| hio_parsun_z_si_cnlf => this%hvars(ih_parsun_z_si_cnlf)%r82d, & | ||
| hio_parsha_z_si_cnlf => this%hvars(ih_parsha_z_si_cnlf)%r82d, & | ||
| hio_ts_net_uptake_si_cnlf => this%hvars(ih_ts_net_uptake_si_cnlf)%r82d, & | ||
|
|
@@ -5387,11 +5552,6 @@ subroutine update_history_hifrq_subsite(this,nc,nsites,sites,bc_in,bc_out,dt_tst | |
| hio_ar_frootm_si_scpf(io_si,scpf) = hio_ar_frootm_si_scpf(io_si,scpf) + & | ||
| ccohort%froot_mr * n_perm2 | ||
|
|
||
| if (cpatch%land_use_label .gt. nocomp_bareground_land) then | ||
| hio_gpp_si_landuse(io_si,cpatch%land_use_label) = hio_gpp_si_landuse(io_si,cpatch%land_use_label) & | ||
| + ccohort%gpp_tstep * ccohort%n * dt_tstep_inv | ||
| end if | ||
|
|
||
| ! accumulate fluxes on canopy- and understory- separated fluxes | ||
| if (ccohort%canopy_layer .eq. 1) then | ||
|
|
||
|
|
@@ -8743,6 +8903,51 @@ subroutine define_history_vars(this, initialize_variables) | |
| avgflag='A', vtype=site_r8, hlms='CLM:ALM', upfreq=group_hifr_simple, & | ||
| ivar=ivar, initialize=initialize_variables, index = ih_tveg_si ) | ||
|
|
||
| if (hlm_use_luh .eq. itrue) then | ||
| ! biophysics variables that are indexed by land use type | ||
| call this%set_history_var(vname='FATES_TVEG_LU', units='degrees Kelvin', & | ||
| long='fates instantaneous mean vegetation temperature by land use type', & | ||
| use_default='active', & | ||
| avgflag='A', vtype=site_landuse_r8, hlms='CLM:ALM', upfreq=group_hifr_simple, & | ||
| ivar=ivar, initialize=initialize_variables, index = ih_tveg_si_landuse ) | ||
|
|
||
| call this%set_history_var(vname='FATES_TSA_LU', units='degrees Kelvin', & | ||
| long='fates instantaneous mean near-surface (2m) air temperature by land use type', & | ||
| use_default='active', & | ||
| avgflag='A', vtype=site_landuse_r8, hlms='CLM:ALM', upfreq=group_hifr_simple, & | ||
| ivar=ivar, initialize=initialize_variables, index = ih_tsa_si_landuse ) | ||
|
|
||
| call this%set_history_var(vname='FATES_SWABS_LU', units='W m-2', & | ||
| long='fates absorbed shortwave radiation by land use type', & | ||
| use_default='active', & | ||
| avgflag='A', vtype=site_landuse_r8, hlms='CLM:ALM', upfreq=group_hifr_simple, & | ||
| ivar=ivar, initialize=initialize_variables, index = ih_sw_abs_si_landuse ) | ||
|
|
||
| call this%set_history_var(vname='FATES_NETLW_LU', units='W m-2', & | ||
| long='fates net longwave flux by land use type', & | ||
| use_default='active', & | ||
| avgflag='A', vtype=site_landuse_r8, hlms='CLM:ALM', upfreq=group_hifr_simple, & | ||
| ivar=ivar, initialize=initialize_variables, index = ih_lw_net_si_landuse ) | ||
|
|
||
| call this%set_history_var(vname='FATES_SHFLUX_LU', units='W m-2', & | ||
| long='fates sensible heat flux by land use type', & | ||
| use_default='active', & | ||
| avgflag='A', vtype=site_landuse_r8, hlms='CLM:ALM', upfreq=group_hifr_simple, & | ||
| ivar=ivar, initialize=initialize_variables, index = ih_shflux_si_landuse ) | ||
|
|
||
| call this%set_history_var(vname='FATES_LHFLUX_LU', units='W m-2', & | ||
| long='fates latent heat flux by land use type', & | ||
| use_default='active', & | ||
| avgflag='A', vtype=site_landuse_r8, hlms='CLM:ALM', upfreq=group_hifr_simple, & | ||
| ivar=ivar, initialize=initialize_variables, index = ih_lhflux_si_landuse ) | ||
|
|
||
| call this%set_history_var(vname='FATES_GPP_LU', units='kg m-2 s-1', & | ||
| long='gross primary productivity by age bin in kg carbon per m2 per second', & | ||
|
samsrabin marked this conversation as resolved.
Outdated
|
||
| use_default='inactive', avgflag='A', vtype=site_landuse_r8, & | ||
| hlms='CLM:ALM', upfreq=group_hifr_simple, ivar=ivar, initialize=initialize_variables, & | ||
| index = ih_gpp_si_landuse) | ||
| endif | ||
|
|
||
| call this%set_history_var(vname='FATES_VIS_RAD_ERROR', units='-', & | ||
| long='mean two-stream solver error for VIS', use_default='active', & | ||
| avgflag='A', vtype=site_r8, hlms='CLM:ALM', upfreq=group_hifr_simple, & | ||
|
|
@@ -8902,12 +9107,6 @@ subroutine define_history_vars(this, initialize_variables) | |
| hlms='CLM:ALM', upfreq=group_hifr_complx, ivar=ivar, initialize=initialize_variables, & | ||
| index = ih_gpp_si_age) | ||
|
|
||
| call this%set_history_var(vname='FATES_GPP_LU', units='kg m-2 s-1', & | ||
| long='gross primary productivity by land use type in kg carbon per m2 per second', & | ||
| use_default='inactive', avgflag='A', vtype=site_landuse_r8, & | ||
| hlms='CLM:ALM', upfreq=group_hifr_complx, ivar=ivar, initialize=initialize_variables, & | ||
| index = ih_gpp_si_landuse) | ||
|
|
||
| call this%set_history_var(vname='FATES_RDARK_USTORY_SZ', & | ||
| units = 'kg m-2 s-1', & | ||
| long='dark respiration for understory plants in kg carbon per m2 per second by size', & | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Linking @rgknox comment here update_history_hifrq_landuse due to closing #1529