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.
69 lines
1.4 KiB
C
69 lines
1.4 KiB
C
#include <stdio.h>
|
|
#include <stddef.h>
|
|
#include <string.h>
|
|
#include <stdarg.h>
|
|
#include <stdlib.h>
|
|
#include <math.h>
|
|
#include "geostat.h"
|
|
#include "pressure.h"
|
|
|
|
/* Build_pressure */
|
|
/* build pressure in spectral domain */
|
|
|
|
void build_pressure(int n[3],struct grid_mod grid,struct pressure_mod gradient,double *realization,double *ireal,double *pressure,double *ipressure)
|
|
{
|
|
int i,j,k,maille1;
|
|
double ki,kj,kk;
|
|
double coeff,temp,temp2;
|
|
|
|
printf("build pdsdsressure pdslis\n");
|
|
|
|
/* pressure calculation in the spectral domain*/
|
|
for ( k = 1; k <= n[2]; k++) {
|
|
for (j = 1; j <= n[1]; j++) {
|
|
for (i = 1; i <= n[0]; i++) {
|
|
maille1 = i+(j-1+(k-1)*n[1])*n[0];
|
|
if (n[0]==1)
|
|
{
|
|
ki=0.;
|
|
}
|
|
else
|
|
{
|
|
ki =(double)(i-1)/(double)(grid.NX*grid.DX);
|
|
}
|
|
if (n[1]==1)
|
|
{
|
|
kj=0.;
|
|
}
|
|
else
|
|
{
|
|
kj =(double)j/(double)(grid.NY*grid.DY);
|
|
}
|
|
if (n[2]==1)
|
|
{
|
|
kk=0.;
|
|
}
|
|
else
|
|
{
|
|
kk =(double)k/(double)(grid.NZ*grid.DZ);
|
|
}
|
|
|
|
coeff = (gradient.x*ki+gradient.y*kj+gradient.z*kk)/(ki*ki+kj*kj+kk*kk);
|
|
temp = realization[maille1];
|
|
temp2= ireal[maille1];
|
|
if (maille1==1)
|
|
{
|
|
pressure[maille1] =0.;
|
|
ipressure[maille1]=0.;
|
|
}
|
|
else
|
|
{
|
|
pressure[maille1] =-1./(2*3.14)*coeff*temp2;
|
|
ipressure[maille1]= 1./(2*3.14)*coeff*temp;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return;
|
|
}
|