You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.3 KiB
C
51 lines
1.3 KiB
C
#include <stdio.h>
|
|
#include <stddef.h>
|
|
#include <stdarg.h>
|
|
#include <stdlib.h>
|
|
#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;
|
|
}
|