febid.diffusion.diffusion_ftcs#

diffusion_ftcs(grid, surface, D, dt, cell_dim, surface_index=None, flat=True, add=0)[source]#

Calculate diffusion term for the surface cells using stencil approach

Nevertheless the ‘surface_index’ is an optional argument,

it is highly recommended to handle index from the caller function

Parameters:
  • grid – 3D precursor density array, normalized

  • surface – 3D boolean surface array

  • D – diffusion coefficient, nm^2/s

  • dt – time interval over which diffusion term is calculated, s

  • cell_dim – grid space step, nm

  • surface_index – a tuple of indices of surface cells for the 3 dimensions

  • flat – if True, returns a flat array of surface cells. Otherwise, returns a 3d array with the same shape as grid.

  • add – Runge-Kutta intermediate member

Returns:

3d or 1d ndarray