#include #include #include #include #include "geostat.h" #include "pressure.h" /* total_velocity */ /* Build total velocity */ /* grid: structure defining the grid */ /* mean: permeability mean */ /* dgradient: macroscopic pressure gradient in wanted direction */ /* realout: structure defining a X velocity realization */ void total_velocity(struct grid_mod grid,double mean,int direction,struct pressure_mod gradient,struct realization_mod *realout) { int i,j,k,maille0,maille1; double temp,grad; switch(direction) { case 1: grad = gradient.x/(grid.NX*grid.DX); break; case 2: grad = gradient.y/(grid.NY*grid.DY);/* *grid.NY*grid.DY; */ break; case 3: grad = gradient.z/(grid.NZ*grid.DZ); /* *grid.NZ*grid.DZ; */ break; default : printf("build_velocity.c: wrong velocity direction!!! direction: %d\n",direction); break; } /* x velocity reconstruction */ for ( k = 0; k < grid.NZ; k++) { for (j = 0; j < grid.NY; j++) { for (i = 0; i < grid.NX; i++) { maille1 = i+(j+k*grid.NY)*grid.NX; temp=mean*grad+(*realout).vector[maille1]; /* temp=mean*grad; */ (*realout).vector[maille1]=temp; } } } return; }