pydiffusion is a free and open-source Python library designed to solve diffusion problems for both single-phase and multi-phase binary systems. The key features of pydiffusion include fast simulation of multi-phase diffusion and extraction of diffusion coefficients from experimental concentration profiles using forward simulation analysis. pydiffusion also provides various mathematical models for diffusion profile smoothing, diffusion coefficient evaluation, and data optimization. In pydiffusion, diffusion profiles and various phases are easy to define or read from the experimental datasets. Visualization tools based on Matplotlib are also provided to help users present or refine their simulations and analysis.

Diffusion is the transport of matter from one point to another by thermal motion of atoms or molecules [^{th} century. Since then, various theories and models have been established to describe solid-state diffusion. Tremendous amount of diffusion data has been collected to better understand and predict diffusion associated phenomena such as precipitation, homogenization, solidification and creep deformation. In the past decades, many computational tools [

As one of the fundamental properties in materials, diffusion coefficients are essential inputs for the establishment of mobility database and Integrated Computational Materials Engineering (ICME) [

The pydiffusion software package is an open-source Python library designed to simulate diffusion and analyse diffusion data using various mathematical and simulation models. Compared to commercialized simulation software like DICTRA [

The general architecture of pydiffusion is depicted in Figure

General architecture of the pydiffusion package.

The

There are many types of profile data in diffusion analysis. For experimental raw data,

The

Like

Within a single phase, diffusion can be simulated using the finite difference method based on Fick’s two diffusion laws:

For a binary diffusion system with multiple phases, phase boundary/interface is controlled by moving boundary condition:

In _{α}_{β}

Configuration nearby an interface on simulation grids. The dash line denotes the interface at location ^{If}

To ensure stability, the simulation time step Δt must be strictly under control. In every simulation loop within

Within every phase, von Neumann analysis [

In which

Each phase interface can pass by one grid at most after each loop. The purpose of this rule is to help arrange grids easier by the end of each simulation loop.

For the grids nearby phase boundaries, the two rules above cannot keep their composition values within their solubility limits. An additional rule must be assigned. In Figure _{A}_{α}_{B} < C_{β}^{nd} law, which is:

So Δ

In diffusion with a liquid phase attached, diffusion coefficients in liquid phase (~5 × 10^{–9}m^{2}/s) is extremely high in comparison with a solid phase. Therefore, liquid can only be attached to the end of the geometry in

For diffusion simulations with thin films, users can setup the initial profile with a very thin phase on the left/right.

The

The

in which,

In FSA,

Because ^{α} based on

Parameter

The core simulation mechanism in pydiffusion was developed in 2013 by Zhang and Zhao [

Sauer-Freise equation [

FSA has been applied to many alloy systems for the past several years [

pydiffusion can run on Linux, OSX or Windows with supported version of Python installed.

Python 3.5+

None.

NumPy [

SciPy [

Pandas [

Matplotlib [

Zhangqi Chen – Development and Testing

Qiaofu Zhang – Development of an FSA matlab code (precursor of pydiffusion)

Ji-Cheng Zhao – Project supervision

English

As the core functionality of pydiffusion, diffusion simulation and diffusion coefficient evaluation are very useful in materials research and development, especially for diffusion (mobility) database establishment and ICME-based materials design. Because a diffusion system is easy to define in pydiffusion, researchers can also utilize the simulation tools in this package to estimate diffusion length and phase growth for their future experiments. pydiffusion also provides various functions to help diffusion analysis, such as Matano plane calculation, the Hall method [

More features will be added to the pydiffusion package in the future to provide more simulation and analysis tools. For example, the functions to implement 2-dimenstional (2D) numerical simulations will be provided to simulate diffusion in 2D. Various thermodynamics and kinetics modelling tools based on CALPHAD approach will also be included in pydiffusion so that users can perform mobility assessment using various diffusion datasets. These features will make pydiffusion a general and convenient tool to perform efficient and accurate diffusion data analysis and forward simulations.

New users can find example documentation in the repository, which illustrates usage of the core functions in pydiffusion. Example datasets and scripts are also provided. All methods in pydiffusion provide full explanations in their documentation strings. Users who are interested in collaboration or seeking technical support are welcome to contact authors by email.

The authors have no competing interests to declare.

_{2}(Si,Sn) alloys