solver

This shows you the differences between two versions of the page.

solver [2014/06/25 11:15] |
solver [2014/06/25 11:15] (current) |
||
---|---|---|---|

Line 1: | Line 1: | ||

+ | A solver is a software algorithm that solves a system of [[ode|ordinary differential equations]]. The choice of solver is crucial for complex models. Below we describe some of the terms defining the different solvers implemented in MERLIN-Expo. | ||

+ | The solver is selected in the [[simulation screen#solver]] tab of the simulation settings window. This tab also let you configure parameters for the solver. | ||

+ | |||

+ | ====Time stepping method==== | ||

+ | |||

+ | The two solvers in MERLIN-Expo are both [[wp>Numerical methods for ordinary differential equations|variable-step solvers]] that use algorithms to adapt the size of the time-steps to maintain a certain error tolerance. It may take larger time steps when the solution vary slowly whilst adapting and taking smaller time-steps as soon as the solution begins to vary faster. | ||

+ | |||

+ | Variable-step-size solvers are usually much faster than fixed-step-size solvers. They are also more reliable and ensures that numerical instability does not occur. | ||

+ | |||

+ | ====Error tolerances==== | ||

+ | |||

+ | The size of the error tolerance levels specified for the numerical solution affects the accuracy of the computed solution. But it also affects the speed of the computation. The accuracy and the speed are negatively correlated; i.e. the better quality you want of the solution, the more you need to wait for the [[simulation]] to finish. | ||

+ | |||

+ | In the variable-step-size ODE solvers in MERLIN-Expo the time-stepping is adaptively adjusted to maintain the estimated truncation error below a specified tolerance level. A truncation error is the error that occurs when an "infinite process is exchanged with a finite", i.e. when an infinite series is approximated by a partial sum, or when a function is approximated by a straight line. The tolerance levels are specified in relative and absolute terms. | ||

+ | |||

+ | * relative error tolerance ≥ | (y<sub>true</sub> - y<sub>estimated</sub>) / y<sub>true</sub> | | ||

+ | * absolute error tolerance ≥ | y<sub>true</sub> - y<sub>estimated</sub> | | ||

+ | |||

+ | So the relative error tolerance level measures the error relative to each state. It is recommended to specify a relative accuracy of at least 1%, otherwise there are a risk that the error estimation formulas computes incorrect error estimates and thus the adaptive step size control will not work and the computed solution will not have the accuracy specified. The default value of 1.0e-3 implies that the computed state is accurate within 0.1% | ||

+ | |||

+ | As can be seen from the definition of the relative error tolerance it is not defined when the solution y is 0. This is a situation when the absolute error tolerance is used. It is also used to avoid situations where the solver has to work hard to achieve a high relative accuracy for solution components that are of little interest or influence when small. | ||

+ | |||

+ | Apart from the speed issue when using small error tolerance levels it may also be impossible to solve due to limitations in floating point numbers. That is; you cannot request a truncation error smaller than the round-off error of the computer. If impossible accuracy is defined the computation will take a long time and the solution will have worse accuracy than if looser tolerance levels where defined. | ||

+ | |||

+ | For problems that are [[#stiff problems|stiff]] or when there exists periodic components in the problem, the error estimate may be significantly inaccurate. To detect erroneous solutions it is recommended to repeat the computation with different error tolerances. | ||

+ | |||

+ | ====Explicit and implicit methods==== | ||

+ | |||

+ | An explicit method uses only things that are known to find out the new value //y<sub>n+1</sub>// at the next time-step. An implicit method on the other hand always has to solve an equation to obtain //y<sub>n+1</sub>//. The equation is solved iteratively using a simplified Newton method. | ||

+ | |||

+ | An extra overhead in computational time burdens the implicit method but has an advantage in being able to solve [[#stiff problems|stiff]] problems in reasonable time. That is; the implicit method is much more stable for these kind of problems and therefore can take larger time-steps //h// than the explicit method can. | ||

+ | |||

+ | But for non-stiff problems the explicit methods are much more suitable. | ||

+ | |||

+ | ====Stiff problems==== | ||

+ | |||

+ | It seems to be difficult to make a proper definition of a stiff problem but the following quote wraps it up pretty well: | ||

+ | |||

+ | //"A problem is stiff if the solution being sought is varying slowly, but there are nearby solutions that vary rapidly, so the numerical method must take small steps to obtain satisfactory results."// | ||

+ | |||

+ | Cleve Moler | ||

+ | |||

+ | A problem that is stiff requires a special type of solver. In MERLIN-Expo the [[NDF solver]] is used for stiff problems, and is also the default solver. | ||

+ | |||

+ | ====The order of a method==== | ||

+ | |||

+ | The //local error// of a method is the error you get when performing one step of the method. I.e. the difference //(Δ<sup>h</sup><sub>n+k</sub>)// between the result given by the method //(y<sub>n+k</sub>)//, assuming all the earlier //n+k-1// steps where correct and the exact solution //(y(t<sub>n+k</sub>))//. | ||

+ | |||

+ | The order of a method //p// is then defined as: | ||

+ | |||

+ | //Δ<sup>h</sup><sub>n+k</sub> = O(h<sup>p+1</sup>), as h → 0.// | ||

+ | |||

+ | The //global error// is the error sustained in all the steps one needs to reach a fixed time //t//. The global error of a //p//th order one-step method is //O(h<sup>p</sup>)//. | ||

+ | |||

+ | ====One-step and multistep methods==== | ||

+ | |||

+ | The solver algorithms can also be categorized to be either one-step or multistep methods. A one-step method has no "memory". So to compute the next solution point a one-step method only requires the current solution point (as an initial value), and does not use any other previously computed solution points. In other words, it treats each new time step computation as an initial value problem. | ||

+ | |||

+ | A multistep method on the other hand, has a "memory" in the sense that it uses the //k+1// previously computed solution values to compute the next solution value. One-step methods are usually used to start up the multistep methods. | ||

+ | |||

+ | The multistep methods needs in general fewer evaluations of the differential equation function //f// per time step than the one-step methods. This since it reuses the values stored from previous time steps. But the one-step methods are often faster than the multistep methods. Use multistep methods when problem is smooth and require high accuracy. | ||

+ | |||

+ | ====See also==== | ||

+ | |||

+ | * [[simulation screen#solver|Solver settings]] | ||

+ | * [[NDF solver]] | ||

+ | * [[DOPRI45 solver]] |

solver.txt · Last modified: 2014/06/25 11:15 (external edit)