Skip to content

Commit

Permalink
Add postprocessing info to per-ageclass outputs.
Browse files Browse the repository at this point in the history
Tell the user how to get the value they probably want---the value on each age-class---rather than what each age-class contributes to the cross-ageclass area-weighted mean.
  • Loading branch information
samsrabin committed Oct 13, 2024
1 parent 7e1bf60 commit 92ddeeb
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 9 deletions.
45 changes: 37 additions & 8 deletions main/FatesHistoryInterfaceMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,7 @@ module FatesHistoryInterfaceMod

! private work functions
procedure, private :: define_history_vars
procedure, private :: per_ageclass_norm_info
procedure, private :: set_history_var
procedure, private :: init_dim_kinds_maps
procedure, private :: set_dim_indices
Expand Down Expand Up @@ -6162,6 +6163,26 @@ end subroutine initialize_history_vars

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

function per_ageclass_norm_info(this, norm_var)

! ---------------------------------------------------------------------------------
! Produces a bit of text to include in long_name of variables with age-class axes,
! explaining how to get real per-ageclass values if needed.
! ---------------------------------------------------------------------------------
!
! Arguments
class(fates_history_interface_type) :: this ! Not used, but needed for a function in this type
character(len=*), intent(in) :: norm_var ! The variable(s) that this one should be multiplied by to get actual values
!
! Result
character(len=fates_long_string_length) :: per_ageclass_norm_info

per_ageclass_norm_info = "; for real per-age values, mult by " // norm_var

end function per_ageclass_norm_info

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

subroutine define_history_vars(this, initialize_variables)

! ---------------------------------------------------------------------------------
Expand Down Expand Up @@ -7138,12 +7159,14 @@ subroutine define_history_vars(this, initialize_variables)

! patch age class variables
call this%set_history_var(vname='FATES_PATCHAREA_AP', units='m2 m-2', &
long='patch area by age bin per m2 land area', use_default='active', &
long='patch area by age bin per m2 land area', &
use_default='active', &
avgflag='A', vtype=site_age_r8, hlms='CLM:ALM', upfreq=group_dyna_complx, ivar=ivar, &
initialize=initialize_variables, index=ih_fracarea_si_age)

call this%set_history_var(vname='FATES_LAI_AP', units='m2 m-2', &
long='total leaf area index by age bin per m2 land area', &
long='total leaf area index by age bin per m2 land area'// &
this%per_ageclass_norm_info('FATES_CANOPYAREA/FATES_CANOPYAREA_AP'), &
use_default='active', avgflag='A', vtype=site_age_r8, hlms='CLM:ALM', &
upfreq=group_dyna_complx, ivar=ivar, initialize=initialize_variables, &
index=ih_lai_si_age)
Expand All @@ -7154,7 +7177,8 @@ subroutine define_history_vars(this, initialize_variables)
initialize=initialize_variables, index=ih_canopy_area_si_age)

call this%set_history_var(vname='FATES_NCL_AP', units='', &
long='number of canopy levels by age bin', &
long='number of canopy levels by age bin' // &
this%per_ageclass_norm_info('FATES_PATCHAREA/FATES_PATCHAREA_AP'), &
use_default='inactive', avgflag='A', vtype=site_age_r8, &
hlms='CLM:ALM', upfreq=group_dyna_complx, ivar=ivar, initialize=initialize_variables, &
index=ih_ncl_si_age)
Expand Down Expand Up @@ -7645,7 +7669,8 @@ subroutine define_history_vars(this, initialize_variables)
initialize=initialize_variables, index = ih_biomass_si_agepft)

call this%set_history_var(vname='FATES_SCORCH_HEIGHT_APPF',units = 'm', &
long='SPITFIRE flame Scorch Height (calculated per PFT in each patch age bin)', &
long='SPITFIRE flame Scorch Height (calculated per PFT in each patch age bin)'// &
this%per_ageclass_norm_info('FATES_PATCHAREA/FATES_PATCHAREA_AP'), &
use_default='inactive', avgflag='A', vtype=site_agepft_r8, &
hlms='CLM:ALM', upfreq=group_dyna_complx, ivar=ivar, &
initialize=initialize_variables, index = ih_scorch_height_si_agepft)
Expand Down Expand Up @@ -8931,13 +8956,15 @@ subroutine define_history_vars(this, initialize_variables)
! to save time (and some space)

call this%set_history_var(vname='FATES_NPP_AP', units='kg m-2 s-1', &
long='net primary productivity by age bin in kg carbon per m2 per second', &
long='net primary productivity by age bin in kg carbon per m2 per second'// &
this%per_ageclass_norm_info('FATES_PATCHAREA/FATES_PATCHAREA_AP'), &
use_default='inactive', avgflag='A', vtype=site_age_r8, &
hlms='CLM:ALM', upfreq=group_hifr_complx, ivar=ivar, initialize=initialize_variables, &
index = ih_npp_si_age)

call this%set_history_var(vname='FATES_GPP_AP', units='kg m-2 s-1', &
long='gross primary productivity by age bin in kg carbon per m2 per second', &
long='gross primary productivity by age bin in kg carbon per m2 per second'// &
this%per_ageclass_norm_info('FATES_PATCHAREA/FATES_PATCHAREA_AP'), &
use_default='inactive', avgflag='A', vtype=site_age_r8, &
hlms='CLM:ALM', upfreq=group_hifr_complx, ivar=ivar, initialize=initialize_variables, &
index = ih_gpp_si_age)
Expand Down Expand Up @@ -9194,14 +9221,16 @@ subroutine define_history_vars(this, initialize_variables)

call this%set_history_var(vname='FATES_LBLAYER_COND_AP', &
units='mol m-2 s-1', &
long='mean leaf boundary layer conductance - by patch age', &
long='mean leaf boundary layer conductance - by patch age'// &
this%per_ageclass_norm_info('FATES_CANOPYAREA/FATES_CANOPYAREA_AP'), &
use_default='inactive', avgflag='A', vtype=site_age_r8, &
hlms='CLM:ALM', upfreq=group_hifr_complx, ivar=ivar, &
initialize=initialize_variables, index = ih_c_lblayer_si_age)

! Canopy resistance
call this%set_history_var(vname='FATES_STOMATAL_COND_AP', &
units='mol m-2 s-1', long='mean stomatal conductance - by patch age', &
units='mol m-2 s-1', long='mean stomatal conductance - by patch age'//&
this%per_ageclass_norm_info('FATES_CANOPYAREA/FATES_CANOPYAREA_AP'), &
use_default='inactive', avgflag='A', vtype=site_age_r8, &
hlms='CLM:ALM', upfreq=group_hifr_complx, ivar=ivar, initialize=initialize_variables, &
index = ih_c_stomata_si_age)
Expand Down
3 changes: 2 additions & 1 deletion main/FatesHistoryVariableType.F90
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module FatesHistoryVariableType

use FatesConstantsMod, only : r8 => fates_r8
use FatesConstantsMod, only : fates_long_string_length
use FatesGlobals, only : fates_log
use FatesGlobals , only : endrun => fates_endrun
use FatesIODimensionsMod, only : fates_io_dimension_type
Expand Down Expand Up @@ -34,7 +35,7 @@ module FatesHistoryVariableType
type, public :: fates_history_variable_type
character(len=40) :: vname
character(len=24) :: units
character(len=128) :: long
character(len=fates_long_string_length) :: long
character(len=24) :: use_default ! States whether a variable should be turned
! on the output files by default (active/inactive)
! It is a good idea to set inactive for very large
Expand Down

0 comments on commit 92ddeeb

Please sign in to comment.