1 function c=Udriftdiffusion2(mesh,Dsides,guess,M,U,V,Vth,u)
4 % c=Udriftdiffusion(mesh,Dsides,guess,M,U,V,Vth,u)
5 % solves the drift diffusion equation
6 % $ -div ( u ( \nabla (n Vth) - n \nabla V)) + M = U $
11 % SECS2D - A 2-D Drift--Diffusion Semiconductor Device Simulator
12 % -------------------------------------------------------------------
13 % Copyright (C) 2004-2006 Carlo de Falco
17 % SECS2D is free software; you can redistribute it and/or modify
18 % it under the terms of the GNU General Public License as published by
19 % the Free Software Foundation; either version 2 of the License, or
20 % (at your option) any later version.
22 % SECS2D is distributed in the hope that it will be useful,
23 % but WITHOUT ANY WARRANTY; without even the implied warranty of
24 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 % GNU General Public License for more details.
27 % You should have received a copy of the GNU General Public License
28 % along with SECS2D; If not, see <http://www.gnu.org/licenses/>.
30 global DDG_RHS DDG_MASS %DEBUG_SGM
32 Nnodes = max(size(mesh.p));
33 Nelements = max(size(mesh.t));
36 % Set list of nodes with Dirichelet BCs
37 Dnodes=Unodesonside(mesh,Dsides);
39 % Set values of Dirichelet BCs
42 % Set list of nodes without Dirichelet BCs
43 Varnodes = setdiff([1:Nnodes],Dnodes);
45 % Build LHS matrix and RHS
46 A = Uscharfettergummel2(mesh,V,u,Vth);
47 if (isempty(DDG_MASS))
48 DDG_MASS=Ucompmass2(mesh,ones(Nnodes,1),ones(Nelements,1));
50 A = A + DDG_MASS.*spdiag(M,0);
53 DDG_RHS=Ucompconst(mesh,ones(Nnodes,1),ones(Nelements,1));
59 %%%%%%%%DEBUG%%%%%%%%%%%
62 %% Apply boundary conditions
65 b = b - A (:,Dnodes) * Bc;