Skip to content

kierannp/fick1d

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fick1d

This package is for simulating non-steady state diffusion according to Fick's Second law of diffusion in 1 dimension.

Installation

pip install fick1d

Current 1-D models supported:

  • Slab
  • Cylinder
  • Sphere
  • Diffusion Couple
  • Thin Film

Example Usage

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()

Fick's second law

This is the general pde that governs diffusion in solids.

Slab Solution

Slab

Thin Film Solution:

Thin Film

Sphere Solution

Assuming only radial diffusion,

With the limit as r -> 0 i.e. the concentration at the center of the sphere

Sphere

Cylinder Solution

Assuming only radial diffusion,

Cylinder

Diffusion Couple Solution

Diffusion Couple

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Author

Kieran Nehil github

Source for Math:

http://www-eng.lbl.gov/~shuman/NEXT/MATERIALS&COMPONENTS/Xe_damage/Crank-The-Mathematics-of-Diffusion.pdf

About

The purpose of this repo is to one day create a python library

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages