milestone_5_without_improvements
Oli 4 years ago
parent 2593883e22
commit 6ac4de81a9

@ -12,53 +12,13 @@
/* List of functions: */ /* List of functions: */
/* ------------------ */ /* ------------------ */
/* readfile_bin,inputdata,inputfiledata,debuginput */ /* testmemory */
/* testmemory, testopenfile */
/*FUNCTIONS*/ /*FUNCTIONS*/
/*----------*/ /*----------*/
/* Lecture dans un fichier */
/* Inputdata */
/* */
/* input data needed for realizations*/
/* seed: seed */
/* grid: structure defining the actual grid */
/* filename: name of files */
/* variogram: struture defining the variogram model */
/* stat: struture defining the mean and the variance of permeability realization */
/* pression: structure defining the gradient pressure */
void inputdata(long *seed,struct grid_mod *grid,string filename[7],struct vario_mod *variogram,struct statistic_mod *stat,struct pressure_mod *pression);
void inputfiledata(string inputfile,long *seed,struct grid_mod *grid,string filename[7],struct vario_mod *variogram,struct statistic_mod *stat,struct pressure_mod *pression);
/* readfile_bin */
/* */
/* read in the file "filename" the vector values of a */
/* realization_mod variable */
/* filename: explicit */
/* realin: structure defining a realization */
void readfile_bin(string filename, struct realization_mod *realin);
/* DebugInput */
/* */
/* Display the input data */
/* seed: seed */
/* grid: structure defining the actual grid */
/* filename: name of files */
/* variogram: struture defining the variogram model */
/* stat: struture defining the mean and the variance of permeability realization */
/* pression: structure defining the gradient pressure */
void debuginput(long *seed,struct grid_mod *grid,string filename[7],struct vario_mod *variogram,struct statistic_mod *stat,struct pressure_mod *pression,int *Ksolver,int *genere, int *gwnwrite);
/* Allocation test */ /* Allocation test */
void testmemory(double *realint); void testmemory(double *realint);
/* Test open file */
void testopenfile(FILE *fp);
#endif // define _TOOLSIO_H #endif // define _TOOLSIO_H

@ -1,73 +0,0 @@
#include <stdio.h>
#include <stddef.h>
#include <string.h>
#include <stdarg.h>
#include <stdlib.h>
#include "genlib.h"
#include "geostat.h"
#include "toolsIO.h"
/* DebugInput */
/* */
/* Display the input data */
/* seed: seed */
/* grid: structure defining the actual grid */
/* filename: name of files */
/* variogram: struture defining the variogram model */
/* stat: struture defining the mean and the variance of permeability realization */
/* pression: structure defining the gradient pressure */
void debuginput(long *seed,struct grid_mod *grid,string filename[8],struct vario_mod *variogram,struct statistic_mod *stat,struct pressure_mod *pression,int *Ksolver,int *genere, int *gwnwrite)
{
int i;
/* debug du 8/7/2002 */
printf("\n\n");
printf("Starting seed (integer): %d\n",(*seed));
printf("Number of cells along the X axis: %d\n",(*grid).NX);
printf("Number of cells along the Y axis: %d\n",(*grid).NY);
printf("Number of cells along the Z axis: %d\n",(*grid).NZ);
printf("cell length along the X axis: %6.4f\n",(*grid).DX);
printf("cell length along the Y axis: %6.4f\n",(*grid).DY);
printf("cell length along the Z axis: %6.4f\n",(*grid).DZ);
printf("Number of structures for the variogram: %d\n",(*variogram).Nvario);
i=0;
printf("Weight: %6.4f\n",(*variogram).var[i]);
printf("Type of variogram: %d\n",(*variogram).vario[i]);
printf("Exponent: %6.4f\n",(*variogram).alpha[i]);
printf("Mean of the output realization: %15.8f\n",(*stat).mean[0]);
printf("Variance of the output realization: %6.4f\n",(*stat).variance[0]);
printf("Structure of the field (0-normal case 1-lognormal case 2-log10 case) : %d\n",(*stat).type);
/*output files*/
printf("output filename for permeability realization: %s\n", filename[1]);
printf("\n\n");
if (*gwnwrite == 0)
{
printf("K field generation with Gaussian white noise!\n");
printf("output filename for Gaussian white noise: %s\n",filename[0]);
}
printf("\n\n");
if ((*Ksolver == 1) | (*Ksolver == 2))
{
printf("P field generation: %d/n",*Ksolver);
printf("output filename for pressure realization: %s\n", filename[2]);
printf("output filename for pressure total realization: %s\n", filename[3]);
printf("output filename for x-velocity realization: %s\n", filename[4]);
printf("output filename for y-velocity realization: %s\n", filename[5]);
printf("output filename for z-velocity realization: %s\n", filename[6]);
printf("output filename for pressure gradient realization: %s\n", filename[7]);
/*Pressure data*/
printf("Pressure gradient in x direction: %6.4f\n",(*pression).x);
printf("Pressure gradient in y direction: %6.4f\n",(*pression).y);
printf("Pressure gradient in z direction: %6.4f\n",(*pression).z);
}
printf("\n\n");
return;
}

@ -1,122 +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 "toolsIO.h"
/* Inputdata */
/* */
/* input data needed for realizations*/
/* seed: seed */
/* grid: structure defining the actual grid */
/* filename: name of files */
/* variogram: struture defining the variogram model */
/* stat: struture defining the mean and the variance of permeability realization */
/* pression: structure defining the gradient pressure */
void inputdata(long *seed,struct grid_mod *grid,string filename[7],struct vario_mod *variogram,struct statistic_mod *stat,struct pressure_mod *pression)
{
int i,j;
/*seed*/
printf("Starting sedsdsed (integer): \n");
*seed = GetInteger();
/*Grid description*/
printf("Number of cells along the X axis: \n");
(*grid).NX = GetInteger();
printf("Number of cells along the Y axis: \n");
(*grid).NY = GetInteger();
printf("Number of cells along the Z axis: \n");
(*grid).NZ = GetInteger();
printf("cell length along the X axis: \n");
(*grid).DX = GetReal();
printf("cell length along the Y axis: \n");
(*grid).DY = GetReal();
printf("cell length along the Z axis: \n");
(*grid).DZ = GetReal();
/*output file*/
printf("output filename for Gaussian white noise: \n");
filename[0] = GetLine();
/*variogram description*/
printf("Number of structures for the variogram: \n");
(*variogram).Nvario = GetInteger();
(*variogram).vario = (int *) malloc((*variogram).Nvario * sizeof(int));
(*variogram).alpha = (double *) malloc((*variogram).Nvario * sizeof(double));
(*variogram).ap = (double *) malloc(9*(*variogram).Nvario * sizeof(double));
(*variogram).scf = (double *) malloc(3*(*variogram).Nvario * sizeof(double));
(*variogram).var = (double *) malloc((*variogram).Nvario * sizeof(double));
for (i= 0; i < (*variogram).Nvario; i++) {
printf("i %d\n",i);
printf("Weight: \n");
(*variogram).var[i] = GetReal();
printf("Type of variogram: \n");
(*variogram).vario[i] = GetInteger();
printf("Exponent: \n");
(*variogram).alpha[i] = GetReal();
printf("Correlation lengths (3): \n");
for (j = 0; j < 3; j++)
(*variogram).scf[i*3+j]=GetReal();
printf("Coordinates of the first two main axes (first axis first, then second): \n");
for (j = 0; j < 6; j++)
(*variogram).ap[i*9+j] = GetReal();
}
/*statistical data*/
(*stat).nblock_mean = 1;
(*stat).nblock_var = 1;
(*stat).mean = (double *)malloc((*stat).nblock_mean * sizeof(double));
if ((*stat).mean == NULL)
Error("No memory available");
(*stat).variance = (double *)malloc((*stat).nblock_var * sizeof(double));
if ((*stat).variance == NULL)
Error("No memory available");
printf("Mean of the output realization: \n");
(*stat).mean[0] = GetReal();
printf("Variance of the output realization: \n");
(*stat).variance[0] = GetReal();
printf("Structure of the field (0-normal case 1-lognormal case 2-log10 case) : \n");
(*stat).type = GetInteger();
/*output file*/
printf("output filename for permeability realization: \n");
filename[1] = GetLine();
/*Pressure data*/
printf("Macroscopic pressure gradient in x direction: \n");
(*pression).x = GetReal();
printf("Macroscopic pressure gradient in y direction: \n");
(*pression).y = GetReal();
printf("Macroscopic pressure gradient in z direction: \n");
(*pression).z = GetReal();
/*output pressure file*/
printf("output filename for pressure realization: \n");
filename[2] = GetLine();
/*output pressure totale file*/
printf("output filename for total pressure realization: \n");
filename[3] = GetLine();
/*output x-velocity file*/
printf("output filename for x-velocity realization: \n");
filename[4] = GetLine();
/*output y-velocity file*/
printf("output filename for y-velocity realization: \n");
filename[5] = GetLine();
/*output z-velocity file*/
printf("output filename for z-velocity realization: \n");
filename[6] = GetLine();
return;
}

