【发布时间】:2020-05-20 12:34:41
【问题描述】:
我对 fipy 完全陌生。我正在尝试使用 fipy 跨两个不同的域解决以下一组 pdes。变量是 p,n 和 ψ,q,Dn,Dp,un,up,e 和 N 都是常数。 N 和 e 将值从域 1 更改为域 2。域 2 是堆叠在类似矩形域 1 之上的矩形域。变量 p 和 n 将在域 1 中求解,ψ 将在两个域中求解- 域 1 和域 2。
qDn∇2n − qun∇.(n∇ψ) = q(n-10**11)/10**(-6), in Domain 1
qDp∇2p + qup∇.(p∇ψ) = -q(p-10**21)/10**(-6), in Domain 1
∇2ψ = −(p − n- N)/e in Domain 1
e∇2ψ = 0 in Domain 2
我为解决 pdes 编写的代码已附在下面。
! pip install pyparse
from fipy import *
L= 10**(-6)
h= 20**(-6)
tox= 0.1*10**(-6)
q=1.6*10**(-19)
un=0.14
up=0.045
Vth=0.026
Dp= up*Vth
Dn=un*Vth
p0= 10**(21)
n0= 10**(11)
e0=8.854*10**(-12)
mesh1= Grid2D(dx= L/100,nx=100,dy=h/200,ny=200)
mesh2= Grid2D(dx= L/100,nx=100,dy=tox/10,ny=10)
mesh3= mesh1+(mesh2+[[0],[h]]) # final mesh
x,y= mesh3.cellCenters
N= 10**21*(y<=h) # N changes from Domain 1 to Domain 2
e= 11.9*e0*(y<=h)+ 3.9*e0*(y>h) # e changes from Domain 1 to Domain 2
p1=CellVariable(name='hole',mesh=mesh3,hasOld=True,value=p0)
n1=CellVariable(name='electron',mesh=mesh3,hasOld=True,value=n0)
psi=CellVariable(name='potential',mesh=mesh3,hasOld=True,value=1)
p=p1*(y<=h) # for domain separation
n=n1*(y<=h) # for domain separation
mask1=((y==0))
mask2=(y==h)
mask3=(y==(h+tox))
# 1e50 is the large value
# boundary conditions are p(x,0)= p0, n(x,0)= n0, psi(x,0)= 0, p(x,h)= p0*exp(-psi/Vth), n(x,h)= n0*exp(psi/Vth), psi(h+tox)= 5
eq1=(DiffusionTerm(coeff=q*Dn,var=n)-ConvectionTerm(coeff=q*un*psi.faceGrad,var=n)==ImplicitSourceTerm(coeff=q*(n-10**5)/10**(-6),var=n)-ImplicitSourceTerm(mask1*1e50)-ImplicitSourceTerm(mask2*1e50)+mask1*1e50*n0+mask2*1e50*n0*numerix.exp(psi/Vth))
eq2=(DiffusionTerm(coeff=q*Dp,var=p)+ConvectionTerm(coeff=q*up*psi.faceGrad,var=p)==ImplicitSourceTerm(coeff=-q*(p-10**15)/10**(-6),var=p)-ImplicitSourceTerm(mask1*1e50)-ImplicitSourceTerm(mask2*1e50)+mask1*1e50*p0+mask2*1e50*p0*numerix.exp(psi/Vth))
eq3=(DiffusionTerm(coeff=e,var=psi)==ImplicitSourceTerm(coeff=-q*(p-n-N),var=psi)-ImplicitSourceTerm(mask1*1e50)-ImplicitSourceTerm(mask2*1e50)-ImplicitSouceTerm(mask3*1e50)+mask1*1e50*0+mask2*1e50*psi+mask3*1e50*5)
eq= eq1 & eq2 & eq3
for t in range (50):
p.updateOld()
n.updateOld()
psi.updateOld()
eq.solve(dt=10) # Since the equation does not have any transient term, a large value of dt=5 has been chosen
现在,我收到以下错误:ExplicitVariableError: 具有显式变量的术语不能与具有隐式变量的术语混合。
考虑到我编写代码的方式,我也不确定方程之间的耦合是否真的有效。
请注意,我实际上是在使用上述 pdes 解决 MOSCAP。 对此的任何帮助将不胜感激。
【问题讨论】: