Main Page | Directories | File List | File Members

device_setup.h

Go to the documentation of this file.
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 : 10 june 2007, Siracusa, Jean Michel Sellier
00025 // Last modified : 16 september 2007, Siracusa, Jean Michel Sellier
00026 
00027 // Initial configuration of the simulated particles and device
00028 
00029 void device_setup(void)
00030 {
00031  long int n=0; 
00032  int i,np,m;
00033  double c1,c2=0.,c3,c4,c5,c6,c7;
00034  
00035 // calculation of the volume of every element
00036  for(i=0;i<Ne;i++){
00037     double xa,ya,za;
00038     double xb,yb,zb;
00039     double xc,yc,zc;
00040     double xd,yd,zd;
00041     double ambx, amby, ambz;
00042     double bmcx, bmcy, bmcz;
00043     double cmdx, cmdy, cmdz;
00044 //    printf("i = %d\n",i);
00045     xa=coord[0][noeud_geo[0][i]-1]; 
00046     ya=coord[1][noeud_geo[0][i]-1]; 
00047     za=coord[2][noeud_geo[0][i]-1];
00048     
00049     xb=coord[0][noeud_geo[1][i]-1]; 
00050     yb=coord[1][noeud_geo[1][i]-1]; 
00051     zb=coord[2][noeud_geo[1][i]-1];
00052     
00053     xc=coord[0][noeud_geo[2][i]-1]; 
00054     yc=coord[1][noeud_geo[2][i]-1]; 
00055     zc=coord[2][noeud_geo[2][i]-1];
00056     
00057     xd=coord[0][noeud_geo[3][i]-1]; 
00058     yd=coord[1][noeud_geo[3][i]-1]; 
00059     zd=coord[2][noeud_geo[3][i]-1];
00060     
00061     ambx=xa-xb; amby=ya-yb; ambz=za-zb;
00062     bmcx=xb-xc; bmcy=yb-yc; bmcz=zb-zc;
00063     cmdx=xc-xd; cmdy=yc-yd; cmdz=zc-zd;
00064 //printf("qui\n");
00065     VOLUME[i]=fabs(ambx*bmcy*cmdz+amby*bmcz*cmdx+ambz*bmcx*cmdy
00066               -cmdx*bmcy*ambz-cmdy*bmcz*ambx-cmdz*bmcx*amby)/6.;    
00067 //if(VOLUME[i]==0.){
00068 //    printf("volume[%d]=%g\n",i,VOLUME[i]);
00069 //    printf("%g %g %g\n",xa,ya,za);
00070 //    printf("%g %g %g\n",xb,yb,zb);
00071 //    printf("%g %g %g\n",xc,yc,zc);
00072 //    printf("%g %g %g\n",xd,yd,zd);
00073 //}
00074  }
00075 
00076 // Number of carriers per particle in every element
00077  for(i=0;i<Ne;i++) EPP[i]=DDMAX*VOLUME[i]/NP1;
00078 
00079  for(i=0;i<Ne;i++){
00080 //     printf("i=%d\n",i);
00081 // np=number of particles in the i-th element
00082      np=(int)(ND[i]*VOLUME[i]/EPP[i]+0.5);
00083      if(ND[i]==0.) np=0;
00084 //if(np<NP1) printf("i = %d    np = %d \n",i,np);
00085      if(vois[0][i]==-1 || vois[1][i]==-1 ||
00086         vois[2][i]==-1 || vois[3][i]==-1) np/=2;
00087      if(np>0){
00088       for(m=1;m<=np;m++){
00089         n++;
00090         if(n>NPMAX){
00091          printf("device setup error : too much particles n = %ld > %d!\n",n,NPMAX);
00092          exit(EXIT_FAILURE);
00093         }
00094 // We assume that the particles are initially at near thermal equilibrium
00095 
00096 // In the case of 2-valleys materials, 80% of the electrons are considered in 
00097 // the first valley in the starting simulation time, while the other 20% are
00098 // in the second valley.
00099       IV=1;
00100       c1=log(rnd());
00101       if(i_dom[i]!=SIO2 && NOVALLEY[i_dom[i]]==1) 
00102        c2=SMH[i_dom[i]][IV]*sqrt(-1.5*BKTQ*c1*(1.-alphaK[i_dom[i]][1]*1.5*BKTQ*c1));
00103       if(i_dom[i]!=SIO2 && NOVALLEY[i_dom[i]]==2){
00104        IV=1;
00105        c2=SMH[i_dom[i]][IV]*sqrt(-1.5*BKTQ*c1*(1.-alphaK[i_dom[i]][1]*1.5*BKTQ*c1));
00106        if(rnd()>0.8){
00107         IV=2;
00108         c2=SMH[i_dom[i]][IV]*sqrt(-1.5*BKTQ*c1*(1.-alphaK[i_dom[i]][2]*1.5*BKTQ*c1));
00109        }
00110       }
00111       c3=1.-2.*rnd();
00112       c4=sqrt(1.-c3*c3);
00113       c5=2.*PI*rnd();
00114       c6=sin(c5);
00115       c7=cos(c5);
00116 // IV-th valley
00117       P[n][0]=IV;
00118 // x-, y- and z-component of pseudo wave vector
00119       P[n][1]=c2*c3*c6;
00120       P[n][2]=c2*c4*c6;
00121       P[n][3]=c2*c7;
00122 // free flight time
00123       P[n][4]=-log(rnd())/GM[i_dom[i]];
00124 // baricentric coordinates of the n-th particle
00125       P[n][5]=rnd();
00126       P[n][6]=rnd();
00127       P[n][7]=rnd();
00128       P[n][8]=4.-(P[n][5]+P[n][6]+P[n][7]);
00129 
00130 // P[n][9]=i means that the n-th particle belongs to the i-th element
00131       P[n][9]=i;
00132       if(i_dom[i]==SIO2) n--;
00133      } // end of m-cycle
00134     } // end of if(np>0)
00135   } // end of i-cycle
00136  INUM = n;
00137  NPMAX0 = INUM;
00138  printf("Initial Number of Electron Super-particles = %d\n", INUM);
00139 }

© sourcejam.com 2005-2008