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