/* Calculates time evolution of initial data (u, u_t)=(A*r^5*Gaussian, B*r^5*Gaussian) for cubic focusing Klein-Gordon equation u_tt-u_rr=-u+u^3/r^2 in radial 3d using centered time and centered space discretization. Saves (A,B) in blowup.dat, dispersion.dat, or indecisive.dat depending on outcome */ /***************************************************** ** Parameters **************************************** ******************************************************/ /* minimum amplitude A */ #define MINA 0.0 /* maximum amplitude A */ #define MAXA 6.5 /* stepsize A */ #define INCA 0.001 /* minimum amplitude B */ #define MINB -16.5 /* maximum amplitude B */ #define MAXB 14.5 /* stepsize B */ #define INCB 0.005 /* Grid mesh dr in multiples of DRBASE, see below */ #define DRMULT 30 /* Number of spatial gridpoints */ #define KD 2000 /* Courant constant dt/dr */ #define R 0.9 /* Maximal number of processes */ #define PROCS 50 /* Energy of Q */ #define Qenergy 1.5038 /*********************************************************/ #include #include #include /* define resolution of soliton file */ #define DRBASE 1.0e-4 /* define grid mesh */ #define DR ((double)DRMULT*DRBASE) /* global variable for Q */ double *Q; /****************** initial data ***************** initial position */ double f(long k, double A) { double r=k*DR; /* compute radial coordinate from gridpoint */ return A*r*r*r*cos(10*r*r)*exp(-sqrt(1+r*r*r*r)); } /* initial velocity */ double g(long k, double B) { double r=k*DR; /* compute radial coordinate from gridpoint */ return B*r*sin(6*r*r)*exp(-4.0*(r*r-1)*(r*r-1)); } /***********************************************/ /* import routine for soliton (or other functions) data are assumed to be given with dr=DRBASE caller has to provide pointer to array */ int import(char *file, double *data, long size) { register long k, j; /* loop variables */ double dummy; /* auxiliary variable to store skipped entries */ FILE *fp; /* file pointer */ /* try to open file for reading */ if((fp=fopen(file, "r"))==NULL) return 0; /* no success, return error */ /* loop for reading data */ for(k=0; k1 */ for(j=1; j