/usr/share/octave/packages/secs2d-0.0.8/ThDDGOX/ThDDGOXthermaliteration.m is in octave-secs2d 0.0.8-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | function [thermdata,nrm] = ThDDGOXthermaliteration(imesh,Dsides,...
Simesh,Sinodes,Sielements,...
SiDsides,thermdata,toll,...
maxit,verbose)
%% [thermdata,innrm] = ThDDGOXthermaliteration(imesh,Dsides,...
%% Simesh,Sinodes,Sielements,...
%% SiDsides,thermdata,toll,...
%% maxit,verbose)
%%%%%%%%%%%%%%%
%% RRE param %%
RREnnit = [10,2];
RRErank = maxit;
RREpattern = URREcyclingpattern(RREnnit,RRErank,maxit);
%%%%%%%%%%%%%%%
%% Set list of nodes with Dirichlet BCs
Dnodes = Unodesonside(imesh,Dsides);
SiDnodes = Unodesonside(Simesh,SiDsides);
Tl = thermdata.Tl;
Tn = thermdata.Tn;
Tp = thermdata.Tp;
tldampcoef = 1;
tndampcoef = 10;
tpdampcoef = 10;
mobn0 = thermdata.mobn0(imesh,Simesh,Sinodes,Sielements,thermdata);
mobp0 = thermdata.mobp0(imesh,Simesh,Sinodes,Sielements,thermdata);
mobn1 = thermdata.mobn1(imesh,Simesh,Sinodes,Sielements,thermdata);
mobp1 = thermdata.mobp1(imesh,Simesh,Sinodes,Sielements,thermdata);
twn0 = thermdata.twn0 (imesh,Simesh,Sinodes,Sielements,thermdata);
twp0 = thermdata.twp0 (imesh,Simesh,Sinodes,Sielements,thermdata);
twn1 = thermdata.twn1 (imesh,Simesh,Sinodes,Sielements,thermdata);
twp1 = thermdata.twp1 (imesh,Simesh,Sinodes,Sielements,thermdata);
[Ex,Ey] = Updegrad(Simesh,-thermdata.V(Sinodes));
E = [Ex;Ey];
[jnx,jny] = Ufvsgcurrent3(Simesh,thermdata.n,...
mobn0,mobn1,Tn,thermdata.V(Sinodes)-Tn);
[jpx,jpy] = Ufvsgcurrent3(Simesh,thermdata.p,...
-mobp0,mobp1,Tp,-thermdata.V(Sinodes)-Tp);
Jn = [jnx;jny];
Jp = [jpx;jpy];
for ith=1:maxit
if (verbose>=1)
fprintf(1,"*** start of inner iteration number: %d\n",ith);
end
if (verbose>=1)
fprintf(1,'\t***updating electron temperature\n');
end
Tn = ThDDGOXupdateelectron_temp(Simesh,SiDnodes,thermdata.Tn,...
thermdata.n,thermdata.p,...
thermdata.Tl,Jn,E,mobn0,...
twn0,twn1,thermdata.tn,thermdata.tp,...
thermdata.ni,thermdata.ni);
##Tn(Tn<thermdata.Tl) = thermdata.Tl(Tn<thermdata.Tl);
dtn = norm(Tn-thermdata.Tn,inf);
if (dtn>0)
tndampfact_n = log(1+tndampcoef*dtn)/(tndampcoef*dtn);
Tn = tndampfact_n * Tn + (1-tndampfact_n) * thermdata.Tn;
end
if (verbose>=1)
fprintf(1,'\t***updating hole temperature\n');
end
Tp = ThDDGOXupdatehole_temp(Simesh,SiDnodes,thermdata.Tp,...
thermdata.n,thermdata.p,...
thermdata.Tl,Jp,E,mobp0,...
twp0,twp1,thermdata.tn,thermdata.tp,...
thermdata.ni,thermdata.ni);
##Tp(Tp<thermdata.Tl) = thermdata.Tl(Tp<thermdata.Tl);
dtp = norm(Tp-thermdata.Tp,inf);
if (dtp>0)
tpdampfact_p = log(1+tpdampcoef*dtp)/(tpdampcoef*dtp);
Tp = tpdampfact_p * Tp + (1-tpdampfact_p) * thermdata.Tp;
end
if (verbose>=1)
fprintf(1,'\t***updating lattice temperature\n');
end
## store result for RRE
if RREpattern(ith)>0
TEMPstore(:,RREpattern(ith)) = [Tn;Tp;Tl];
if RREpattern(ith+1)==0 % Apply RRE extrapolation
if (verbose>=1)
fprintf(1,"\n\t**********\n\tRRE EXTRAPOLATION STEP\n\t**********\n\n");
end
TEMP = Urrextrapolation(TEMPstore);
Tn = TEMP(1:rows(Tn));
Tp = TEMP(rows(Tn)+1:rows(Tn)+rows(Tp));
Tl = TEMP(rows(Tn)+rows(Tp)+1:end);
end
end
Tl = ThDDGOXupdatelattice_temp(Simesh,SiDnodes,thermdata.Tl,...
Tn,Tp,thermdata.n,...
thermdata.p,thermdata.kappa,thermdata.Egap,...
thermdata.tn,thermdata.tp,twn0,...
twp0,twn1,twp1,...
thermdata.ni,thermdata.ni);
##Tl(Tl<thermdata.Tl) = thermdata.Tl(Tl<thermdata.Tl);
dtl = norm(Tl-thermdata.Tl,inf);
if (dtl > 0)
tldampfact = log(1+tldampcoef*dtl)/(tldampcoef*dtl);
Tl = tldampfact * Tl + (1-tldampfact) * thermdata.Tl;
end
if (verbose>=1)
fprintf(1,"\t*** checking for convergence:\n ");
end
nrm(ith) = max([dtl,dtn,dtp]);
if (verbose>=1)
fprintf (1,"\t\t|dTL|= %g\n",dtl);
fprintf (1,"\t\t|dTn|= %g\n",dtn);
fprintf (1,"\t\t|dTp|= %g\n",dtp);
end
thermdata.Tl = Tl;
thermdata.Tn = Tn;
thermdata.Tp = Tp;
if (verbose>1)
subplot(1,3,2);
title("max(|dTl|,|dTn|,|dTn|)")
semilogy(nrm)
pause(.1)
end
if nrm(ith)< toll
if (verbose>=1)
fprintf(1,"\n***\n***\texit from thermal iteration \n");
end
break
end
end
|