Main Page | Directories | File List | File Members

electron_density.h File Reference

Go to the source code of this file.

Functions

void electron_density (void)


Function Documentation

void electron_density void   ) 
 

Definition at line 30 of file electron_density.h.

References EPP, free(), i_dom, Ne, NE, Ng, NOELEC, noeud_geo, printf(), SIO2, and VOLUME.

Referenced by main().

00031 {
00032 // NOELEC[i] is the number of electrons in the i-th element
00033  int i;
00034  int *vertex;
00035  
00036  for(i=0;i<Ng;i++) NE[i]=0.; // just in case...
00037 
00038 // modified cloud-in-cell method for 3D unstructured meshes
00039 
00040 // it is a bit affected by statistical noise, but this is
00041 // definitely normal.
00042  
00043  vertex=malloc((Ng+1)*sizeof(int));
00044  if(vertex==NULL){
00045    printf("electron_density error : not enough memory for vertex array!\n");
00046    exit(0);
00047  }
00048  for(i=0;i<Ng;i++) vertex[i]=0; // just in case...
00049 
00050    for(i=0;i<Ne;i++){
00051     if(i_dom[i]!=SIO2){
00052       NE[noeud_geo[0][i]-1]+=(double)(NOELEC[i])*EPP[i]/VOLUME[i];
00053       NE[noeud_geo[1][i]-1]+=(double)(NOELEC[i])*EPP[i]/VOLUME[i];
00054       NE[noeud_geo[2][i]-1]+=(double)(NOELEC[i])*EPP[i]/VOLUME[i];
00055       NE[noeud_geo[3][i]-1]+=(double)(NOELEC[i])*EPP[i]/VOLUME[i];
00056       vertex[noeud_geo[0][i]-1]++;
00057       vertex[noeud_geo[1][i]-1]++;
00058       vertex[noeud_geo[2][i]-1]++;
00059       vertex[noeud_geo[3][i]-1]++;
00060     }
00061    }
00062  for(i=0;i<Ng;i++) NE[i]/=(double)vertex[i];
00063 
00064  free(vertex);
00065 }


© sourcejam.com 2005-2008