I am modelling a 1-D semiconductor device using time steps and sweeps.
Basic equations are continuty equations and Possion’s equation:
dn/dt = Dn(E) * d2n/dx2 + velocity_n (E)dn/dx+S(p,n,E,t)
dp/dt = Dp(E) * d2p/dx2 + velocity_p (E)dp/dx+S(p,n,E,t)
d2potential/dx2 = -q/epsilon * (p-n)
where ElectricField= -grad.potential
I have functions written for Dn(E), the DiffusionTerm coefficient, and velocity_n(E), the ConvectionTerm. I implement them with the following snippet:
Nion_equation=TransientTerm(coeff=1., var=Nion)== ConvectionTerm(coeff=velocity_n, var=Nion) +DiffusionTerm(coeff=D_n, var=Nion)+emisn-Recn+photogen+n_impactgen
I have declared velocity_n and Dn as FaceVariables. But it always warns me the coeffitient can not be a FaceValue.Following are the detailed information.
The velocity_n and D_n are defined as FaceValues with the following statements:
velocity_n = FaceVariable(mesh=mesh, rank=1)
D_n = FaceVariable(mesh=mesh, rank=1)
And I give the numeraical expressions of the two coefficient:
velocity_n[0]=1000*electricfield[0].arithmeticFaceValue*(1+(10*electricfield[0].arithmeticFaceValue/(1260+electricfield[0].arithmeticFaceValue))**4)**(-1/4)+ 1.91*10**7*(electricfield[0].arithmeticFaceValue/257000)**5.7/(1+(electricfield[0].arithmeticFaceValue/257000)**5.7)
D_n[0]=f*velocity_n[0]/electricfield[0].arithmeticFaceValue
Where the electricfield is the negative gradient of the potential, and I have define the potential as the CellVariable. The relevant statements are:
potential = CellVariable(mesh=mesh, name='Potential',hasOld=True)
electricfield=-potential.grad
But it don’t work, and always warned me: The coefficient can not be a FaceVariable.
What is happening? Have I not set this up correctly? What examples could Iuse to iron this out?