2
$\begingroup$

I want to compare a few solvers of partial differential equations. I need to include the computational time and the solution accuracy (compared to analytical solution or something similar). What kind of measures I could use?

$\endgroup$
6
$\begingroup$

There are many different ways to do this. One of the standard is a work-precision plot where you plot the amount of time or function calls that it takes in order to achieve a certain level of accuracy. You can find tons of examples at DiffEqBenchmarks.jl. Generally you slide a timestep or adaptivity tolerances along a window and plot all of the (time,error) coordinates. Then the question "to get an error of X digits, what method performs best on this problem?" is nicely answered by looking at the plot.

You have to choose a measure for your error. This is a nice example which runs through quite a few on a small problem. One common way to do this is to compute a reference solution to compare against (here I use common solvers like radau at very low tolerances, lower tolerances than what's used in the tests. You can use multiple references to make sure it's sufficiently converged for the tests). Then you use some measurement of error against the reference. l2 error at the final timepoint is easy to do. l2 error along the whole timeseries is a nice measurement of average error (maybe average it by the number of steps). L2 error using dense output is a nice test to do as well if you have dense output.

While work-precision plots are quite standard, there can be reasons to do something more specific to your application. For example, you may want to time and estimate the divergence of some essential properties of your system like conservation of energy. In some cases, building a full work-precision plot is simply out of reach (getting the reference solution may take a cluster, especially if you want to keep the whole timeseries for a large PDE!). Thus you may want to just do a more targeted analysis. The good thing is, if you're only benchmarking deterministic (non stochastic) equations, then it's quite easy to put the time in and get a single reference solution (stochastic is much much harder to benchmark!).

Hopefully that gives some ideas.

$\endgroup$
2
$\begingroup$

Well the two main measures you should compare obviously is the computational time and the accuracy - do not overthink.

You can compare also the convergency/accuracy as a function of the time step. If you will test adaptive methods you should analyse the time step as function of time too.

Depending on the kind of problems you are interested, you could compare the error propagation on some system's properties. In addition, it is interesting to verify if the methods are conservatives or not, for some physical systems this is very relevant.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.