#define CRLF "\n" /* novembre 2004 */ /* 26 octobre 2002 */ /* */ /* jv 2002 */ /* Sept 2001 */ /* 4 3 1 */ /* fev 2001 06/11/2000 */ /* 01 /2001 */ /* Nouvelle version 12/05/2000 */ /* OK TF issue de KS */ /* 26/09/95 vers 19 Sept 95 */ /* 26/09/95 OK 26/10/96 */ /* */ /* */ /* LIRE LE LIVRE NUMERICAL RECIPIES */ /* sur www.lmm.jussieu.fr/INFO2/info.html: source de Num Rec. */ /* /* COMPILATION dans le fichier Fait.txt: cc -O3 -ffast-math dfour1.c fftTD_b.c -lm -o ff.out;ff.out */ /* utilisation de Numˇrical Recipies (en Fortran!) p 390! */ /* dfour1.c */ /* transformee de Fourier en DOUBLE precision */ /* j=N-1 */ /* ___ */ /* ^ \ I k (2 Pi j/N) */ /* u = / u e */ /* k --- j */ /* j=0 */ /* */ /* remarquer que les valeurs sont prises en xj=(2 Pi j/N) */ /* */ /* La TF inverse s'ecrit alors */ /* k=N-1 */ /* ___ */ /* \ ^ -I k (2 Pi j/N) */ /* u = / u e */ /* j --- k */ /* k=0 */ /* */ /* La derivation s'ecrit alors */ /* k=N-1 */ /* ___ */ /* d \ ^ -I k (2 Pi j/N) */ /* -- u = / u (- I k) e */ /* dx j --- k */ /* k=0 */ /* */ /* */ /* ON MULTIPLIE PAR (-Ik) POUR DERIVER */ /* */ /* ACHTUNG !!!!! */ /* les variations sont entre -Pi et Pi */ /* => correction des dˇrivˇes */ /* d'ou le facteur (Pi/Lx) */ /* ================================================================ */ #include #include #include "math.h" /*---------------------------------------------------------*/ double* u=NULL,* x=NULL,* yw=NULL,* ywp=NULL; double* TFf=NULL,* TFfp=NULL,* TFp=NULL,*TFz=NULL,*Esp=NULL; double* p=NULL; double* tau=NULL,* TFtau=NULL; double* Tzr=NULL,* Tzi=NULL; /*---------------------------------------------------------*/ double zr,zi,a,a13; double Pi; double Lx,Lb,h0,dx; int it,nt,reg,type; int nx ; #define Power pow int npix,npiy; FILE *g; /*---------------------------------------------------------*/ void trace(void); void reLit(void); /*---------------------------------------------------------*/ int main(void) { int i,itt,nbt; double fx,fy,qq; /* ouverture des fichiers de sauvegarde */ printf(" ___ \n"); printf("^ \\ I k (2 Pi j/N) \n"); printf("u = / u e \n"); printf(" k --- j \n"); printf(" \n"); printf(" \n"); printf(" \n"); printf(" \n"); printf(" tau = F[y ] \n"); printf(" w \n"); /* lecture du fichier donnees */ /* a modifier ici, lire le nombre de points de la forme 2^n */ Pi=4*atan(1); /* domaine en x et en t */ reLit(); /* RAZ */ printf(" nbre de points en 2^n = 2^%d \n",nx); printf(" Lx = %7f (1/2 taille domaine) \n",Lx); printf(" Lb = %7f (1/2 longueur bosse) \n",Lb); printf(" dx = %7f (calcule 2*Lx/(nx-1)) \n",dx); printf(" regime = %d -> ",reg); if (reg==-1){printf("subcritique F<1 \n");} if (reg== 0){printf("tuyau \n");} if (reg== 1){printf("supercritique F>1 \n");} if (reg== 2){printf("prof. infinie \n");} if (reg== 3){printf("tuayu p2-p1=A'' \n");} if (reg==10){printf("supersonique M>1 \n");} if (reg==100){printf("Special Hilbert \n");} printf(" type de bosse initiale -> "); if((type)==0){printf("bruit blanc\n");} if((type)==1){printf("gaussienne de largeur Lb\n");} if((type)==2){printf("sinus\n");} if((type)==3){printf("marche descendante\n");} if((type)==4){printf("diamant\n");} if((type)==99){printf("reprise\n");} /* ------------------------------------------------------*/ /* fin des lectures */ /* declaration */ nbt=nx+15; u =(double*)calloc(nbt,sizeof(double)); Tzr =(double*)calloc(nbt,sizeof(double)); Tzi =(double*)calloc(nbt,sizeof(double)); /* u est la fonction dont on cherche la TF */ nbt=2*nx+30; x =(double*)calloc(nbt,sizeof(double)); yw =(double*)calloc(nbt,sizeof(double)); ywp =(double*)calloc(nbt,sizeof(double)); tau =(double*)calloc(nbt,sizeof(double)); p =(double*)calloc(nbt,sizeof(double)); TFf =(double*)calloc(nbt,sizeof(double)); TFfp =(double*)calloc(nbt,sizeof(double)); TFp =(double*)calloc(nbt,sizeof(double)); TFtau =(double*)calloc(nbt,sizeof(double)); /* fin declaration */ /* Initialisation conditions initiales */ for (i=0; i<=nx;i++) {x[i]=-Lx+ i*dx;} /* expon */ if((type)==1){ for (i=0; i<=nx;i++) { yw[i]= h0*exp(-Pi*pow((x[i])/Lb,2)); } } /* cos */ if((type)==2){ for (i=0; i<=nx;i++) { yw[i]= h0*cos( 4*Pi*x[i]/Lb /2) ; } } if((type)==3){ for (i=0; iLx/2) {yw[i]= h0/2*(-tanh(- (x[i]-3*Lx/4)/Lb )-1);;} }} if((type)==4){ for (i=0; i0 ) {yw[i]= x[i]/(Lb/2)*h0;} if(x[i]>(Lb/2)){yw[i]=(-x[i]/(Lb/2) +2)*h0;} if(x[i]>Lb) {yw[i]=0;} }} /* reprise */ if((type)==99){ g= fopen("xypt.OUT","r"); for (i=0; i