-
Notifications
You must be signed in to change notification settings - Fork 23
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
Verify numerical stability #265
Comments
Agree. Besides the current suite of tests has a lot of redundancy. You don't need a full MCM model to test a few switches. |
Marked as high priority because the new tests (see PR #268) seem to indicate some minor calculation errors. Possibily related to the numerical issues we have been worried about. |
Just putting this here as it seems the most appropriate place: when looking at numerical stability, difference in the versions of BLAS/LAPACK should be considered as a possible source of issues. More rigorous unit testing of our own routines will help narrow this all down. |
#340 adds tests for static, first-order and second-order reactions. The results are good, but the first-order test shows that there are instabilities at the smallest concentrations. This is likely because CVODE is using the same (not the latest) concentration values throughout its iteration before it stops for the next timestep. This can result in overshoots. Perhaps it can be refactored a little to use the values from the latest sub-iteration rather than the beginning of the latest outer iteration. |
The accuracy of the solver (i.e., the default values in |
Additional notes about accuracy and stability of the solver:
|
Related to #47 .
As a step towards verifying the output to a suitable standard, I think we need a suite of tests with known solutions. Currently our tests only really cover 'did I break anything from the last commit?', but in reality we also want to have confidence that our solutions are right. Typically this is done with the 'method of manufactured solutions', and I think it would be good to have a few tests touching on that. These typically can be very uncomplicated and short to run, so they shouldn't add considerably to the tests running time. I'm thinking of a few classes of tests:
Constant solution. Create mechanism files that, coupled with the initial conditions, give a constant solution. e.g.
A + B -> C, rate k
A + C -> B, rate k
B + C -> A, rate k.
A(0) = B(0) = C(0) = 1/3. I think this shouldn't matter whether we fix the zenith angles etc, as the mechanism is decoupled from the temperature and lighting. I'd probably actually have 2 versions - one with light varying and one without. Both should be identical.
Steady-state solution. Species concentrations vary from the start, but tend toward a steady-state solution (all concentrations hit a constant value and stay there). This can be used to verify that (a) the solution converges to a steady state at all, and (b) that steady state is the correct one according to the known solution.
'Manufactured solution'. We pick the RHS of the differential equations so that the solution is known. Check that the calculated solution sticks to the true solution. These can be made arbitrarily complicated, which is useful for testing the limits of what the model can do.
The text was updated successfully, but these errors were encountered: