4 void Init (
double *us,
double x1,
double x2,
double x3)
11 static int first_call = 1;
13 double x, y, z = 0.0, r2;
15 double dvx, dvy, dBx, dBy, arg;
20 srand(time(NULL) +
prank);
23 rnd = (double)(rand())/((
double)RAND_MAX + 1.0);
32 dvx = -y*kp*exp(0.5*arg);
33 dvy = x*kp*exp(0.5*arg);
35 dBx = -y*mu*exp(0.5*arg);
36 dBy = x*mu*exp(0.5*arg);
47 us[PRS] = 1.0/
g_gamma + exp(arg)*(mu*mu*(1.0 - r2 + z*z) - us[
RHO]*kp*kp)*0.5;
56 us[
AX3] = mu*exp(0.5*arg);
69 double rhoe, pm, kin, my, E, BxBy, vol;
70 double pm0, kinx, kiny;
77 rhoe = pm = kin = my = E = BxBy = 0.0;
91 E += d->
Vc[PRS][
k][
j][
i]/(
g_gamma - 1.0) + kinx + kiny + pm0;
108 MPI_Allreduce (&rhoe, &vol, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
111 MPI_Allreduce (&pm, &vol, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
114 MPI_Allreduce (&kin, &vol, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
117 MPI_Allreduce (&my, &vol, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
120 MPI_Allreduce (&E, &vol, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
123 MPI_Allreduce (&BxBy, &vol, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
126 MPI_Barrier (MPI_COMM_WORLD);
134 static int first_call = 1;
136 fp = fopen(
"averages.dat",
"w");
137 fprintf (fp,
"# t\t\t dt\t <rhoe>\t <B^2>/2\t <rho*vx^2/2>\t <rho*vy>\t <E>\t <BxBy>\n");
140 fp = fopen(
"averages.dat",
"a");
142 fprintf (fp,
"%12.6e %12.6e %12.6e %12.6e %12.6e %12.6e %12.6e %12.6e\n",
void UserDefBoundary(const Data *d, RBox *box, int side, Grid *grid)
double **** Vc
The main four-index data array used for cell-centered primitive variables.
double g_dt
The current integration time step.
double g_inputParam[32]
Array containing the user-defined parameters.
double g_domBeg[3]
Lower limits of the computational domain.
D_EXPAND(tot/[n]=(double) grid[IDIR].np_int_glob;, tot/[n]=(double) grid[JDIR].np_int_glob;, tot/[n]=(double) grid[KDIR].np_int_glob;)
double g_time
The current integration time.
double g_domEnd[3]
Upper limits of the computational domain.
long int JBEG
Lower grid index of the computational domain in the the X2 direction for the local processor...
long int IBEG
Lower grid index of the computational domain in the the X1 direction for the local processor...
void Analysis(const Data *d, Grid *grid)
void Init(double *v, double x1, double x2, double x3)