@ -1,71 +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 "toolsIO.h"
void inputfiledata(string inputfile,long *seed,struct grid_mod *grid,string filename[7],struct vario_mod *variogram,struct statistic_mod *stat,struct pressure_mod *pression)
{
FILE *fp;
int i,j;
fp=fopen(inputfile,"r");
if(fp== NULL)
{
printf("Erreur d'ouverture du fichier\n");
exit(0);
}
*seed=atoi(ReadLine(fp));
(*grid).NX = atoi(ReadLine(fp));
(*grid).NY = atoi(ReadLine(fp));
(*grid).NZ = atoi(ReadLine(fp));
(*grid).DX = atof(ReadLine(fp));
(*grid).DY = atof(ReadLine(fp));
(*grid).DZ = atof(ReadLine(fp));
filename[0] = ReadLine(fp);
(*variogram).Nvario = atoi(ReadLine(fp));
(*variogram).vario = (int *) malloc((*variogram).Nvario * sizeof(int));
(*variogram).alpha = (double *) malloc((*variogram).Nvario * sizeof(double));
(*variogram).ap = (double *) malloc(9*(*variogram).Nvario * sizeof(double));
(*variogram).scf = (double *) malloc(3*(*variogram).Nvario * sizeof(double));
(*variogram).var = (double *) malloc((*variogram).Nvario * sizeof(double));
for (i= 0; i < (*variogram).Nvario; i++) {
(*variogram).var[i] = atof(ReadLine(fp));
(*variogram).vario[i] = atoi(ReadLine(fp));
(*variogram).alpha[i] = atof(ReadLine(fp));
for (j = 0; j < 3; j++)
(*variogram).scf[i*3+j]= atof(ReadLine(fp));
for (j = 0; j < 6; j++)
(*variogram).ap[i*9+j] = atof(ReadLine(fp));
}
/*statistical data*/
(*stat).nblock_mean = 1;
(*stat).nblock_var = 1;
(*stat).mean = (double *)malloc((*stat).nblock_mean * sizeof(double));
if ((*stat).mean == NULL)
Error("No memory available");
(*stat).variance = (double *)malloc((*stat).nblock_var * sizeof(double));
if ((*stat).variance == NULL)
Error("No memory available");
(*stat).mean[0] = atof(ReadLine(fp));
(*stat).variance[0] = atof(ReadLine(fp));
(*stat).type = atoi(ReadLine(fp));
filename[1] = ReadLine(fp);
(*pression).x = atof(ReadLine(fp));
(*pression).y = atof(ReadLine(fp));
(*pression).z = atof(ReadLine(fp));
filename[2] = ReadLine(fp);
filename[3] = ReadLine(fp);
filename[4] = ReadLine(fp);
filename[5] = ReadLine(fp);
filename[6] = ReadLine(fp);
fclose(fp);
return;
}

@ -1,37 +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"
/*readfile */
/* read in the file "filename" the vector values of a */
/* realization_mod variable */
/* filename: explicit */
/* realin: structure defining a realization */
void readfile_bin(string filename, struct realization_mod *realin)
{
FILE *fp;
int i;
double prout;
printf("readfile_bin\n");
/*read the permeability realization*/
fp = fopen(filename, "r");
for (i=0;i<(*realin).n;i++)
{
fread(&prout,sizeof(double),1,fp);
printf("Prout: %15.10f\n",prout);
}
fclose(fp);
return;
}

