# API :: Simulations¶

Single cell Simulations can be run using the Simulation class. This wraps around a model and a protocol object and provides an interface to the on-the-fly generated C module. A similar class is provided to perform a 1d Simulation. Parallelized 1d and 2d simulations can be run using the class SimulationOpenCL which can utilise all cores of a CPU or GPU. This simulation type can also be used to investigate the effects of parameter variations (in grids of uncoupled cells) or heterogeneity (in coupled grids of cells).

Simulation results for all simulations are stored in a DataLog. This specialized dict type can be stored to disk using save or save_csv. One or two-dimensional logs often take the shape of a rectangular grid. While the DataLog class is built for maximum flexibility and allows irregular shapes, it can often be useful to exploit the rectangular grid shape of the data. For these cases, the data logs can be converted to specialised structures called DataBlock1d and DataBlock2d.

A few specialized classes are included in the simulations package. The RhsBenchmarker can be used to rapidly evaluate the running time of a model’s equations which can be useful to optimise model running times. The JacobianCalculator can be used to calculate a single Jacobian matrix, while the JacobianTracer can be run after a single cell simulation to calculate the Jacobian matrix and (dominant) eigenvalues at every visited point of the state space. The ICSimulation goes a step further and runs a full simulation where the jacobian is integrated along with the state derivatives to calculate the partial derivatives of the state with respect to the initial state values.