Main Page | Directories | File List | File Members

update_potential.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 : 13 june 2007, Siracusa, Jean Michel Sellier
00025 // Last modified : 16 september 2007, Siracusa, Jean Michel Sellier
00026 
00027 // updates the electrostatic potential according to the new
00028 // charge distribution.
00029 
00030 // At this first development stage, we only take into account electrons
00031 // We use the principle of superposition of electrostatic fields
00032 
00033 void update_potential(void) //(double x[],int itol,double tol,int itmax)
00034 {
00035 // remember the Coulomb law :
00036 // V(r) = 1/(epsr*epsilon0) * q/r
00037  register int i,j;
00038 // double *vertex;
00039 // double *de; 
00040  double *tc; // total charge per every vertex
00041  
00042 /*
00043  for(i=0;i<Ne;i++){
00044   int k;
00045   for(j=0;j<4;j++)
00046    for(k=0;k<1000;k++)
00047     V[noeud_geo[j][i]-1]+=0.0015e-12*(-Q*(NE[noeud_geo[j][i]-1]-ND[i]));
00048  }
00049  return;*/
00050  
00051 // vertex=malloc((Ng+1)*sizeof(double));
00052 // de=malloc((Ng+1)*sizeof(double));
00053  tc=malloc((Ng+1)*sizeof(double)); 
00054  if(/*vertex==NULL || de==NULL ||*/ tc==NULL){
00055   printf("update_potential : not enough memory for dynamical allocation!\n");
00056   exit(0);
00057  }
00058 
00059 // for(i=0;i<Ng;i++) de[i]=vertex[i]=0;
00060 /* 
00061  for(i=0;i<Ne;i++){
00062 //printf("%g %g\n",NE[noeud_geo[0][i]-1],VOLUME[i]);
00063       de[noeud_geo[0][i]-1]+=NE[noeud_geo[0][i]-1]*VOLUME[i];
00064       de[noeud_geo[1][i]-1]+=NE[noeud_geo[1][i]-1]*VOLUME[i];
00065       de[noeud_geo[2][i]-1]+=NE[noeud_geo[2][i]-1]*VOLUME[i];
00066       de[noeud_geo[3][i]-1]+=NE[noeud_geo[3][i]-1]*VOLUME[i];
00067 
00068       vertex[noeud_geo[0][i]-1]++;
00069       vertex[noeud_geo[1][i]-1]++;
00070       vertex[noeud_geo[2][i]-1]++;
00071       vertex[noeud_geo[3][i]-1]++;
00072  }
00073  for(i=0;i<Ng;i++){
00074 //   printf("de = %g vertex = %d\n",de[i],vertex[i]);
00075    de[i]/=vertex[i]; // de[i] = number of electrons in the i-th vertex
00076 //   printf("de = %g\n",de[i]);
00077  }*/
00078 
00079  
00080 // total charge in the i-th element
00081  for(i=0;i<Ne;i++){
00082    double de;
00083    de=0.25*(NE[noeud_geo[0][i]-1]+NE[noeud_geo[1][i]-1]+
00084             NE[noeud_geo[2][i]-1]+NE[noeud_geo[3][i]-1]);
00085    tc[noeud_geo[0][i]-1]=-Q*(de-ND[i])*VOLUME[i];
00086    tc[noeud_geo[1][i]-1]=-Q*(de-ND[i])*VOLUME[i];
00087    tc[noeud_geo[2][i]-1]=-Q*(de-ND[i])*VOLUME[i];
00088    tc[noeud_geo[3][i]-1]=-Q*(de-ND[i])*VOLUME[i];
00089 //   printf("de = %g da = %g tc=%g\n",de,ND[i],tc[i]);
00090  }
00091 //exit(0); 
00092 
00093 // update the potential according to the Coulomb force
00094 //printf("here...\n");
00095  for(i=0;i<Ng;i++) V[i]=0.; // just in case
00096  for(i=0;i<Ng;i++){
00097    for(j=0;j<Ng;j++){
00098 //     printf("V = %g %g\n",Vi[j],tc[i]*k[i]/resr[i][j]);
00099 // maintain the charge neutrality and avoid NaN
00100      if(j!=i && i_front[j]!=OHMIC && i_front[j]!=SCHOTTKY
00101              && i_front[i]!=OHMIC && i_front[i]!=SCHOTTKY) V[j]+=tc[i]*k[i]/resr[i][j];
00102 
00103 //     printf("V = %g\n",V[j]);
00104    }
00105  }
00106 // for(i=0;i<Ng;i++) printf("%g\n",V[i]);
00107  for(i=0;i<Ng;i++) V[i]+=Vi[i];
00108 
00109 //   V[i]=Vi[i];
00110 //printf("that's it!\n");
00111  
00112 /*
00113  printf("\nSolving the 3D Poisson equation...\n");
00114   linbcg(Ng,b,x,itol,tol,itmax);
00115  printf("Poisson equation solved...\n\n");*/
00116 // free(vertex);
00117 // free(de);
00118  free(tc);
00119 }

© sourcejam.com 2005-2008