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.
simulacion-permeabilidad/fftma_module/gen/sources/inputdata.c

123 lines
4.2 KiB
C

#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 seed (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;
}