@ -3,6 +3,7 @@
/*tries factor*/ /*tries factor*/
int test_fact(int *pnum, int fact, int *pmaxfac) int test_fact(int *pnum, int fact, int *pmaxfac)
{ {
printf("test_fact\n");
int power, t; int power, t;
power = 0; power = 0;

@ -7,6 +7,7 @@
void testmemory(double *realint) void testmemory(double *realint)
{ {
printf("testmemory\n");
if (realint == NULL) { if (realint == NULL) {
printf("Testmemory.c: No memory available \n"); printf("Testmemory.c: No memory available \n");
exit; exit;

@ -1,16 +0,0 @@
#include <stdio.h>
#include <stddef.h>
#include <string.h>
#include <stdarg.h>
#include <stdlib.h>
#include <math.h>
void testopenfile(FILE *fp)
{
if (fp == NULL)
{
printf("Erreur d'ouverture de fichier\n");
exit(0);
}
return;
}

@ -12,61 +12,13 @@
/* List of functions: */ /* List of functions: */
/* ------------------ */ /* ------------------ */
/* readfile_bin,inputdata,inputfiledata,readdata,debuginput */ /* testmemory */
/* testmemory, testopenfile */
/*FUNCTIONS*/ /*FUNCTIONS*/
/*----------*/ /*----------*/
/* Lecture dans un fichier */
/* Inputdata */
/* */
/* input data needed for realizations*/
/* seed: seed */
/* grid: structure defining the actual grid */
/* filename: name of files */
/* variogram: struture defining the variogram model */
/* stat: struture defining the mean and the variance of permeability realization */
/* pression: structure defining the gradient pressure */
void inputdata(long *seed,struct grid_mod *grid,string filename[7],struct vario_mod *variogram,struct statistic_mod *stat,struct pressure_mod *pression);
void inputfiledata(string inputfile,long *seed,struct grid_mod *grid,string filename[7],struct vario_mod *variogram,struct statistic_mod *stat,struct pressure_mod *pression);
/* void readdata(long *seed,struct grid_mod *grid,string filename[8],struct vario_mod *variogram,struct statistic_mod *stat,struct pressure_mod *pression,int *Ksolver,struct realization_mod *Kfield, char *argv[]); */
void readdata(long *seed,struct grid_mod *grid,string filename[8],struct vario_mod *variogram,struct statistic_mod *stat,struct pressure_mod *pression,int *Ksolver,int *genere, int *gwnwrite, struct realization_mod *Kfield,struct realization_mod *gwnoise, char *argv[]);
void readdata2(long *seed,struct grid_mod *grid,string filename[8],struct vario_mod *variogram,struct statistic_mod *stat,struct pressure_mod *pression,int *Ksolver,int *genere, int *gwnwrite, int *format_file, struct realization_mod *Kfield,struct realization_mod *gwnoise, char *argv[]);
void readdata3(long *seed,struct grid_mod *grid,string filename[8],struct vario_mod *variogram,struct statistic_mod *stat,struct pressure_mod *pression,int *Ksolver,int *genere, int *gwnwrite, int *format_file,int *Psolver, struct realization_mod *Kfield,struct realization_mod *gwnoise, char *argv[]);
/* readfile_bin */
/* */
/* read in the file "filename" the vector values of a */
/* realization_mod variable */
/* filename: explicit */
/* realin: structure defining a realization */
void readfile_bin(string filename, struct realization_mod *realin);
/* DebugInput */
/* */
/* Display the input data */
/* seed: seed */
/* grid: structure defining the actual grid */
/* filename: name of files */
/* variogram: struture defining the variogram model */
/* stat: struture defining the mean and the variance of permeability realization */
/* pression: structure defining the gradient pressure */
void debuginput(long *seed,struct grid_mod *grid,string filename[7],struct vario_mod *variogram,struct statistic_mod *stat,struct pressure_mod *pression,int *Ksolver,int *genere, int *gwnwrite);
/* Allocation test */ /* Allocation test */
void testmemory(double *realint); void testmemory(double *realint);
/* Test open file */
void testopenfile(FILE *fp);
#endif // define _TOOLSIO_H #endif // define _TOOLSIO_H

@ -42,12 +42,7 @@ module_FFTMA = Extension(
"./lib_src/build_pressure.c", "./lib_src/build_pressure.c",
"./lib_src/build_velocity.c", "./lib_src/build_velocity.c",
"./lib_src/mat_vec.c", "./lib_src/mat_vec.c",
"./lib_src/inputdata.c",
"./lib_src/inputfiledata.c",
"./lib_src/debuginput.c",
"./lib_src/readfile_bin.c",
"./lib_src/testmemory.c", "./lib_src/testmemory.c",
"./lib_src/testopenfile.c",
"./lib_src/genlib.c", "./lib_src/genlib.c",
], ],
) )

Loading…
Cancel
Save