Beispiel #1
0
# Example usage
import numpy as np
import matplotlib.pyplot as plt
from slab import Slab

slab_dirichlet = Slab(Bi=np.inf, L=0.02, D=9e-7, c_L=2.0, c_inf=0.0, num_eigv=30)
slab_noflux = Slab(Bi=0.0, L=0.02, D=9e-7, c_L=2.0, c_inf=0.0, num_eigv=30)
x = np.linspace(0, 0.02, 1000)
for t in np.logspace(-2, 3, 100):
    plt.plot(x, slab_dirichlet.evaluate(x, t), "b")
    plt.plot(x, slab_noflux.evaluate(x, t), "r")

plt.show()
Beispiel #2
0
# Example usage
import numpy as np
import matplotlib.pyplot as plt
from slab import Slab

slab_dirichlet = Slab(Bi=np.inf, L=0.02, D=9e-7, c_L=2., c_inf=0., num_eigv=30)
slab_noflux = Slab(Bi=0., L=0.02, D=9e-7, c_L=2., c_inf=0., num_eigv=30)
x = np.linspace(0, 0.02, 1000)
for t in np.logspace(-2, 3, 100):
    plt.plot(x, slab_dirichlet.evaluate(x, t), 'b')
    plt.plot(x, slab_noflux.evaluate(x, t), 'r')

plt.show()
Beispiel #3
0
V = 1000000.
A = 0.001

Bi  = 1e-12
L   = 1.
D   = 1e-5
c_L = 1.
c_inf = 0.

maxt = 100000
dt = 1000

num_elements = 200

times, numeric_uptake, _ = dogbone(V,A,1.,c_L,D,L,num_elements,maxt,dt)

x = np.linspace(0.,L,num_elements)

analytic_uptake = []
for t in times:
    analytic = Slab(Bi,L,D,c_L,c_inf)
    analytic_c = analytic.evaluate(x,t)
    analytic_uptake.append(np.trapz(analytic_c,x))

print A*np.array(analytic_uptake)
print numeric_uptake
plt.plot(times,A*np.array(analytic_uptake),'-')
plt.plot(times,np.array(numeric_uptake),'.')
plt.show()