I'm working on drift-diffusion simulation and am having difficulties
setting up boundary conditions to describe my system. I have the bare bones
of the system attached in a .txt file.

I have the potential on the left constrained to 9 and on the right to 0 to
reflect applying a 9V bias to the system. Now, what I want to include is
essentially an insulating layer to the left and right side.. let's say 10
mesh cells on both sides. So, I don't want any positive or negative charges
to start in those cells, or be able to flow into those cells. Is that
possible? I've tried extracting the mesh face values and constraining Pion
and Nion to be zero in those cells, but that didn't seem to run properly.
Any advice?

Justin Pothoof
The University of Washington - Department of Chemistry
Pre-Candidacy PhD Student
Ginger Group
nx = 500  # Number of cells in system
y01 = np.zeros(nx)
y01[0:nx+1] = 2.5e21 # Positive ion density
y02 = np.zeros(nx)
y02[0:nx+1] = 2.5e21 # Negative ion density

mesh = Grid1D(dx=dx, nx=nx) # Establish mesh in how many dimensions necessary

Pion = CellVariable(mesh=mesh, name='Positive ion Charge Density', value=y01)
Nion = CellVariable(mesh=mesh, name='Negative ion Charge Density', value=y02)
potential = CellVariable(mesh=mesh, name='Potential')

Pion_equation = TransientTerm(coeff=1., var=Pion) == mu_p_1 * 
ConvectionTerm(coeff=potential.faceGrad, var=Pion) + Dp_1 * 
DiffusionTerm(coeff=1., var=Pion) - k_rec * Pion * Nion
Nion_equation = TransientTerm(coeff=1., var=Nion) == -mu_n_1 * 
ConvectionTerm(coeff=potential.faceGrad, var=Nion) + Dn_1 * 
DiffusionTerm(coeff=1., var=Nion) - k_rec * Pion * Nion
potential_equation = DiffusionTerm(coeff=1., var=potential) == -(q / epsilon) * 
(Pion - Nion)

potential.constrain(9., where=mesh.facesLeft)
potential.constrain(0., where=mesh.facesRight)

eq = Pion_equation & Nion_equation & potential_equation

_______________________________________________
fipy mailing list
fipy@nist.gov
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]

Reply via email to