This package is for simulating non-steady state diffusion according to Fick's Second law of diffusion in 1 dimension.
pip install fick1d
- Slab
- Cylinder
- Sphere
- Diffusion Couple
- Thin Film
import fick1d
import matplotlib.pyplot as plt
times = [100,200,300] # 100,200,300 seconds after diffusion starts
slab_thickness = .1 # .1 meters thick slab
diffusivity = 1.88e-5 # diffusivity of material to be simulated in m^2/s
interface_concentration = .5 # concenttration at interface for slab in m^2/s
initial_concentration = 0 # initial concenttration for slab in m^2/s
results = fick1d.slab.slab( times,
slab_thickness,
diffusivity,
interface_concentration,
initial_concentraton)
for i in range(len(times)):
plt.title(fun)
plt.plot(linspace(0,slab_thickness,1000),results[i],label = str(times[i]))
plt.legend()
plt.show()
This is the general pde that governs diffusion in solids.
Assuming only radial diffusion,
With the limit as r -> 0 i.e. the concentration at the center of the sphere
Assuming only radial diffusion,
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Kieran Nehil github