LANDIS-II-Foundation / Extension-NECN-Succession

The Net Ecosystem Carbon and Nitrogen extension for the LANDIS-II model.
http://www.landis-ii.org/extensions/net-ecosystem-cn-succession
Apache License 2.0
1 stars 19 forks source link

Decompose Structural Carbon Error #67

Open ZacharyRobbins opened 3 years ago

ZacharyRobbins commented 3 years ago

The Decompose Structural Carbon as calculated in ln 189 in Layer.cs, can result in more carbon being decayed than exists for accepted values of SOM1 surface decay rates. I would suggest that if totalCflow >this.carbon, then totalCFlow=this.carbon. I don't know what this impacts up or down stream.

rmscheller commented 2 years ago

Currently this is handled via an ApplicationException on Line 211:

if (totalCFlow > this.Carbon) { string mesg = string.Format("Error: Decompose Structural totalCFlow > this.Carbon: totalCFlow={0}, DecayFactor={1}, Anerb={2}", totalCFlow, SiteVars.DecayFactor[site], anerb); throw new ApplicationException(mesg); }

The point is that if that circumstance arises, something is SO WRONG that it would be best to look at all parameters before proceeding. Sometimes correcting an error simply passes the underlying problem off to later function. Does that make sense? Or are you thinking of a different instance?

rmscheller commented 1 year ago

Z, The line in there "throw new ApplicationException" will stop the model run, and so the problem does not move off to a later function. Is that sufficient?