-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uninitialised variables #6
Comments
I am sure that there are many bugs in the code like this one. I haven't worked on it since 1999! Sure, pedantic compilation would be a good way to catch the easy ones. Happy to assist @dramanica, let me know when you would like to work on this and what questions you have. |
@jedokaplan It is certainly vintage code, but people keep using it, so a little love won't hurt. I have written an R driver for it that would make it even easier to run it, but that brought up the numerical inconsistency issues. So, let's see whether we can deal with those.
the problem is on the 3rd line. If |
And another little puzzle for you, this time in growth:
in some instances meangc(m) can be tiny (10^-9). This makes anngasum huge, and things go wrong after that. |
Ok, here is an early Christmas present of sorts for @jedokaplan. I have gone through the whole source code of |
Thanks Andrea, I will see if I can get a bugfix out before the holidays. |
Great, let me know if anything is unclear. I have additional notes for each of the issues, with a lat and long that shows each of the problem in action. |
I have been playing a little bit with the biome4 subroutine (isolating it from the driver and feeding it some numbers directly), and it seems to be sometimes returning slightly different results when feeding it the same inputs. It is usually the first run that gives a discordant result, and then the output stabilises.
Compilation with -finit-local-zero leads to yet slightly different results, suggesting that the issue might be unitialised variables. Compilation with -Wuninitialized points out a few places in the code that seem problematic.
An easy one to fix (I think) is on line 2022:
Where the two blocks should be swapped (as they are in another subroutine) so that we first define
o2
, and then use it to computets
.I get a few others, which are a bit more tricky to manage. If @jedokaplan is game, we could have a go at going through each of them and find a fix, but I'd need a bit of wisdom from someone who understands the innards of the model better than I do.
The text was updated successfully, but these errors were encountered: