Main Page | Directories | File List | File Members

define_inverse_jacobian.h

Go to the documentation of this file.
00001 /*
00002    This file belongs to Aeneas. Aeneas is a GNU package released under GPL 3 license.
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 : 06 june 2007, Siracusa, Jean Michel Sellier
00025 // Last modified : 02 august 2007, Siracusa, Jean Michel Sellier
00026 
00027 // computes the inverse of Jacobian. see pag.324 of french book.
00028 
00029 void define_inverse_jacobian(void)
00030 {
00031 
00032 // int i,j;
00033  int k1,k2,m;
00034  double a[3][3]; // i=1..dim, j=1..dim
00035  double det;
00036 
00037 // memset(&a,0,sizeof(a));
00038  for(k1=0;k1<dim;k1++)
00039   for(k2=0;k2<dim;k2++) a[k1][k2]=0.0;
00040 
00041   for(m=0;m<Ne;m++){
00042 //printf("%d of %d\n",m,Ne);
00043    for(k1=0;k1<dim;k1++)
00044     for(k2=0;k2<dim;k2++){
00045      int n;
00046      for(n=0;n<ng;n++) a[k1][k2]+=coord[k1][noeud_geo[n][m]-1]*d_base_geo[k2][n];
00047     }
00048    det=a[0][0]*a[1][1]*a[2][2]+a[0][1]*a[1][2]*a[2][0]+a[0][2]*a[1][0]*a[2][1]
00049        -(a[2][0]*a[1][1]*a[0][2]+a[2][1]*a[1][2]*a[0][0]+a[2][2]*a[1][0]*a[0][1]);
00050    if(det==0.0){
00051    printf("m = %d\n",m);
00052    printf("%g %g %g\n",a[0][0],a[0][1],a[0][2]);
00053    printf("%g %g %g\n",a[1][0],a[1][1],a[1][2]);
00054    printf("%g %g %g\n",a[2][0],a[2][1],a[2][2]);
00055    }
00056 //printf("det = %g detJ = %g\n",det,detJ(m,l));
00057 // definition of the inverse jacobian matrix of the m-th trasformation in the l-th element
00058 //printf("qui\n");
00059    inv_jac_K[0][0][m]=(a[1][1]*a[2][2]-a[2][1]*a[1][2])/det;
00060    inv_jac_K[1][0][m]=-(a[1][0]*a[2][2]-a[2][0]*a[1][2])/det;
00061    inv_jac_K[2][0][m]=(a[1][0]*a[2][1]-a[2][0]*a[1][1])/det;
00062    inv_jac_K[0][1][m]=-(a[0][1]*a[2][2]-a[2][1]*a[0][2])/det;
00063    inv_jac_K[1][1][m]=(a[0][0]*a[2][2]-a[2][0]*a[0][2])/det;
00064    inv_jac_K[2][1][m]=-(a[0][0]*a[2][1]-a[2][0]*a[0][1])/det;
00065    inv_jac_K[0][2][m]=(a[0][1]*a[1][2]-a[1][1]*a[0][2])/det;
00066    inv_jac_K[1][2][m]=-(a[0][0]*a[1][2]-a[1][0]*a[0][2])/det;
00067    inv_jac_K[2][2][m]=(a[0][0]*a[1][1]-a[1][0]*a[0][1])/det;
00068 //printf("quo\n");
00069 
00070 /*   printf("m = %d\n",m);
00071    printf("%g %g %g\n",
00072 inv_jac_K[0][0][m]*a[0][0]+inv_jac_K[0][1][m]*a[1][0]+inv_jac_K[0][2][m]*a[2][0],
00073 inv_jac_K[0][0][m]*a[0][1]+inv_jac_K[0][1][m]*a[1][1]+inv_jac_K[0][2][m]*a[2][1],
00074 inv_jac_K[0][0][m]*a[0][2]+inv_jac_K[0][1][m]*a[1][2]+inv_jac_K[0][2][m]*a[2][2]);
00075    printf("%g %g %g\n",
00076 inv_jac_K[1][0][m]*a[0][0]+inv_jac_K[1][1][m]*a[1][0]+inv_jac_K[1][2][m]*a[2][0],
00077 inv_jac_K[1][0][m]*a[0][1]+inv_jac_K[1][1][m]*a[1][1]+inv_jac_K[1][2][m]*a[2][1],
00078 inv_jac_K[1][0][m]*a[0][2]+inv_jac_K[1][1][m]*a[1][2]+inv_jac_K[1][2][m]*a[2][2]);
00079    printf("%g %g %g\n",
00080 inv_jac_K[2][0][m]*a[0][0]+inv_jac_K[2][1][m]*a[1][0]+inv_jac_K[2][2][m]*a[2][0],
00081 inv_jac_K[2][0][m]*a[0][1]+inv_jac_K[2][1][m]*a[1][1]+inv_jac_K[2][2][m]*a[2][1],
00082 inv_jac_K[2][0][m]*a[0][2]+inv_jac_K[2][1][m]*a[1][2]+inv_jac_K[2][2][m]*a[2][2]);
00083 */
00084 
00085 // reset the array a[][]
00086 //   memset(&a,0,sizeof(a));
00087  for(k1=0;k1<dim;k1++)
00088   for(k2=0;k2<dim;k2++) a[k1][k2]=0.0;
00089  }
00090  printf("components of inverse jacobian matrices defined...\n");
00091 }
00092 

© sourcejam.com 2005-2008