00001 /* 00002 This file belongs to Aeneas. Aeneas is a GNU package released under GPL 3. 00003 This code is a simulator for Submicron 3D Semiconductor Devices. 00004 It implements the Monte Carlo transport in 3D tetrahedra meshes 00005 for the simulation of the semiclassical Boltzmann equation for both electrons. 00006 It also includes all the relevant quantum effects for nanodevices. 00007 00008 Copyright (C) 2007 Jean Michel Sellier <sellier@dmi.unict.it> 00009 00010 This program is free software; you can redistribute it and/or modify 00011 it under the terms of the GNU General Public License as published by 00012 the Free Software Foundation; either version 3, or (at your option) 00013 any later version. 00014 00015 This program is distributed in the hope that it will be useful, 00016 but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 GNU General Public License for more details. 00019 00020 You should have received a copy of the GNU General Public License 00021 along with this program. If not, see <http://www.gnu.org/licenses/>. 00022 */ 00023 00024 // Created on : 07 june 2007, Siracusa, Jean Michel Sellier 00025 // Last modified : 16 september 2007, Siracusa, Jean Michel Sellier 00026 00027 // calculates the electric field components on every node of the mesh 00028 00029 void electric_field(int fl) 00030 { 00031 // if fl == 0 then this is the first time one computes the electric field 00032 // if fl == 1 then this is not the first one computes the electric field 00033 int i; 00034 double dum[3]; 00035 // int *ivertex; 00036 00037 /* ivertex=malloc((Ng+1)*sizeof(int)); 00038 if(ivertex==NULL){ 00039 printf("electric_field : not enough memory for dynamical allocation!\n"); 00040 exit(0); 00041 }*/ 00042 00043 // for(i=0;i<Ng;i++) ivertex[i]=0; 00044 // for(i=0;i<Ng;i++) Ex[i]=Ey[i]=Ez[i]=0.; // just in case... // <--- this is wrong!!! 00045 00046 for(i=0;i<Ne;i++){ 00047 int l; 00048 int n=4; 00049 int indx[5]; 00050 double d; 00051 double a[5][5]; 00052 double b[5]; 00053 double ac[4],bc[4],cc[4]; //,dc[4]; 00054 00055 // definition of the a matrix for the linear system 00056 {int k; 00057 for(k=0;k<4;k++){ 00058 a[k+1][1]=coord[0][noeud_geo[k][i]-1]; 00059 a[k+1][2]=coord[1][noeud_geo[k][i]-1]; 00060 a[k+1][3]=coord[2][noeud_geo[k][i]-1]; 00061 a[k+1][4]=1.; 00062 }} 00063 // LU decomposition of the A matrix 00064 #include "../linear_solver/ludcmp.h" 00065 for(l=0;l<4;l++){ 00066 if(l==0){b[1]=1.;b[2]=0.;b[3]=0.;b[4]=0.;} 00067 if(l==1){b[1]=0.;b[2]=1.;b[3]=0.;b[4]=0.;} 00068 if(l==2){b[1]=0.;b[2]=0.;b[3]=1.;b[4]=0.;} 00069 if(l==3){b[1]=0.;b[2]=0.;b[3]=0.;b[4]=1.;} 00070 #include "../linear_solver/lubksb.h" 00071 ac[l]=b[1]; bc[l]=b[2]; cc[l]=b[3];// dc[l]=b[4]; 00072 //printf("*** %g %g %g %g\n",b[1],b[2],b[3],b[4]); 00073 /*printf("%g\n",b[1]*coord[0][noeud_geo[0][i]-1] 00074 +b[2]*coord[1][noeud_geo[0][i]-1] 00075 +b[3]*coord[2][noeud_geo[0][i]-1] 00076 +b[4]); 00077 printf("%g\n",b[1]*coord[0][noeud_geo[1][i]-1] 00078 +b[2]*coord[1][noeud_geo[1][i]-1] 00079 +b[3]*coord[2][noeud_geo[1][i]-1] 00080 +b[4]); 00081 printf("%g\n",b[1]*coord[0][noeud_geo[2][i]-1] 00082 +b[2]*coord[1][noeud_geo[2][i]-1] 00083 +b[3]*coord[2][noeud_geo[2][i]-1] 00084 +b[4]); 00085 printf("%g\n\n",b[1]*coord[0][noeud_geo[3][i]-1] 00086 +b[2]*coord[1][noeud_geo[3][i]-1] 00087 +b[3]*coord[2][noeud_geo[3][i]-1] 00088 +b[4]);*/ 00089 } 00090 // calculation of the electric field around the barycenter 00091 // by means of a second order finite difference formula 00092 00093 // double xm=0.,ym=0.,zm=0.; 00094 // int k; 00095 00096 // calculation of the center of mass for a homogeneous tetrahedra 00097 /* for(k=0;k<4;k++){ 00098 xm+=coord[0][noeud_geo[k][i]-1]; 00099 ym+=coord[1][noeud_geo[k][i]-1]; 00100 zm+=coord[2][noeud_geo[k][i]-1]; 00101 } 00102 xm*=0.25; ym*=0.25; zm*=0.25;*/ 00103 // printf("xm = %g ym = %g zm = %g\n",xm,ym,zm); 00104 00105 // ALL THE COMPONENTS ARE COMPUTED ANALITYCALLY 00106 // ============================================ 00107 00108 // x-component of the electric field 00109 dum[0]=V[noeud_geo[0][i]-1]*ac[0]+ 00110 V[noeud_geo[1][i]-1]*ac[1]+ 00111 V[noeud_geo[2][i]-1]*ac[2]+ 00112 V[noeud_geo[3][i]-1]*ac[3];// dum*=-1.e-8; 00113 00114 // x-component of the electric field 00115 dum[1]=V[noeud_geo[0][i]-1]*bc[0]+ 00116 V[noeud_geo[1][i]-1]*bc[1]+ 00117 V[noeud_geo[2][i]-1]*bc[2]+ 00118 V[noeud_geo[3][i]-1]*bc[3];// dum*=-1.e-8; 00119 00120 // z-component of the electric field 00121 dum[2]=V[noeud_geo[0][i]-1]*cc[0]+ 00122 V[noeud_geo[1][i]-1]*cc[1]+ 00123 V[noeud_geo[2][i]-1]*cc[2]+ 00124 V[noeud_geo[3][i]-1]*cc[3];// dum*=-1.e-8; 00125 {int h,w; 00126 for(h=0;h<4;h++){ 00127 w=noeud_geo[h][i]-1; 00128 Ex[w]=-dum[0]; 00129 Ey[w]=-dum[1]; 00130 Ez[w]=-dum[2]; 00131 }} 00132 00133 // first time one computes the electric field 00134 /* {int h,w; 00135 if(fl==0) for(h=0;h<4;h++){ 00136 w=noeud_geo[h][i]-1; 00137 Ex[w]=-dum[0]; 00138 Ey[w]=-dum[1]; 00139 Ez[w]=-dum[2]; 00140 } 00141 } 00142 // this is not the first time one computes the electric field 00143 if(fl==1) 00144 {int h,w; 00145 int flag; 00146 flag=0; 00147 for(h=0;h<4;h++) if(i_front[noeud_geo[h][i]-1]==OHMIC || 00148 i_front[noeud_geo[h][i]-1]==SCHOTTKY || 00149 i_front[noeud_geo[h][i]-1]==INSULATOR) flag=1; 00150 if(flag==0) for(h=0;h<4;h++){ 00151 w=noeud_geo[h][i]-1; 00152 Ex[w]=-dum[0]; 00153 Ey[w]=-dum[1]; 00154 Ez[w]=-dum[2]; 00155 // ivertex[w]++; 00156 } 00157 } 00158 */ 00159 // printf("Ex = %g\n",Ex[noeud_geo[0][i]-1]); 00160 // printf("Ey = %g\n",Ey[noeud_geo[0][i]-1]); 00161 // printf("Ez = %g\n\n",i,Ez[noeud_geo[0][i]-1]); 00162 } // end of the i-cycle 00163 00164 // we compute the mean average of electric field components on all vertices 00165 // charge neutrality is now maintained! 00166 00167 /* for(i=0;i<Ne;i++){ 00168 {int h,w; 00169 int flag; 00170 flag=0; 00171 for(h=0;h<4;h++) if(i_front[noeud_geo[h][i]-1]==OHMIC || 00172 i_front[noeud_geo[h][i]-1]==SCHOTTKY || 00173 i_front[noeud_geo[h][i]-1]==INSULATOR) flag=1; 00174 if(flag==0) for(h=0;h<4;h++){ 00175 w=noeud_geo[h][i]-1; 00176 if(ivertex[w]!=0){ 00177 Ex[w]/=(double)ivertex[w]; 00178 Ey[w]/=(double)ivertex[w]; 00179 Ez[w]/=(double)ivertex[w]; 00180 } 00181 } 00182 } 00183 }*/ 00184 // free(ivertex); 00185 }