Fick Solver

Online simulation of pure diffusion in homogeneous materials based on the numerical solution of Fick's second law.

Online simulation of Fickian diffusion of ions in homogeneous materials. Diffusion is calculated according to Fick's second Law. Method of Lines with uniform grid is used to transform partial differential equation (PDE) into set of ordinary differential equations (ODE). Resulting set of ODE is then solved using explicit Euler's method.

Time-dependent diffusion model - basic equations

Fick second Law
` \frac{\partial c}{\partial t} = D \frac{\partial^2 c}{\partial x^2}`
Second central derivative of concentration at point `x_i`
` \frac{\partial^2 c_i}{\partial x^2} = \frac{c_{i+1}-2c_i+c_{i-1}}{h^2}`
Explicit Euler's method
` c_i(t_{j+1}) = c_i(t_j)+ \Delta t \cdot \frac{dc_i}{dt}`
Final diffusion equation

After combining the three equations above, we obtain:

`c_i(t_{j+1}) = c_i(t_j)+ \frac{\Delta t}{h^2} D \cdot (c_{i+1}-2c_i+c_{i-1})`
Initial and boundary conditions
Initial condition:
`c(x,0) = 0`
Boundary conditions:
$$ \left\{ \begin{array}{l} c(0,t) = c_L = const \\ c(l,t) = c_R = const \end{array} \right. $$