rivm-syso / OPS

Operationele Prioritaire Stoffen model
https://www.rivm.nl/operationele-prioritaire-stoffen-model
GNU General Public License v3.0
15 stars 7 forks source link

Document estimated rounding errors #7

Open monty241 opened 4 years ago

monty241 commented 4 years ago

Related to #4.

The current code uses single precision numbers. But even with arbitrary precision numbers, cumulative errors can be introduced when executing many calculation steps and using the output of previous steps as input to next steps. Programmers typically need to take care that numeric errors do lead to outcomes with an accuracy outside of the pre-established required accuracy.

The current code does not ground-up document the rounding errors in terms of precision lost during the process; it may be documented elsewhere.

Also, it seems that during the evolution from the historical code into the current version the scope has been extended to a finer matrix resolution. Maybe the original code was checked for rounding errors, but such a scope change may require additional checks. These might also have been done outside of the code.

A little overly dramatic sample of the past when still studying at EUT was the Patriot software issue as documented on https://hownot2code.com/2016/11/09/r-17-vs-patriot-a-rounding-issue-bugs-in-a-missile-defense-system/.

Suggestion is to extend each method by some documentation assessing the precision loss, allowing top level determination of the accuracy boundaries of the model and whether they fall within the acceptable range.

RIVM-OPS commented 2 years ago

First of all, we'd like to apologise for the late reaction. We'll try to reply more quickly to future issues. Thank you for your suggestion. This has been tested by gjcats in https://github.com/rivm-syso/OPS/issues/6, in those tests no significant differences were found. We agree that it is useful to know more about the effects of precision and plan to conduct our own tests as well. We will update this issue once the results of those tests become available.

monty241 commented 1 month ago

Maybe also include background of the 0,0005 mol or whatever, since the topic keeps appearing in the public without background.

Maybe also include in documentation whether an x-fold increase of emitted particles leads to a y% exact higher x-fold times higher deposit of this source (it seems to be the case that it is linear within the practical boundaries).

RIVM-OPS commented 2 weeks ago

Dear Monty241, I’m assuming that you mean “rekenkundige ondergrens” of 0.005 mol/ha/yr, not 0.0005 mol/ha/yr. In the OPS model description we discuss the scope of application of the model. The scope of application of the OPS model includes deposition fluxes below 0.005 mol/ha/yr. Hence, we feel that the application of a lower bound of 0.005 mol/ha/yr is not something to discuss in the model description.

monty241 commented 2 weeks ago

Yes, sorry, correct.

I had understood that it is due to possible rounding errors due to the datatypes used (+- some minimum precision and/or floating point deviation).

monty241 commented 1 week ago

Linkback:

https://debatdirect.tweedekamer.nl/2024-10-02/landbouw-natuur-voedselkwaliteit/troelstrazaal/rekenkundige-ondergrens-10-00/video

01:23:00 and further

Acceptable computational time according to mr. Addo van Pul.

monty241 commented 1 week ago

(I had expected that it would be related to the datatype REAL(4))