PEcAn.ED2 defaults for allometry overwrite ED2 calculations and cause divide-by-zero errors
Aariq opened this issue · comments
Bug Description
It appears that PEcAn.ED2
sets the ED2 flag NL%IALLOM = 3
in ED2IN by default. It also writes b1Ht
and b2Ht
to config.xml. BUT ED2 seems to want to calculate b1Ht
and b2Ht
from rho
and some constants defined in ed_params.f90
when IALLOM = 3. I believe that config.xml gets the final say though and overwrites the calculations ED2 is doing. This could be a problem because b1Ht
and b2Ht
mean different things depending on the value for NL%IALLOM
. The PEcAn.ED2 defaults for these parameters appear to be the ones for NL%IALLOM = 1
, not 3
Expected behavior
I'd expect PEcAn.ED2 to just not include b1Ht
and b2Ht
in config.xml. Anything not in config.xml will just use the ED2 defaults stored in ED. That would eliminate the need to keep an updated copy of those defaults in PEcAn.ED2. Either that, or use the default IALLOM mode (2).
Additional context
Getting divide by zero errors from ED2 and trying to eliminate potential sources. Allometry seems like a prime suspect.
Update. Running ED2 without PEcAn.ED2 setting ED2's defaults (i.e. letting ED2 use it's own internal defaults) has fixed all the errors I was getting in ED2 runs. I suspect most of the errors I have been getting have been a result of PEcAn.ED2 breaking allometry equations by overwriting coefficients with inappropriate values.
I can envision at least 3 possible solutions roughly in order of least to most control from PEcAn (and consequently, least to most difficulty in getting it right)
- Don't write any paramaters to config.xml that don't have priors. (i.e. what I did in #3125)
- Go through ED2 code and figure out which parameters mean different things or have different defaults depending on settings in ED2IN and don't write those to config.xml
- Write different defaults depending on the settings in ED2IN
I do think this is a true bug and one of these changes is needed for PEcAn.ED2 is to continue to be useful.
Another possibility is to make this work with the current machinery by:
- re-naming ED2IN.r2.2.0.github to ED2IN.rgit
- updating
history.rgit
so that the defaults there match the defaults that would be used by allometry equations in ED2.
Except I can't figure out how to edit the history.rgit file—it doesn't seem to correspond to internal ED2 defaults for several of the PFTs and only includes a subset of the parameters that could be overridden (e.g. missing is_conifer
, is_savannah
, and is_liana
; has different values for is_grass
from ED2 defaults). Is there a standard run that produces these outputs? Is there documentation somewhere as to what PEcAn PFTs are used to overwrite the ED2 defaults?
This issue is stale because it has been open 365 days with no activity.