# Determine the step size in a differential equation numerical solver

How can we define the precision we require in a numerical differential equation solver? What is it that I have to optimize to know? And how do I know that I'm at a sufficient time-step value?

For example, in those programs like Mathematica and Matlab, how does the differenital equations solver know the suitable step-size for your problem? How could that be automatically determined?

A full explanation to the approach would be nice (or maybe a term that can be googled).

Thanks for any efforts.

• Are you asking about (systems of) ordinary differential equations? "Stiffness" is a term of art you should know. If a system is "stiff" then decreasing the step size causes numerical instability (in forward difference schemes), but if a system is not stiff, then decreasing step size improves the accuracy of solutions. To deal with this there are terms "adaptive step size" and "implicit methods" which you should become familiar with. Oct 24 '13 at 21:54

What is typically done for ODEs is to solve at each timestep using two methods of different order. The discrepancies between the results are then used to estimate the error and then decide whether to decrease or increase the timestep length.

You can find more information on the subject here. Two examples of these types of schemes are RKF45 and Dormand-Prince.

for 1-D transport problem, under implicit method, we use courant number, a dimensionless number to choose appropriate time steps:

$\frac{u\Delta t}{\Delta x}\le C_{max}$

$C_{max}$ should be less than 1, if we make it as 1, we get

$\Delta t\le \frac{\Delta x}{u}$

The basic ideal is that, at one time step, a particle placed in the problem domain should never transport through two nodes where solving properties are defined.

for 2-D one can expand it as:

$\frac{u_{x}\Delta t}{\Delta x}+\frac{u_{y}\Delta t}{\Delta y}\le C_{max}$

• The CFL condition is a necessary condition for stability, which is in turn a necessary -- but not sufficient -- condition for accuracy. Choosing a given Courant number less than one may satisfy stability restrictions, but not accuracy. Oct 25 '13 at 3:13