1 function [thermdata,nrm] = ThDDGOXthermaliteration(imesh,Dsides,...
2 Simesh,Sinodes,Sielements,...
3 SiDsides,thermdata,toll,...
7 %% [thermdata,innrm] = ThDDGOXthermaliteration(imesh,Dsides,...
8 %% Simesh,Sinodes,Sielements,...
9 %% SiDsides,thermdata,toll,...
16 RREpattern = URREcyclingpattern(RREnnit,RRErank,maxit);
19 %% Set list of nodes with Dirichlet BCs
20 Dnodes = Unodesonside(imesh,Dsides);
21 SiDnodes = Unodesonside(Simesh,SiDsides);
31 mobn0 = thermdata.mobn0(imesh,Simesh,Sinodes,Sielements,thermdata);
32 mobp0 = thermdata.mobp0(imesh,Simesh,Sinodes,Sielements,thermdata);
33 mobn1 = thermdata.mobn1(imesh,Simesh,Sinodes,Sielements,thermdata);
34 mobp1 = thermdata.mobp1(imesh,Simesh,Sinodes,Sielements,thermdata);
35 twn0 = thermdata.twn0 (imesh,Simesh,Sinodes,Sielements,thermdata);
36 twp0 = thermdata.twp0 (imesh,Simesh,Sinodes,Sielements,thermdata);
37 twn1 = thermdata.twn1 (imesh,Simesh,Sinodes,Sielements,thermdata);
38 twp1 = thermdata.twp1 (imesh,Simesh,Sinodes,Sielements,thermdata);
39 [Ex,Ey] = Updegrad(Simesh,-thermdata.V(Sinodes));
42 [jnx,jny] = Ufvsgcurrent3(Simesh,thermdata.n,...
43 mobn0,mobn1,Tn,thermdata.V(Sinodes)-Tn);
44 [jpx,jpy] = Ufvsgcurrent3(Simesh,thermdata.p,...
45 -mobp0,mobp1,Tp,-thermdata.V(Sinodes)-Tp);
53 fprintf(1,"*** start of inner iteration number: %d\n",ith);
57 fprintf(1,'\t***updating electron temperature\n');
60 Tn = ThDDGOXupdateelectron_temp(Simesh,SiDnodes,thermdata.Tn,...
61 thermdata.n,thermdata.p,...
62 thermdata.Tl,Jn,E,mobn0,...
63 twn0,twn1,thermdata.tn,thermdata.tp,...
64 thermdata.ni,thermdata.ni);
66 ##Tn(Tn<thermdata.Tl) = thermdata.Tl(Tn<thermdata.Tl);
68 dtn = norm(Tn-thermdata.Tn,inf);
70 tndampfact_n = log(1+tndampcoef*dtn)/(tndampcoef*dtn);
71 Tn = tndampfact_n * Tn + (1-tndampfact_n) * thermdata.Tn;
75 fprintf(1,'\t***updating hole temperature\n');
79 Tp = ThDDGOXupdatehole_temp(Simesh,SiDnodes,thermdata.Tp,...
80 thermdata.n,thermdata.p,...
81 thermdata.Tl,Jp,E,mobp0,...
82 twp0,twp1,thermdata.tn,thermdata.tp,...
83 thermdata.ni,thermdata.ni);
85 ##Tp(Tp<thermdata.Tl) = thermdata.Tl(Tp<thermdata.Tl);
87 dtp = norm(Tp-thermdata.Tp,inf);
89 tpdampfact_p = log(1+tpdampcoef*dtp)/(tpdampcoef*dtp);
90 Tp = tpdampfact_p * Tp + (1-tpdampfact_p) * thermdata.Tp;
94 fprintf(1,'\t***updating lattice temperature\n');
97 ## store result for RRE
99 TEMPstore(:,RREpattern(ith)) = [Tn;Tp;Tl];
100 if RREpattern(ith+1)==0 % Apply RRE extrapolation
102 fprintf(1,"\n\t**********\n\tRRE EXTRAPOLATION STEP\n\t**********\n\n");
104 TEMP = Urrextrapolation(TEMPstore);
105 Tn = TEMP(1:rows(Tn));
106 Tp = TEMP(rows(Tn)+1:rows(Tn)+rows(Tp));
107 Tl = TEMP(rows(Tn)+rows(Tp)+1:end);
111 Tl = ThDDGOXupdatelattice_temp(Simesh,SiDnodes,thermdata.Tl,...
112 Tn,Tp,thermdata.n,...
113 thermdata.p,thermdata.kappa,thermdata.Egap,...
114 thermdata.tn,thermdata.tp,twn0,...
116 thermdata.ni,thermdata.ni);
118 ##Tl(Tl<thermdata.Tl) = thermdata.Tl(Tl<thermdata.Tl);
120 dtl = norm(Tl-thermdata.Tl,inf);
122 tldampfact = log(1+tldampcoef*dtl)/(tldampcoef*dtl);
123 Tl = tldampfact * Tl + (1-tldampfact) * thermdata.Tl;
128 fprintf(1,"\t*** checking for convergence:\n ");
131 nrm(ith) = max([dtl,dtn,dtp]);
134 fprintf (1,"\t\t|dTL|= %g\n",dtl);
135 fprintf (1,"\t\t|dTn|= %g\n",dtn);
136 fprintf (1,"\t\t|dTp|= %g\n",dtp);
144 title("max(|dTl|,|dTn|,|dTn|)")
150 fprintf(1,"\n***\n***\texit from thermal iteration \n");