]> Creatis software - CreaPhase.git/blob - octave_packages/secs2d-0.0.8/DDGOX/DDGOXddcurrent.m
Add a useful package (from Source forge) for octave
[CreaPhase.git] / octave_packages / secs2d-0.0.8 / DDGOX / DDGOXddcurrent.m
1 function [current,divrg]=DDGOXddcurrent(mesh,Sinodes,data,contacts);
2
3 % [current,divrg]=DDGOXddcurrent(mesh,Sinodes,data,contacts);
4
5
6 % This file is part of 
7 %
8 %            SECS2D - A 2-D Drift--Diffusion Semiconductor Device Simulator
9 %         -------------------------------------------------------------------
10 %            Copyright (C) 2004-2006  Carlo de Falco
11 %
12 %
13 %
14 %  SECS2D is free software; you can redistribute it and/or modify
15 %  it under the terms of the GNU General Public License as published by
16 %  the Free Software Foundation; either version 2 of the License, or
17 %  (at your option) any later version.
18 %
19 %  SECS2D is distributed in the hope that it will be useful,
20 %  but WITHOUT ANY WARRANTY; without even the implied warranty of
21 %  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22 %  GNU General Public License for more details.
23 %
24 %  You should have received a copy of the GNU General Public License
25 %  along with SECS2D; If not, see <http://www.gnu.org/licenses/>.
26
27 load (file_in_path(path,'constants.mat'))
28
29
30 Nelements = size(mesh.t,2);
31 mob = Ufielddepmob(mesh,data.un,data.Fn,data.vsatn,data.mubn);
32 An  = Uscharfettergummel(mesh,data.V(Sinodes),mob);
33 mob = Ufielddepmob(mesh,data.up,data.Fp,data.vsatp,data.mubp);
34 Ap  = Uscharfettergummel(mesh,-data.V(Sinodes),mob);
35 divrg = An * data.n + Ap * data.p;
36
37 for con = 1:length(contacts)
38
39     cedges = [];
40     cedges=[cedges,find(mesh.e(5,:)==contacts(con))];
41     cnodes = mesh.e(1:2,cedges);
42     cnodes = [cnodes(1,:) cnodes(2,:)];
43     cnodes = unique(cnodes);
44     
45     current(con) = sum(divrg(cnodes));
46     
47 end
48
49 Is = q*data.us*data.Vs*data.ns;
50 current = current * Is;
51
52