Skip to main content

A small package for solving Fick's Second law in 1-dimension for various geometries

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fick1d-0.0.2.tar.gz (5.8 kB view hashes)

Uploaded Source

Built Distribution

fick1d-0.0.2-py3-none-any.whl (19.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page