1 function [odata,it,res] = QDDGOXgummelmap (imesh,Dsides,...
2 Simesh,Sinodes,Sielements,SiDsides,Intsides,...
3 idata,toll,maxit,ptoll,pmaxit,stoll,smaxit,verbose,options)
5 % [odata,it,res] = QDDGOXgummelmap (imesh,Dsides,...
6 % Simesh,Sinodes,Sielements,SiDsides,Intsides,...
7 % idata,toll,maxit,ptoll,pmaxit,stoll,smaxit,verbose,options);
11 global DDGOXNLPOISSON_LAP DDGOXNLPOISSON_MASS DDGOXNLPOISSON_RHS DDG_RHS DDG_MASS
17 RREpattern = URREcyclingpattern(RREnnit,RRErank,maxit);
21 RREpattern2 = URREcyclingpattern(RREnnit2,RRErank2,smaxit);
24 Nnodes = max(size(imesh.p));
25 Nelements = max(size(imesh.t));
26 SiNnodes = max(size(Simesh.p));
27 SiNelements = max(size(Simesh.t));
30 tn= idata.tn;tp=idata.tp;
45 for ii = 1:length(Dsides)
46 Dedges=[Dedges,find(imesh.e(5,:)==Dsides(ii))];
49 % Set list of nodes with Dirichelet BCs
50 Dnodes = imesh.e(1:2,Dedges);
51 Dnodes = [Dnodes(1,:) Dnodes(2,:)];
52 Dnodes = unique(Dnodes);
56 for ii = 1:length(Intsides)
57 Intedges=[Intedges,find(Simesh.e(5,:)==Intsides(ii))];
60 % Set list of Interface nodes
61 Intnodes = Simesh.e(1:2,Intedges);
62 Intnodes = [Intnodes(1,:) Intnodes(2,:)];
63 Intnodes = unique(Intnodes);
67 for ii = 1:length(SiDsides)
68 SiDedges=[SiDedges,find(Simesh.e(5,:)==SiDsides(ii))];
71 % Set list of nodes with Dirichelet BCs
72 SiDnodes = Simesh.e(1:2,SiDedges);
73 SiDnodes = [SiDnodes(1,:) SiDnodes(2,:)];
74 SiDnodes = unique(SiDnodes);
80 FDn = zeros(SiNnodes,1);
81 FDp = zeros(SiNnodes,1);
84 G (:,1) = Fn(:,1) - V(Sinodes,1) - FDn + log(n(:,1));
86 Gp (:,1) = Fp(:,1) - V(Sinodes,1) - FDp - log(p(:,1));
96 fprintf(1,'*****************************************************************\n');
97 fprintf(1,'**** start of gummel iteration number: %d\n',i);
98 fprintf(1,'*****************************************************************\n');
108 fprintf(1,'*---------------------------------------------------------------*\n');
109 fprintf(1,'**** start of Poisson-Bohm iteration number: %d (bohmdeltav=%g)\n',j,bohmdeltav);
110 fprintf(1,'*---------------------------------------------------------------*\n');
115 fprintf(1,'solving non linear poisson equation\n\n');
118 [V(:,3),n(:,2),p(:,2)] =...
119 QDDGOXnlpoisson (imesh,Dsides,Sinodes,[SiDnodes,Intnodes] ,Sielements,...
120 V(:,2),n(:,1),p(:,1),Fn(:,1),Fp(:,1),G(:,2)+FDn,Gp(:,2)+FDp,D,...
121 idata.l2,idata.l2ox,ptoll,pmaxit,verbose-1);
123 n([SiDnodes,Intnodes],2) = idata.n([SiDnodes,Intnodes]);
124 p([SiDnodes,Intnodes],2) = idata.p([SiDnodes,Intnodes]);
125 V(Dnodes,3) = idata.V(Dnodes);
128 fprintf(1,'solving non linear Bohm equation for electrons\n\n');
130 n(Intnodes,2) = idata.n(Intnodes);
133 w = QDDGOXcompdens(Simesh,[SiDsides,Intsides],sqrt(n(:,2)),V(Sinodes,3) + FDn,Fn(:,1),idata.dn2,stoll,smaxit,verbose-1);
135 n([SiDnodes,Intnodes],2) = idata.n([SiDnodes,Intnodes]);
136 G(:,3) = Fn(:,1) - V(Sinodes,3) - FDn + log(n(:,2));
138 fprintf(1,'solving non linear Bohm equation for holes\n\n');
141 if (options.holes==1)
143 p(Intnodes,2) = idata.p(Intnodes);
144 wp = QDDGOXcompdens(Simesh,[SiDsides,Intsides],sqrt(p(:,2)),-V(Sinodes,3) - FDp,...
145 -Fp(:,1),idata.dp2,ptoll,pmaxit,verbose-1);
147 p([SiDnodes,Intnodes],2) = idata.p([SiDnodes,Intnodes]);
148 Gp(:,3) = Fp(:,1) - V(Sinodes,3) - FDp - log(p(:,2));
156 fprintf(1,'\n*** APPLYING FD STATISTICS ***\n')
157 n(:,2) = idata.Nc*Ufermidirac(V(Sinodes,3)+G(:,3)-Fn(:,1)-log(idata.Nc),1/2);
158 n(SiDnodes,2) = idata.n(SiDnodes);
159 nMBtmp = exp(V(Sinodes,3)+G(:,3)-Fn(:,1));
160 FDn = log(n(:,2)./ nMBtmp);
161 FDn(SiDnodes) = idata.FDn(SiDnodes);
163 p(:,2) = idata.Nv*Ufermidirac(-V(Sinodes,3)-Gp(:,3)+Fp(:,1)-log(idata.Nv),1/2);
164 p([SiDnodes,Intnodes],2) = idata.p([SiDnodes,Intnodes]);
165 pMBtmp = exp(-V(Sinodes,3)-Gp(:,3)+Fp(:,1));
166 FDp = -log(p(:,2)./ pMBtmp);
167 FDp(SiDnodes) = idata.FDp(SiDnodes);
170 bohmdeltav = norm(G(:,3)-G(:,2),inf) +...
171 norm(Gp(:,3)-Gp(:,2),inf) +...
172 norm(V(:,3)-V(:,2),inf);
175 %%%% store result for RRE
177 Gstore(:,RREpattern2(j)) = G(:,3);
178 if RREpattern2(j+1)==0 % Apply RRE extrapolation
179 G(:,3) = Urrextrapolation(Gstore);
190 if (bohmdeltav<=stoll)
192 fprintf(1,'Exiting poisson-bohm iteration because bohmdeltav=%g\n\n',bohmdeltav);
199 fprintf (1,'\n\nupdating electron qfl\n\n');
202 mob = Ufielddepmob(Simesh,idata.un,Fn(:,1), ...
203 idata.vsatn,idata.mubn);
206 n(:,3) = DDGOXelectron_driftdiffusion(Simesh,SiDsides,n(:,2),p(:,2),...
207 V(Sinodes,3)+G(:,3)+FDn,mob,...
208 tn,tp,idata.n0,idata.p0);
211 Fn(:,2) = V(Sinodes,3) + G(:,3) + FDn - log(n(:,3));
212 Fn(SiDnodes,2) = idata.Fn(SiDnodes);
213 n([SiDnodes,Intnodes],3) = idata.n([SiDnodes,Intnodes]);
215 %%%% store result for RRE
217 Fnstore(:,RREpattern(i)) = Fn(:,2);
218 if RREpattern(i+1)==0 % Apply RRE extrapolation
219 Fn(:,2) = Urrextrapolation(Fnstore);
224 fprintf(1,'updating hole qfl\n\n');
227 mob = Ufielddepmob(Simesh,idata.up,Fp(:,1),idata.vsatp,idata.mubp);
228 p(:,3) =DDGOXhole_driftdiffusion(Simesh,SiDsides,n(:,3),p(:,2),...
229 V(Sinodes,3)+Gp(:,3)+FDp,mob,...
230 tn,tp,idata.n0,idata.p0);
233 if (options.holes==1)
234 Fp(:,2)=V(Sinodes,3) + Gp(:,3) + FDp + log(p(:,3));
235 p([SiDnodes,Intnodes],3) = idata.p([SiDnodes,Intnodes]);
237 Fp(:,2)=Fn(:,2) + 2 * log(idata.ni);
238 p(:,3) = exp(Fp(:,2)-V(Sinodes,3)-FDp);
239 p([SiDnodes],3) = idata.p([SiDnodes]);
241 Fp(SiDnodes,2) = idata.Fp(SiDnodes);
244 fprintf(1,'checking for convergence\n\n');
247 nrfn= norm(Fn(:,2)-Fn(:,1),inf);
248 nrfp= norm (Fp(:,2)-Fp(:,1),inf);
249 nrv = norm (V(:,3)-V(:,1),inf);
250 nrg = norm (G(:,3)-G(:,1),inf);
251 nrgp = norm (Gp(:,3)-Gp(:,1),inf);
252 nrm(i) = max([nrfn;nrfp;nrv;nrg;nrgp]);
260 fprintf (1,' max(|phin_(k+1)-phinn_(k)| , |phip_(k+1)-phip_(k)| , |v_(k+1)-v_(k)| |g_(k+1)-g_(k)|)= %d\n',nrm(i));
281 fprintf(1,'\n\nDD: # of Gummel iterations = %d\n\n',it);
289 odata.Fn = Fn(:,end);
290 odata.Fp = Fp(:,end);
292 odata.Gp = Gp(:,end);