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.
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.