# Gareth Kennedy

data scientist and mathematical modeller # MECSim Validation ## Validation against analytical solutions

Validation using analytical solutions is the best test of any numerical code. Unfortunately there are only a few conditions where analytical solutions exist. I'll be adding more of these over time.

### Rotating Disk Electrode

 In the steady state solution of a diffusion limited electro-active species in contact with a rotating disk electrode the current can be predicted by the Levich equation. The theoretical current value (red line) is plotted along side the simulation results obtained from MECSim (black curve) on the right. The ipython notebook outlining this test can be found here, while the html version of the notebook is here. The input file used to generate the simulation data using MECSim is here. ### Langmuir isotherm

 The aim here is to reproduce the Langmuir isotherm directly from numerical results from MECSim using a mechanism that mimics adsorption by using a pre-existing surface confined species rather than the assumption of free and taken sites on the electrode. In practice these are the same thing, which is why MECSim reproduces the isotherm without in-built assumptions. The ipython notebook outlining this test can be found here, while the html version of the notebook is here. The method of sweeping over a parameter which was used to make this plot is described here. ## Comparison to other codes: DigiElch 7

A summary of all tests compared between DigiElch 7 (DE7) and MECSim is shown below. This figure shows excellent agreement for all currents against time (shown) and all concentrations and their derivatives (not shown). Minor differences exist regarding the rotating disk electrode, but these are understood to be slight differences in the implementation of the viscosity and velocity terms of the electrode between the two codes. This will be discussed more in the upcoming MECSim paper, but for now it is sufficient to know that the differences are typically less than 1%.

In the below figure current against time is shaded in blue for DE7 and red for MECSim, both of which are 50% transparent, so the purple colour occurs when both overlap. More details of this figure will be given in the paper, it basically shows agreement over a wide range of mechanisms including surface confined and multiple chemical steps. 