Open amullen01 opened 4 months ago
The issue seems to happen under very specific circumstances. When avlnlost < 0
(losses exceed total available nitrogen), the N mineralization is bumped up slightly to match the losses (lines 713 - 721, Soil_Bgc.cpp). The problem lies in line 719: del_soi2soi.netnmin[i] *=nminadj/totnetnmin;
. In winter total net mineralization is 0. We turned this off a while back due to wintertime mineralization causing a runaway AVLN issue. So when both avlnlost<0
and totnetnmin == 0
, this causes a divide by zero error, causing ORGN to contain nan, and AVLN is not updated.
I have implemented a fix that does two things:
1) checks whether totnetmin==0 before adjusting netnmin 2) if netnmin is zero, adds n mineralization to layers where avln is extracted by root uptake to equal losses
This seems to fix the issue but I'm not sure if it is 100% scientifically accurate. I feel like instead of adding N mineralization to account for too big of plant uptake we should be limiting plant uptake. Should N uptake be zero when soil is frozen? Would be good to discuss further.
During future scenarios, ORGN drops to zero and AVLN drops near zero and stays constant, beginning around the year 2045. This issue was observed with Caribou-Poker climate using Caribou-Poker Black Spruce and Birch calibrations, as well as the Murphey Dome Black Spruce and Deciduous calibrations (CMT1 & CMT3). You can see the issue with the grey line in the attached figure, which is the control run in which no fire occurs. I have not observed any other anomalous behavior preceding this abrupt drop in N. Labelling this issue with "bug" because it looks like buggy behavior, but not ruling out a calibration or climate issue.