I'm about to start working on a software library of numerical ODE solvers, and I'm struggling with how to formulate tests for the solver implementations. My ambition is that the library, eventually, will include solvers for both nonstiff and stiff problems, and at least one implicit solver (more or less on par with the capabilities of the
ode routines in Matlab), so the test methodology needs to reflect the various types of problems and criteria for different solvers.
My problem now is that I don't know where to begin with this testing. I can think of a few different ways to test the output of an algorithm:
Test for a problem that has an analytical solution, and check that the numerical solution is within tolerance levels for all the returned data points. This requires knowledge of a number of analytical problems which exhibit all the properties that I want the different solvers to work with (stiffness, implicit problems etc), which I don't have, at least not off the top of my head.
This method tests the results of a solver method. Thus, there is no guarantee that the solver actually works, just that it works for the given test problem. Therefore, I suspect a large number of test problems is needed to confidently verify that the solver works.
Manually calculate the solution for a few time steps using the algorithms I intend to implement, and then do the same with the solvers and check that the results are the same. This requires no knowledge of the true solution to the problem, but in turn requires quite a lot of hands-on work.
This method, on the other hand, only tests the algorithm, which is fine by me - if someone else has proven that 4th order Runge-Kutta works, I don't feel a desperate need to. However, I do worry that it will be very cumbersome to formulate test cases, as I don't know a good method to generate the test data (except maybe by hand, which will be a lot of work...).
Both the above methods have serious limitations for me with my current knowledge - I don't know a good set of test problems for the first one, and I don't know a good method of generating test data for the second.
Is there other ways to verify numerical ODE solvers? Are there other criteria on the implementations that should be verified? Are there any good (free) resources on testing ODE solvers out there1?
Since this question is very broad, I want to clarify a little. The test suite I want to create will fill two main purposes:
Verifying that the solvers work as expected, for the problems they're intended to solve. In other words, a solver for non-stiff problems is allowed to go bananas on a stiff problem, but should perform well on non-stiff problems. Also, if there are other solvers in the library that offer higher accuracy, it might not be necessary to enforce very accurate results - just "accurate enough". Thus, part of my question is what tests should be used for what solvers; or, at least, how one should reason to decide that.
Sanity test upon installation of the library. These test need not (should not) be elaborate or time-consuming; just the very basics that can be run in under 5 seconds, but that will alert the user if something is off-the-charts weird. Thus, I also need a way to construct tests that are very simple, but that still tell me something about the state of the library.
1 Yes, I've been Googling my eyes out, but most of what I find is lecture notes with very trivial examples, with the notable exception of the CWI ODE test set from Bari which I don't know if, or how, I could use for my purposes, since it treats much more sophisticated solvers than the ones I want to test...