@@ -45,8 +45,70 @@ module FatesHistoryInterfaceMod
4545 ! These variables hold the index of the history output structure so we don't
4646 ! have to constantly do name lookup when we want to populate the dataset
4747 ! These indices are set during "define_history_vars()" call to "set_history_var()"
48- ! during the initialize phase. Definitions are not provide , for an explanation of
48+ ! during the initialize phase. Definitions are not provided , for an explanation of
4949 ! the variable go to its registry. (IH_ signifies "index history")
50+ !
51+ ! Because of the complex sub-gridscale structure of FATES, in which multiple patches and cohorts
52+ ! exist within a gridcell, along with vertical gradients within and between canopy layers, as well
53+ ! as distinct classes such as PFTs or fuel size bins, there are multiple different dimensions in
54+ ! which it is possible to output history variables to better understand what's going on.
55+ !
56+ ! a key point is that, while the number of patches or cohorts can in principle be large, and
57+ ! the age and size indices of a given patch or cohort can be finely resolved, we collapse these
58+ ! continuously varying indices into bins of time-invariant width for the purposes of history
59+ ! outputting. This is because a given patch or cohort may not persist across a given interval
60+ ! of history averaging, so it is better to output all patches of cohorts whose index is within
61+ ! a given interval along the size or age bin.
62+ !
63+ ! Another particularity of the issue of FATES shifting its subgrid structure frequently
64+ ! and possibly having multiple (or zero) patches or cohorts within a given bin is that, if you
65+ ! want to output an average quantities across some dimension, such as a mean carbon flux across
66+ ! patch area of a given age, in general it is better to output both the numerator and denominator
67+ ! of the averaging calculation separately, rather than the average itself, and then calculate
68+ ! the average in post-processing. So, e.g. this means outputting both the patch area and the
69+ ! product of the flux within each patch and the patch area as separate variables. Doing this
70+ ! allows conservation even when the weights are changing rapidly and simplifies the logic when
71+ ! the number of patches or cohorts may be anywhere from zero to a large number.
72+ !
73+ ! So what this means is that anything that is disaggregated at the patch area requires
74+ ! outputting the patch age distribution (in units of patch area / site area) as the denominator
75+ ! of the average and then calculating the numerator of the average as XXX times the patch
76+ ! area so (so in units of XXX * patch area / site area). For cohort-level quantities,
77+ ! this requires outputting the number density (in units of individuals per site area), etc.
78+ !
79+ ! For reference, some standardized abbreviations of the FATES dimensions are listed here:
80+ ! scls = size-class dimension
81+ ! pft = the pft dimension
82+ ! age = the age bin dimension
83+ ! height = the height bin dimension
84+ ! cwdsc = the coarse woody debris size class dimension
85+ !
86+ ! Since the netcdf interface can only handle variables with a certain number of dimensions,
87+ ! we have create some "multiplexed" dimensions that combine two or more dimensions into a
88+ ! single dimension. Examples of these are the following:
89+ ! scpf = size class x PFT
90+ ! cnlf = canopy layer x leaf layer
91+ ! cnlfpft = canopy layer x leaf layer x PFT
92+ ! scag = size class bin x age bin
93+ ! scagpft = size class bin x age bin x PFT
94+ ! agepft = age bin x PFT
95+ !
96+ ! A recipe for adding a new history variable to this module:
97+ ! (1) decide what time frequency it makes sense to update the variable at, and what dimension(s)
98+ ! you want to output the variable on
99+ ! (2) add the ih_ integer variable in the immediately following section of the module.
100+ ! use the suffix as outlined above for the dimension you are using.
101+ ! (3) define a corresponding hio_ variable by associating it to the ih_ variable
102+ ! in the associate section of the subroutine that corresponds to the time-updating
103+ ! frequency that you've chosen
104+ ! (i.e. if half-hourly, then work in subroutine update_history_prod; if daily,
105+ ! then work in subroutine update_history_dyn)
106+ ! (4) within that subroutine, add the logic that passes the information from the
107+ ! fates-native variable (possibly on a patch or cohort structure) to the history
108+ ! hio_ variable that you've associated to.
109+ ! (5) add the variable name, metadata, units, dimension, updating frequency, the ih_ variable
110+ ! index, etc via a call to the set_history_var method in the subroutine define_history_vars.
111+ !
50112
51113 ! Indices to 1D Patch variables
52114
@@ -158,8 +220,8 @@ module FatesHistoryInterfaceMod
158220 integer , private :: ih_h2oveg_growturn_err_si
159221 integer , private :: ih_h2oveg_pheno_err_si
160222 integer , private :: ih_h2oveg_hydro_err_si
161-
162- ! Indices to (site x scpf) variables
223+
224+ ! Indices to (site x scpf [multiplexed size- and age- bins] ) variables
163225 integer , private :: ih_nplant_si_scpf
164226 integer , private :: ih_gpp_si_scpf
165227 integer , private :: ih_npp_totl_si_scpf
@@ -214,7 +276,7 @@ module FatesHistoryInterfaceMod
214276 integer , private :: ih_c13disc_si_scpf
215277
216278
217- ! indices to (site x scls) variables
279+ ! indices to (site x scls [size class bins] ) variables
218280 integer , private :: ih_ba_si_scls
219281 integer , private :: ih_nplant_si_scls
220282 integer , private :: ih_nplant_canopy_si_scls
0 commit comments