rm files
parent
e01ef454b0
commit
2593883e22
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,48 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include "genlib.h"
|
||||
#include "simpio.h"
|
||||
#include "geostat.h"
|
||||
#include "pressure.h"
|
||||
#include "toolsIO.h"
|
||||
|
||||
void pgeneration(int n[3],struct grid_mod grid,struct statistic_mod stat,struct vario_mod variogram,string filename[7],struct pressure_mod pression,struct realization_mod *Y,struct realization_mod *P,struct realization_mod *VX,struct realization_mod *VY,struct realization_mod *VZ, int solver)
|
||||
{
|
||||
int i,ntot;
|
||||
struct realization_mod GP;
|
||||
|
||||
//FFTPressure(n,grid,Y,stat,pression,P,VX,VY,VZ,solver);
|
||||
/*save the delta-pressure realization*/
|
||||
writefile(filename[2],P);
|
||||
|
||||
//total_pressure(grid,pression,P);
|
||||
|
||||
total_velocity(grid,stat.mean[0],1,pression,VX);
|
||||
total_velocity(grid,stat.mean[0],2,pression,VY);
|
||||
total_velocity(grid,stat.mean[0],3,pression,VZ);
|
||||
|
||||
/*save the total pressure realization*/
|
||||
writefile(filename[3],P);
|
||||
/*save the x-velocity realization*/
|
||||
writefile(filename[4],VX);
|
||||
/*save the y-velocity realization*/
|
||||
writefile(filename[5],VY);
|
||||
/*save the z-velocity realization*/
|
||||
writefile(filename[6],VZ);
|
||||
|
||||
ntot=grid.NX*grid.NY*grid.NZ;
|
||||
GP.vector = (double *) malloc(ntot * sizeof(double));
|
||||
testmemory(GP.vector);
|
||||
GP.n= ntot-1;
|
||||
for (i = 0; i < ntot-1; i++)
|
||||
{
|
||||
GP.vector[i]=(*P).vector[i]-(*P).vector[i-1];
|
||||
}
|
||||
/*save the pressure gradient realization*/
|
||||
writefile(filename[7],&GP);
|
||||
|
||||
return;
|
||||
}
|
@ -1,99 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include "genlib.h"
|
||||
#include "simpio.h"
|
||||
#include "geostat.h"
|
||||
#include "pressure.h"
|
||||
#include "toolsIO.h"
|
||||
|
||||
void pgeneration2(int n[3],struct grid_mod grid,struct statistic_mod stat,struct vario_mod variogram,string filename[7],struct pressure_mod pression,struct realization_mod *Y,struct realization_mod *P,struct realization_mod *VX,struct realization_mod *VY,struct realization_mod *VZ, int solver, int format_file)
|
||||
{
|
||||
int i,ntot;
|
||||
struct realization_mod GP;
|
||||
|
||||
//FFTPressure(n,grid,Y,stat,pression,P,VX,VY,VZ,solver);
|
||||
|
||||
/*save the delta-pressure realization*/
|
||||
switch (format_file)
|
||||
{
|
||||
case 0:
|
||||
writefile(filename[2],P);
|
||||
break;
|
||||
case 1:
|
||||
writefile_bin(filename[2],P);
|
||||
break;
|
||||
}
|
||||
|
||||
//total_pressure(grid,pression,P);
|
||||
total_velocity(grid,stat.mean[0],1,pression,VX);
|
||||
total_velocity(grid,stat.mean[0],2,pression,VY);
|
||||
total_velocity(grid,stat.mean[0],3,pression,VZ);
|
||||
|
||||
/*save the total pressure realization*/
|
||||
switch (format_file)
|
||||
{
|
||||
case 0:
|
||||
writefile(filename[3],P);
|
||||
break;
|
||||
case 1:
|
||||
writefile_bin(filename[3],P);
|
||||
break;
|
||||
}
|
||||
|
||||
/*save the x-velocity realization*/
|
||||
switch (format_file)
|
||||
{
|
||||
case 0:
|
||||
writefile(filename[4],VX);
|
||||
break;
|
||||
case 1:
|
||||
writefile_bin(filename[4],VX);
|
||||
break;
|
||||
}
|
||||
|
||||
/*save the y-velocity realization*/
|
||||
switch (format_file)
|
||||
{
|
||||
case 0:
|
||||
writefile(filename[5],VY);
|
||||
break;
|
||||
case 1:
|
||||
writefile_bin(filename[5],VY);
|
||||
break;
|
||||
}
|
||||
/*save the z-velocity realization*/
|
||||
switch (format_file)
|
||||
{
|
||||
case 0:
|
||||
writefile(filename[6],VZ);
|
||||
break;
|
||||
case 1:
|
||||
writefile_bin(filename[6],VZ);
|
||||
break;
|
||||
}
|
||||
|
||||
ntot=grid.NX*grid.NY*grid.NZ;
|
||||
GP.vector = (double *) malloc(ntot * sizeof(double));
|
||||
testmemory(GP.vector);
|
||||
GP.n= ntot-1;
|
||||
for (i = 0; i < ntot-1; i++)
|
||||
{
|
||||
GP.vector[i]=(*P).vector[i]-(*P).vector[i-1];
|
||||
}
|
||||
|
||||
/*save the pressure gradient realization*/
|
||||
switch (format_file)
|
||||
{
|
||||
case 0:
|
||||
writefile(filename[7],&GP);
|
||||
break;
|
||||
case 1:
|
||||
writefile_bin(filename[7],&GP);
|
||||
break;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
#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;
|
||||
}
|
@ -1,156 +0,0 @@
|
||||
//#include <fstream.h>
|
||||
//#include <iostream>
|
||||
#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
//using namespace std;
|
||||
|
||||
/*Private functions */
|
||||
void waveVectorCompute1D(int n,double *vec);
|
||||
|
||||
void waveVectorCompute3D(int nX,int nY, int nZ, /*double dX, double dY, double dZ,*/ double nDir[3], double *waveVect) {
|
||||
|
||||
int nTot;
|
||||
double *vecX,*vecY,*vecZ;
|
||||
double *waveVect3DX, *waveVect3DY, *waveVect3DZ;
|
||||
|
||||
int i, j, k, maille;
|
||||
|
||||
nTot = nX*nY*nZ;
|
||||
// printf("nX = %d, nY = %d, nZ = %d, nTot = %d\n",nX,nY,nZ,nTot);
|
||||
// printf("Entering waveVectorCompute3D\n");
|
||||
|
||||
/*Memory allocation */
|
||||
waveVect3DX = (double *)malloc(nTot * sizeof(double));
|
||||
if (waveVect3DX == NULL) {
|
||||
printf("waveVectCompute.cpp : No memory available for waveVect3DX\n");
|
||||
return;
|
||||
}
|
||||
waveVect3DY = (double *)malloc(nTot * sizeof(double));
|
||||
if (waveVect3DY == NULL) {
|
||||
printf("waveVectCompute.cpp : No memory available for waveVect3DY\n");
|
||||
return;
|
||||
}
|
||||
waveVect3DZ = (double *)malloc(nTot * sizeof(double));
|
||||
if (waveVect3DZ == NULL) {
|
||||
printf("waveVectCompute.cpp : No memory available for waveVect3DZ\n");
|
||||
return;
|
||||
}
|
||||
|
||||
vecX = (double *)malloc(nX * sizeof(double));
|
||||
if (vecX == NULL) {
|
||||
printf("waveVectCompute.cpp : No memory available for vecX\n");
|
||||
return;
|
||||
}
|
||||
|
||||
vecY = (double *)malloc(nY * sizeof(double));
|
||||
if (vecY == NULL) {
|
||||
printf("waveVectCompute.cpp : No memory available for vecY\n");
|
||||
return;
|
||||
}
|
||||
|
||||
vecZ = (double *)malloc(nZ * sizeof(double));
|
||||
if (vecZ == NULL) {
|
||||
printf("waveVectCompute.cpp : No memory available for vecZ\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// printf("memory allocation done.\n");
|
||||
|
||||
waveVectorCompute1D(nX,vecX);
|
||||
waveVectorCompute1D(nY,vecY);
|
||||
waveVectorCompute1D(nZ,vecZ);
|
||||
// printf("waveVectorCompute1D: done!\n");
|
||||
|
||||
for(k = 0; k < nZ; k++) {
|
||||
// printf("k=%d\n",k);
|
||||
for(j = 0; j < nY; j++) {
|
||||
// printf("j=%d: ",j);
|
||||
for(i = 0; i < nX; i++) {
|
||||
maille = i + (j + (k)*nY)*nX;
|
||||
// waveVect3DX[maille] = vecX[i]/(nX*dX);
|
||||
// waveVect3DY[maille] = vecY[j]/(nY*dY);
|
||||
// waveVect3DZ[maille] = vecZ[k]/(nZ*dZ);
|
||||
waveVect3DX[maille] = vecX[i];
|
||||
waveVect3DY[maille] = vecY[j];
|
||||
waveVect3DZ[maille] = vecZ[k];
|
||||
// printf("i=%d: %f ",i,vecZ[k]);
|
||||
}
|
||||
// printf("\n");
|
||||
}
|
||||
}
|
||||
// printf("waveVector3DX, Y and Z rearanged\n");
|
||||
free(vecX);
|
||||
free(vecY);
|
||||
free(vecZ);
|
||||
if (waveVect == NULL) {
|
||||
printf("allocate memory for waveVect\n");
|
||||
waveVect = (double *) malloc((nTot+1)*sizeof(double));
|
||||
if (waveVect == NULL) {
|
||||
printf("waveVectCompute.cpp : No memory available for waveVect\n");
|
||||
return;
|
||||
}
|
||||
printf("after allocate memory for waveVect\n");
|
||||
}
|
||||
|
||||
for (i=1;i<=nTot;i++) {
|
||||
waveVect[i] = nDir[0]*waveVect3DX[i-1] + nDir[1]*waveVect3DY[i-1] + nDir[2]*waveVect3DZ[i-1];
|
||||
// printf("waveVect[%d] = %f\n",i,waveVect[i]);
|
||||
}
|
||||
// printf("waveVector rearanged\n");
|
||||
|
||||
free(waveVect3DX);
|
||||
free(waveVect3DY);
|
||||
free(waveVect3DZ);
|
||||
|
||||
}
|
||||
|
||||
void waveVectorCompute1D(int n,double *vec){
|
||||
|
||||
int midPoint,k;
|
||||
|
||||
if(ceil(n/2) - floor(n/2) < 1.) {
|
||||
// printf("coucou\n");
|
||||
/*n is even */
|
||||
midPoint = (int) floor(n/2);
|
||||
vec[midPoint] = (double) midPoint;
|
||||
} else {
|
||||
/*n is odd */
|
||||
midPoint = (int) floor(n/2)-1;
|
||||
vec[midPoint] = (double) midPoint+1;
|
||||
}
|
||||
for (k=1;k<midPoint;k++) {
|
||||
vec[k] = (double) k;
|
||||
vec[n-k] = (double) -(k);
|
||||
}
|
||||
vec[0] = (double) 0;
|
||||
}
|
||||
|
||||
/*int main() {
|
||||
|
||||
double *vecX;
|
||||
int k;
|
||||
|
||||
vecX = (double *)malloc(10 * sizeof(double));
|
||||
if (vecX == NULL) {
|
||||
printf("waveVectCompute.cpp : No memory available for vecX\n");
|
||||
return(0);
|
||||
}
|
||||
printf("avant\n");
|
||||
waveVectorCompute1D(10,vecX);
|
||||
printf("apres\n");
|
||||
|
||||
ofstream vec;
|
||||
vec.open("waveVect1D.pol");
|
||||
for (k=0;k<10;k++)
|
||||
vec << vecX[k] << "\n";
|
||||
vec.close();
|
||||
return(1);
|
||||
}*/
|
||||
|
||||
|
||||
|
@ -1,32 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "genlib.h"
|
||||
#include "geostat.h"
|
||||
|
||||
/*writefile */
|
||||
/* write in the file "filename" the vector values of a */
|
||||
/* realization_mod variable */
|
||||
/* filename: explicit */
|
||||
/* realin: structure defining a realization */
|
||||
|
||||
void writefile(string filename, struct realization_mod *realin)
|
||||
{
|
||||
FILE *fp;
|
||||
int i;
|
||||
/* string filename;*/
|
||||
/*struct realization_mod *realin;*/
|
||||
|
||||
|
||||
/*save the permeability realization*/
|
||||
fp = fopen(filename, "w");
|
||||
/* printf("writefile.c : (*realin).vector[0] %f\n",(*realin).vector[0]); */
|
||||
/* (*realin).vector[0]=1.1; */
|
||||
for (i=0;i<(*realin).n;i++)
|
||||
fprintf(fp,"%15.10f\n",(*realin).vector[i]);
|
||||
fclose(fp);
|
||||
return;
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "genlib.h"
|
||||
#include "geostat.h"
|
||||
|
||||
/*writefile */
|
||||
/* write in the file "filename" the vector values of a */
|
||||
/* realization_mod variable */
|
||||
/* filename: explicit */
|
||||
/* realin: structure defining a realization */
|
||||
|
||||
void writefile_bin(string filename, struct realization_mod *realin)
|
||||
{
|
||||
FILE *fp;
|
||||
int i;
|
||||
double *prout;
|
||||
|
||||
/*save the permeability realization*/
|
||||
fp = fopen(filename, "w");
|
||||
|
||||
for (i=0;i<(*realin).n;i++)
|
||||
{
|
||||
prout=(*realin).vector;
|
||||
fwrite(&prout[i],sizeof(double),1,fp);
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
return;
|
||||
}
|
Loading…
Reference in New Issue