mariegosme / SSM.R

translation of SSM model by Thomas R. Sinclair and Afshin Soltani into R
GNU General Public License v3.0
1 stars 1 forks source link

sMineralizableN bank value changed for no apparent reason at beginning of timestep #14

Closed achgls closed 3 years ago

achgls commented 3 years ago

Only time in a timestep where sMineralizableN is supposed to be updated is with equation MNORGs <- MNORGs - NMINs i.e withdrawal of mineralization amount from mineralizable N bank. That equation is in module rUpdateSoilNitrogen. Yet, MNORG value changes from end of day 0 to beginning of day 1 (might also change from day 1 to day 2 and so on, only verified for 0 -> 1) Apparently, change is effective at least starting from the call to rCreateDay(date) at beginning of timestep. This change is not relevant and I can't see a reason for why it would happen since only time in the code where sMineralizableN.1:10 is mentioned is in rUpdateSoilNitrogen...

achgls commented 3 years ago

Nevermind, I believed it was a different value at timestep 0 because of R automatically rounding its value when representing ALLSIMULATEDDATA. Actually for, the first few timesteps (before timestep 10 = sowing), it works just as intended, mineralizable N bank depleting steadily with N mineralization withdrawal. Then for some reason at sowing, things get crazy (see issue #16)