# Rallpack

The rallpack tests are a collection of models with either analytic solutions (Rallpack 1 and 2) or data computed by independently validated systems (Rallpack 3). The three models are packaged within PSICS and can be run with the "-v" flag. The output should match Rallpack1, Rallpack2, and Rallpack3.

The generated graphs show that calculations agree with reference data to within the typical change over a single timestep, but the asymptotic behavior for small timesteps is generally buried under superimposed lines. This behavior also depends on the choice of time differencing for the calculation. PSICS supports the implicit Euler and Crank-Nicolson schemes via the "method" attribute of a model specification and also anything in between by setting the "tdWeighting" attribute.

For the implicit Euler scheme, the change in membrane potential during a step is computed with the
gradient at the end of the step. For Crank Nicolson, the average of the gradients at the start and end are used
and for others a weighted average is used:

grad = tdWeighting (gradient at end) + (1 - tdWeighting) (gradient at start).

Thus the implicit Euler is equivalent to a weighting factor of 1.0 and Crank-Nicolson to a weighting factor of 0.5.
Using a tdWeighting of zero would give the forward Euler method.

The choice of scheme is discussed further in the user guide but for for validation purposes there are three main observations to be made that apply to the differencing algorithm rather than to a particular implementation.

- With the implicit Euler method the numerical results can be expected to be a relatively poor approximation at large timesteps and to approach the analytic results monotonically for increasingly small timesteps, at least down to 1 microsecond. This is a good validation test because using smaller timesteps should bring the results asymptotically closer to the reference.
- The standard Crank Nicolson (tdWeighting = 0.5) often suffers from ringing in which the numerical result jumps back and forth across the analytic solution. The effect increases with larger timesteps.
- The best results are normally obtained with a slightly modified Crank Nicolson (eg tdWeighting = 0.51) which damps out most of the ringing but keeps the improved accuracy. However, in general this cannot be expected to consistently improve with smaller timesteps and may actually get worse below a certain level.

The examples above use the weighted Crank-Nicolson method. The implicit Euler method behavior can be seen in Rallpack1-IE, Rallpack2-IE, and Rallpack3-IE.