1 function n=DDGelectron_driftdiffusion(psi,x,ng,p,ni,tn,tp,un)
3 % n=DDGelectron_driftdiffusion(psi,x,ng,p)
4 % Solves the continuity equation for electrons
5 % input: psi electric potential
7 % ng initial guess and BCs for electron density
8 % p hole density (for SRH recombination)
9 % output: n updated electron density
11 ## This file is part of
13 ## SECS1D - A 1-D Drift--Diffusion Semiconductor Device Simulator
14 ## -------------------------------------------------------------------
15 ## Copyright (C) 2004-2007 Carlo de Falco
19 ## SECS1D is free software; you can redistribute it and/or modify
20 ## it under the terms of the GNU General Public License as published by
21 ## the Free Software Foundation; either version 2 of the License, or
22 ## (at your option) any later version.
24 ## SECS1D is distributed in the hope that it will be useful,
25 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
26 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 ## GNU General Public License for more details.
29 ## You should have received a copy of the GNU General Public License
30 ## along with SECS1D; If not, see <http://www.gnu.org/licenses/>.
34 Nnodes =length(nodes);
36 elements = [[1:Nnodes-1]' [2:Nnodes]'];
37 Nelements=size(elements,1);
44 h=nodes(elements(:,2))-nodes(elements(:,1));
47 Bneg=Ubernoulli(-(psi(2:Nnodes)-psi(1:Nnodes-1)),1);
48 Bpos=Ubernoulli( (psi(2:Nnodes)-psi(1:Nnodes-1)),1);
51 d0 = [c(1).*Bneg(1); c(1:end-1).*Bpos(1:end-1)+c(2:end).*Bneg(2:end); c(end)*Bpos(end)];
52 d1 = [1000;-c.* Bpos];
53 dm1 = [-c.* Bneg;1000];
55 A = spdiags([dm1 d0 d1],-1:1,Nnodes,Nnodes);
56 b = zeros(Nnodes,1);%- A * ng;
58 % SRH Recombination term
59 SRHD = tp * (ng + ni) + tn * (p + ni);
63 ASRH = Ucompmass (nodes,Nnodes,elements,Nelements,SRHL,ones(Nelements,1));
64 bSRH = Ucompconst (nodes,Nnodes,elements,Nelements,SRHR,ones(Nelements,1));
72 b(end) = - A(end-1,end) * nr;
81 % $Date: 2008-02-04 16:26:27 +0100 (man, 04 feb 2008) $