In [1]:
%matplotlib inline
from matplotlib import colors
import matplotlib.pylab as plt
from oedes.fvm import mesh1d
from oedes import context,init_notebook,testing,models
import numpy as np
from oedes.functions import Aux2
init_notebook()
In [2]:
class CustomMobility(models.MobilityModel):
def mu_func(self, T, E, c):
mu0 = 5e-11
mu1 = 5e-9
W = 0.04
f0 = 0.3
f = c / 0.3e27
return (mu1 - mu0) * Aux2((f0 - f) / W) + mu0
def mobility(self, parent, ctx, eq):
mu_cell = self.mu_func(ctx.varsOf(eq.thermal)['T'], ctx.varsOf(eq.poisson)['Ecellm'], ctx.varsOf(eq)['c'])
mu_face = eq.mesh.faceaverage(mu_cell)
ctx.varsOf(eq).update(mu_face = mu_face, mu_cell = mu_cell)
In [3]:
mesh = mesh1d(2e-6)
In [4]:
def solve(mu_ions, mobility_model, additional_params=None, voltage=5.):
model = models.BaseModel()
models.std.electronic_device(model, mesh, 'pn', mobility_model = mobility_model)
cation, anion, initial_salt = models.std.add_ions(model, mesh, zc=1, za=-1)
model.setUp()
xinit = initial_salt(0.1e27)
params = {'T': 300.,
'electron.energy': 0.,
'electron.N0': 0.3e27,
'hole.energy': -2.,
'hole.N0': 0.3e27,
'electrode0.workfunction': 2.,
'electrode1.workfunction': 0.,
'electrode0.voltage': voltage,
'electrode1.voltage': 0,
'cation.mu': mu_ions,
'anion.mu': mu_ions,
'npi': 0,
'epsilon_r': 3.
}
if additional_params is not None:
params.update(additional_params)
c = context(model,x=xinit)
c.transient(params, 1, 1e-9)
return c
In [5]:
def transientplot(data):
N0 = 5e27
n = 20
for it, t in enumerate(10**np.linspace(-5, -1, n + 1)):
out = data.attime(t).output()
c = 1 - (1. - it / n)
ncolor = colors.rgb2hex((1,1 - c,1 - c))
pcolor = colors.rgb2hex((1 - c,1 - c,1))
plt.plot(mesh.cells['center'] * 1e9,out['electron.c'] / N0,ncolor)
plt.plot(mesh.cells['center'] * 1e9,out['hole.c'] / N0,pcolor)
testing.store(out['electron.c'], rtol=1e-7, atol=1e-3 * N0)
testing.store(out['hole.c'], rtol=1e-7, atol=1e-3 * N0)
plt.yscale('log')
plt.ylim([1e-5, 1.])
plt.xlabel('$x$ [nm]')
plt.ylabel('$c/N_0$')
In [6]:
mu_params = {'electron.mu':5e-11,'hole.mu':5e-11}
c=solve(5e-11, models.MobilityFromParams(), mu_params)
transientplot(c)
In [7]:
c=solve(mu_ions=5e-11, mobility_model=CustomMobility())
transientplot(c)
S.van Reenen, R.A.J.Janssen, M.Kemerink Doping dynamics in light-emitting electrochemical cells, Organic Electronics 12 (2011) 1746–1753.
This file is a part of oedes, an open source organic electronic device simulator. For more information, see https://www.github.com/mzszym/oedes.