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.
443 lines
23 KiB
C
443 lines
23 KiB
C
#include "geostat.h"
|
|
|
|
#ifndef _CONDOR_H_
|
|
#define _CONDOR_H_
|
|
|
|
|
|
|
|
/*=======================================================*/
|
|
/*FUNCTIONS*/
|
|
/*---------*/
|
|
|
|
|
|
/*addstat */
|
|
/*adds mean and variance effects to the N(0,1) realization*/
|
|
/*input: */
|
|
/*realin: structure defining a realization - */
|
|
/* must have zero mean and unit variance */
|
|
/*stat: structure defining the mean and variance */
|
|
/*output: */
|
|
/*realout: structure defining a realization - */
|
|
void addstat(struct realization_mod *realin,struct statistic_mod stat ,struct realization_mod *realout);
|
|
|
|
|
|
/*condit */
|
|
/*conditioning of a Gaussian realization using */
|
|
/*the primal kriging approach */
|
|
/*inversion method = CONJUGATE GRADIENTS */
|
|
/*NB: The realization and the well data are */
|
|
/*reduced to the standard Gaussian N(0,1) */
|
|
/*INPUT */
|
|
/*k: measurement type */
|
|
/*well: structure with the well data */
|
|
/*variogram: structure describing the variogram model*/
|
|
/*realin: structure defining the input realization */
|
|
/*grid: structure defining the grid */
|
|
/*OUTPUT */
|
|
/*realout: structure defining the output realization */
|
|
void condit(int k,struct welldata_mod well,struct vario_mod variogram,struct grid_mod grid,struct realization_mod *realin,struct realization_mod *realout);
|
|
|
|
|
|
/*d_kriging */
|
|
/*interpolation from ponctual data with simple dual */
|
|
/*kriging. d_kriging is used to interpolate standard */
|
|
/*Gaussian data only */
|
|
/*inversion method = CONJUGATE GRADIENTS */
|
|
/*INPUT */
|
|
/*k: measurement type */
|
|
/*well: structure with the well data */
|
|
/*variogram: structure describing the variogram model*/
|
|
/*grid: structure defining the grid */
|
|
/*OUTPUT */
|
|
/*realout: structure defining the output realization */
|
|
void d_kriging(int k,struct welldata_mod well,struct vario_mod variogram,struct grid_mod grid,struct realization_mod *realout);
|
|
|
|
|
|
/*dual_condit */
|
|
/*conditioning of a Gaussian realization using */
|
|
/*the dual kriging approach */
|
|
/*inversion method = CONJUGATE GRADIENTS */
|
|
/*NB: The realization and the well data are */
|
|
/*reduced to the standard Gaussian N(0,1) */
|
|
/*INPUT */
|
|
/*k: measurement type */
|
|
/*well: structure with the well data */
|
|
/*variogram: structure describing the variogram model*/
|
|
/*realin: structure defining the input realization */
|
|
/*OUTPUT */
|
|
/*realout: structure defining the output realization */
|
|
void dual_condit(int k,struct welldata_mod well,struct vario_mod variogram,struct grid_mod grid,struct realization_mod *realin,struct realization_mod *realout);
|
|
|
|
|
|
/*dual_condit_gen */
|
|
/*conditioning of a Gaussian realization using */
|
|
/*the dual kriging approach */
|
|
/*considered cases : Gaussian data */
|
|
/* Uniform data */
|
|
/* Log */
|
|
/*inversion method = CONJUGATE GRADIENTS */
|
|
/*INPUT */
|
|
/*k: measurement type */
|
|
/*wellin: structure with the well data */
|
|
/*variogram: structure describing the variogram model*/
|
|
/*realin: structure defining the input realization */
|
|
/*stat : structure defining the statistical data */
|
|
/*OUTPUT */
|
|
/*realout: structure defining the output realization */
|
|
|
|
void dual_condit_gen(int k,struct welldata_mod wellin,struct vario_mod variogram,struct grid_mod grid,struct realization_mod *realin,struct statistic_mod stat, struct realization_mod *realout);
|
|
|
|
|
|
|
|
/*FAST FOURIER TRANSFORM MOVING AVERAGE METHOD */
|
|
/*Turns a Gaussian white noise vector into a */
|
|
/*spatially correlated vector */
|
|
/*input: */
|
|
/*variogram: structure defining the variogram */
|
|
/* model */
|
|
/*grid: structure defining the grid */
|
|
/*n: vector with the number of cells along the */
|
|
/* X, Y and Z axes for the underlying grid */
|
|
/* i = [0 1 2] */
|
|
/* --> 0 0 0 : n will be computed and */
|
|
/* updated as output */
|
|
/* --> nx ny nz: these dimensions are used */
|
|
/*realin: structure defining a realization - */
|
|
/* must be a Gaussian white noise */
|
|
/*output: */
|
|
/*realout: structure defining a realization - */
|
|
void FFTMA(struct vario_mod variogram,struct grid_mod grid,int n[3],struct realization_mod *realin,struct realization_mod *realout);
|
|
|
|
|
|
/*FAST FOURIER TRANSFORM MOVING AVERAGE METHOD */
|
|
/*PLUS GRADIENT CALCULATIONS - GRADIENTS ARE */
|
|
/*CALCULATED FOR THE GRADUAL DEFORMATION PARAMETERS */
|
|
/* */
|
|
/*INPUT: */
|
|
/*------- */
|
|
/*variogram: structure defining the variogram */
|
|
/* model */
|
|
/*grid: structure defining the grid */
|
|
/*n: vector with the number of cells along the */
|
|
/* X, Y and Z axes for the underlying grid */
|
|
/* i = [0 1 2] */
|
|
/* --> 0 0 0 : n will be computed and */
|
|
/* updated as output */
|
|
/* --> nx ny nz: these dimensions are used */
|
|
/*realin: structure defining a realization - */
|
|
/* must be a Gaussian white noise */
|
|
/*DZoverDRHO: gradients calculated durin the gradual */
|
|
/* deformation process */
|
|
/* */
|
|
/*OUTPUT: */
|
|
/*------- */
|
|
/*realout: structure defining a realization - */
|
|
/*DYoverDRHO : structure with the output gradients */
|
|
void FFTMA_gradient(struct vario_mod variogram,struct grid_mod grid,int n[3],struct realization_mod *realin,struct gradients_mod *DZoverDRHO,struct realization_mod *realout,struct gradients_mod *DYoverDRHO);
|
|
|
|
|
|
/* GENERATION OF A GAUSSIAN WHITE NOISE VECTOR */
|
|
/*input: */
|
|
/* seed: seed */
|
|
/* n: number of components in the vector */
|
|
/*output: */
|
|
/* realization: structure defining the realization*/
|
|
void generate(long *seed, int n, struct realization_mod *realization);
|
|
|
|
void ikrig(int option, struct statfacies_mod facies, int kk,struct welldata_mod data, struct variotable_mod variogram,struct grid_mod grid,float *krigout);
|
|
|
|
|
|
/*kriging */
|
|
/*interpolation from ponctual data with simple */
|
|
/*kriging. kriging is used to interpolate standard */
|
|
/*Gaussian data only */
|
|
/*inversion method = CONJUGATE GRADIENTS */
|
|
/*INPUT */
|
|
/*k: measurement type */
|
|
/*well: structure with the well data */
|
|
/*variogram: structure describing the variogram model*/
|
|
/*grid: structure defining the grid */
|
|
/*OUTPUT */
|
|
/*realout: structure defining the output realization */
|
|
void kriging(int k,struct welldata_mod data,struct vario_mod variogram,struct grid_mod grid,struct realization_mod *realout);
|
|
|
|
|
|
/*CHOLESKY SIMULATION TECHNIQUE - LUSIM */
|
|
/*appropriate for regular grids and small number */
|
|
/*of points */
|
|
/*input: */
|
|
/*variogram: structure defining the variogram model */
|
|
/*realin: structure defining a realization - */
|
|
/* must be a Gaussian white noise */
|
|
/*output: */
|
|
/*realout: structure defining a realization - */
|
|
void LUSIM(struct vario_mod variogram,struct grid_mod grid,struct realization_mod *realin,struct realization_mod *realout);
|
|
|
|
|
|
void nor2any(struct cdf_mod *pcumulf,struct realization_mod *realin,struct realization_mod *realout);
|
|
|
|
/*TURNS NORMAL NUMBERS INTO LOGNORMAL NUMBERS */
|
|
/*input: */
|
|
/*realin: structure defining a realization - */
|
|
/* normal numbers */
|
|
/*typelog: --> 3: lognormal (natural) */
|
|
/* --> 4: lognormal (log10) */
|
|
/*output: */
|
|
/*realout: structure defining a realization - */
|
|
/* lognormal numbers */
|
|
void nor2log(struct realization_mod *realin, int typelog, struct realization_mod *realout);
|
|
|
|
|
|
/*TURNS NORMAL NUMBERS INTO UNIFORM NUMBERS */
|
|
/*input: */
|
|
/*realin: structure defining a realization - */
|
|
/* must have zero mean and unit variance */
|
|
/*output: */
|
|
/*realout: structure defining a realization - */
|
|
/* uniform numbers */
|
|
void nor2unif(struct realization_mod *realin,struct realization_mod *realout);
|
|
|
|
|
|
/*o_kriging */
|
|
/*interpolation from ponctual data with ordinary kriging */
|
|
/*o_kriging is used to interpolate standard Gaussian data*/
|
|
/*only */
|
|
/*INPUT */
|
|
/*k: measurement type or rank */
|
|
/*variogram: structure describing the variogram model */
|
|
/*data: structure with the well data */
|
|
/*grid: structure defining the grid */
|
|
/*OUTPUT */
|
|
/*realout: structure defining the kriged realization */
|
|
void o_kriging(int k,struct vario_mod variogram,struct welldata_mod data,struct grid_mod grid,struct realization_mod *realout);
|
|
|
|
|
|
/*od_kriging */
|
|
/*interpolation from ponctual data with ordinary dual*/
|
|
/*kriging. od_kriging is used to interpolate */
|
|
/*Gaussian data only */
|
|
/*inversion method = CONJUGATE GRADIENTS */
|
|
/*INPUT */
|
|
/*k: measurement type */
|
|
/*well: structure with the well data */
|
|
/*variogram: structure describing the variogram model*/
|
|
/*grid: structure defining the grid */
|
|
/*OUTPUT */
|
|
/*realout: structure defining the output realization */
|
|
void od_kriging(int k,struct welldata_mod well,struct vario_mod variogram,struct grid_mod grid,struct realization_mod *realout);
|
|
|
|
|
|
/*PLURIGAUSSIAN METHOD */
|
|
/*Starting from two independent Gaussian realizations Y1*/
|
|
/*and Y2 with zero mean and unit variance, but possibly */
|
|
/*different variogram models, a categorial realization is */
|
|
/*built. */
|
|
/*Truncation is performed on the basis of a mask with the */
|
|
/*x-axis associated to Y1 and the y-axis associated to Y2 */
|
|
/*This truncation may be stationary or non stationary */
|
|
/*The mask consists of lines perpendicular to the Y1 and */
|
|
/*Y2 axes. They define rectangular subregions attributed */
|
|
/*to categories i = [1...ncat] */
|
|
/*INPUT: */
|
|
/*facies: structure defining the facies proportions in the*/
|
|
/* whole reservoir model */
|
|
/*ineq: structure defining the mask for truncation */
|
|
/*Y1: first starting Gaussian realization */
|
|
/*Y2: second starting realization - same length as Y1 */
|
|
/*OUTPUT: */
|
|
/*Y: output realization */
|
|
void plurigau(struct statfacies_mod facies,struct inequalities_mod ineq,struct realization_mod *Y1, struct realization_mod *Y2, struct realization_mod *Y);
|
|
|
|
|
|
/*tr_kriging */
|
|
/*kriging with an external drift */
|
|
/*The trend is limited to a 2-term function */
|
|
/*m(u) = a0+a1y(u) where y(u) is a secondary */
|
|
/*external variable (e.g., seismic) */
|
|
/*INPUT: */
|
|
/*k: measurement type or rank */
|
|
/*variogram: structure describing the variogram */
|
|
/* model */
|
|
/*data: structure with the well data */
|
|
/*grid: structure defining the grid */
|
|
/*y: secondary external variable */
|
|
/*OUTPUT: */
|
|
/*realout: kriged realization */
|
|
void tr_kriging(int k, struct vario_mod variogram,struct welldata_mod data,struct grid_mod grid,struct realization_mod *Y,struct realization_mod *realout);
|
|
|
|
|
|
/*truncat */
|
|
/*TRUNCATES A STANDARD GAUSSIAN REALIZATION */
|
|
/*WITH THE TRUNCATED GAUSSIAN METHOD */
|
|
/*truncation may be stationary or nonstationary*/
|
|
/*INPUT: */
|
|
/*facies: description of the facies proportions*/
|
|
/*thresholds: may be an input if they have been*/
|
|
/* previously computed */
|
|
/*realin: structure defining a realization - */
|
|
/* must be a standard normal */
|
|
/*OUTPUT: */
|
|
/*realout: structure defining a realization - */
|
|
/*thresholds: Gaussian thresholds corresponding*/
|
|
/* to the facies volume fractions if*/
|
|
void truncat(struct statfacies_mod facies,struct realization_mod *realin,struct realization_mod *realout, struct statfacies_mod *thresholds);
|
|
|
|
|
|
/*TURNS UNIFORM NUMBERS INTO NORMAL NUMBERS*/
|
|
/*INPUT: */
|
|
/*realin: structure defining a realization - */
|
|
/* uniform numbers */
|
|
/*OUTPUT: */
|
|
/*realout: structure defining a realization - */
|
|
/* must have zero mean and unit variance */
|
|
void unif2nor(struct realization_mod *realin,struct realization_mod *realout);
|
|
|
|
|
|
/*Wany2nor */
|
|
/*converts any kind of continuous data to Gaussian data*/
|
|
/*INPUT: */
|
|
/*k: type of measurement */
|
|
/*wellin: structure with the input well data */
|
|
/*seed: seed */
|
|
/*OUTPUT: */
|
|
/*wellout: structure with the output well data */
|
|
/*pcumulf: structure describing the experimental */
|
|
/* cumulative distribution */
|
|
void Wany2nor(int k, struct welldata_mod wellin, long *seed,struct welldata_mod *wellout, struct cdf_mod *pcumulf);
|
|
|
|
|
|
/*Wfac2nor0 */
|
|
/*turns the facies well measurements into Gaussian data */
|
|
/*intervals only are respected - spatial variability is */
|
|
/*disregarded */
|
|
/*USES vf2thres, deflimit,trungasdev */
|
|
/*This step is required before performing kriging */
|
|
/*input: */
|
|
/*k: type measurement, may be 1,2,3 ... or ntype */
|
|
/*wellin: structure defining well data */
|
|
/* code = 5 --> facies */
|
|
/*grid: structure defining the grid */
|
|
/*facies: structure defining the facies proportions */
|
|
/*seed: seed */
|
|
/*output: */
|
|
/*wellout: structure defining well data - the kth vector*/
|
|
/*of measures are converted to standard normal data */
|
|
void Wfac2nor0(int k,struct grid_mod grid,struct welldata_mod wellin,struct statfacies_mod facies,long *seed,struct welldata_mod *wellout);
|
|
|
|
|
|
/*Wfac2nor1 */
|
|
/*turns the facies well measurements into Gaussian data */
|
|
/*Proceeds in 2 steps */
|
|
/* 1- builds a realization Y = LZ (variability ensured) */
|
|
/* 2- proposes successively local changes for Z to */
|
|
/* respect the intervals-Metropoils-Hastings approach */
|
|
/*input: */
|
|
/*k: type measurement, may be 1,2,3 ... or ntype */
|
|
/*variogram: structure defining the variogram model */
|
|
/*wellin: structure defining well data */
|
|
/* code = 5 --> facies */
|
|
/*grid: structure defining the grid */
|
|
/*facies: structure defining the facies proportions */
|
|
/*seed: seed */
|
|
/*output: */
|
|
/*wellout: structure defining well data - the kth vector*/
|
|
/*of measures are converted to standard normal data */
|
|
void Wfac2nor1(int k,struct vario_mod variogram,struct grid_mod grid,struct welldata_mod wellin,struct statfacies_mod facies,long *seed,struct welldata_mod *wellout);
|
|
|
|
|
|
/*Wfac2norPG0 */
|
|
/*turns the facies well measurements into Gaussian data */
|
|
/*intervals only are respected - spatial variability is */
|
|
/*disregarded */
|
|
/*method developed for pluriGaussian realizations */
|
|
/*stationary and nonstationary truncation */
|
|
/*This step is required before performing kriging */
|
|
/*INPUT: */
|
|
/*k: type measurement, may be 1,2,3 ... or ntype */
|
|
/*wellin: structure defining well data */
|
|
/* code = 5 --> facies */
|
|
/*grid: structure defining the grid */
|
|
/*facies: structure defining the facies proportions */
|
|
/*seed: seed */
|
|
/*idreal: identification of the starting realization */
|
|
/* = 1 for realization 1 */
|
|
/* = 2 for realization 2 */
|
|
/*ineq: structure defining the mask for truncation */
|
|
/*OUTPUT: */
|
|
/*wellout: structure defining well data - the kth vector*/
|
|
/*of measures are converted to standard normal data */
|
|
void Wfac2norPG0(int k,struct inequalities_mod ineq,struct grid_mod grid,struct welldata_mod wellin,struct statfacies_mod facies,long *seed,int idreal,struct welldata_mod *wellout);
|
|
|
|
|
|
/*Wfac2norPG1 */
|
|
/*turns the facies well measurements into Gaussian data */
|
|
/*Proceeds in 2 steps */
|
|
/* 1- builds a realization Y = LZ (variability ensured) */
|
|
/* 2- proposes successively local changes for Z to */
|
|
/* respect the intervals-Metropoils-Hastings approach */
|
|
/*method developed for pluriGaussian realizations */
|
|
/*STATIONARY TRUNCATION */
|
|
/*INPUT: */
|
|
/*k: type measurement, may be 1,2,3 ... or ntype */
|
|
/*wellin: structure defining well data */
|
|
/* code = 5 --> facies */
|
|
/*grid: structure defining the grid */
|
|
/*facies: structure defining the facies proportions */
|
|
/*seed: seed */
|
|
/*ineq: structure describing the truncation mask */
|
|
/*variogram1: structure describing the variogram model */
|
|
/* for realization Y1 */
|
|
/*variogram2: structure describing the variogram model */
|
|
/* for realization Y2 */
|
|
/*ineq: structure defining the mask for truncation */
|
|
/*OUTPUT: */
|
|
/*wellout1: structure with converted well data for */
|
|
/*realization 1 - the kth vector */
|
|
/*wellout2: structure with converted well data for */
|
|
/*realization 2 - the kth vector */
|
|
void Wfac2norPG1(int k,struct inequalities_mod ineq,struct vario_mod variogram1,struct vario_mod variogram2,struct grid_mod grid,struct welldata_mod wellin,struct statfacies_mod facies,long *seed,struct welldata_mod *wellout1,struct welldata_mod *wellout2);
|
|
|
|
|
|
/*Wlog2nor */
|
|
/*turns the log well measurements into std Gaussian data*/
|
|
/*This step is required before performing kriging */
|
|
/*input: */
|
|
/*k: type measurement, may be 1,2,3 ... or ntype */
|
|
/*wellin: structure defining well data */
|
|
/* code = 3 --> natural log */
|
|
/* code = 4 --> logarithm 10 */
|
|
/*grid: structure defining the grid */
|
|
/*stat: structure defining the statistics */
|
|
/*output: */
|
|
/*wellout: structure defining well data - the kth vector*/
|
|
/*of measures are converted to standard normal data */
|
|
void Wlog2nor(int k, struct welldata_mod wellin,struct grid_mod grid,struct statistic_mod stat,struct welldata_mod *wellout);
|
|
|
|
|
|
/*Wnor2nor */
|
|
/*converts Well Normal numbers to the standard Gaussian */
|
|
/*input: */
|
|
/*k: type measurement, may be 1,2,3 ... or ntype */
|
|
/*wellin: structure defining well data */
|
|
/*grid: structure defining the grid */
|
|
/*stat: structure defining the statistics */
|
|
/*output: */
|
|
/*wellout: structure defining well data - the kth vector*/
|
|
/*of measures are converted to standard normal data */
|
|
void Wnor2nor(int k, struct welldata_mod wellin,struct grid_mod grid,struct statistic_mod stat,struct welldata_mod *wellout);
|
|
|
|
|
|
/*Wunif2nor */
|
|
/*converts Well uniform numbers to the standard Gaussian*/
|
|
/*input: */
|
|
/*k: type measurement, may be 1,2,3 ... or ntype */
|
|
/*wellin: structure defining well data */
|
|
/*output: */
|
|
/*wellout: structure defining well data - the kth vector*/
|
|
/*of measures are converted to standard normal data */
|
|
void Wunif2nor(int k, struct welldata_mod wellin,struct welldata_mod *wellout);
|
|
|
|
|
|
|
|
#endif // define _CONDOR_H_
|