26 int isub, jsub, ksub, nsub = 5;
28 static double **ucons, **uprim;
33 double us[256], u_av[256], b[3];
35 struct GRID *GX, *GY, *GZ;
63 print1 (
"> Assigning initial conditions (Startup) ...\n");
73 #if GEOMETRY == CYLINDRICAL
74 x1 = GX->
xgc[
i]; x1p = GX->
xr[
i]; dx1 = GX->
dx[
i];
75 x2 = GY->
xgc[
j]; x2p = GY->
xr[
j]; dx2 = GY->
dx[
j];
76 x3 = GZ->
xgc[
k]; x3p = GZ->
xr[
k]; dx3 = GZ->
dx[
k];
78 x1 = GX->
x[
i]; x1p = GX->
xr[
i]; dx1 = GX->
dx[
i];
79 x2 = GY->
x[
j]; x2p = GY->
xr[
j]; dx2 = GY->
dx[
j];
80 x3 = GZ->
x[
k]; x3p = GZ->
xr[
k]; dx3 = GZ->
dx[
k];
83 for (nv =
NVAR; nv--; ) d->
Vc[nv][k][j][i] = u_av[nv] = 0.0;
95 for (ksub = 0; ksub < nsub; ksub++){
96 for (jsub = 0; jsub < nsub; jsub++){
97 for (isub = 0; isub < nsub; isub++){
99 x1s = x1 + (double)(1.0 - nsub + 2.0*isub)/(double)(2.0*nsub)*dx1;
100 x2s = x2 + (double)(1.0 - nsub + 2.0*jsub)/(double)(2.0*nsub)*dx2;
101 x3s = x3 + (double)(1.0 - nsub + 2.0*ksub)/(double)(2.0*nsub)*dx3;
103 Init (us, x1s, x2s, x3s);
104 for (nv = 0; nv <
NVAR; nv++) {
105 u_av[nv] += us[nv]/(double)(nsub*nsub*nsub);
111 Init (u_av, x1, x2, x3);
115 for (nv =
NVAR; nv--; ) d->
Vc[nv][k][j][i] = u_av[nv];
125 d->
Ax3[k][j][i] = u_av[
AX3]; ,
126 d->
Ax1[k][j][i] = u_av[
AX1];
127 d->
Ax2[k][j][i] = u_av[
AX2];)
142 #if PHYSICS == MHD || PHYSICS == RMHD
143 #if ASSIGN_VECTOR_POTENTIAL == YES
148 d->
Vs[nv][
k][
j][
i] = b[nv];
160 Init (u_av, x1p, x2, x3);
163 Init (u_av, x1, x2p, x3);
166 Init (u_av, x1, x2, x3p);
199 #if PHYSICS != ADVECTION
204 for (nv =
NVAR; nv--; ) us[nv] = d->
Vc[nv][k][j][i];
206 if (us[
RHO] <= 0.0) {
207 print (
"! Startup(): negative density, zone [%f, %f, %f]\n", x1,x2,x3);
211 if (us[PRS] <= 0.0) {
212 print (
"! Startup(): negative pressure, zone [%f, %f, %f]\n",x1,x2,x3);
217 #if (PHYSICS == RHD || PHYSICS == RMHD)
220 print (
"! Startup(): total velocity exceeds 1\n");
void Boundary(const Data *d, int idim, Grid *grid)
double **** Vs
The main four-index data array used for face-centered staggered magnetic fields.
void print1(const char *fmt,...)
double **** Vc
The main four-index data array used for cell-centered primitive variables.
double *** Ax3
Vector potential component in the direction.
#define UPDATE_VECTOR_POTENTIAL
void print(const char *fmt,...)
double * xgc
Cell volumetric centroid (!= x when geometry != CARTESIAN).
#define INITIAL_SMOOTHING
void Init(double *, double, double, double)
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;)
long int NMAX_POINT
Maximum number of points among the three directions, boundaries excluded.
void VectorPotentialDiff(double *, int, int, int, Grid *)
#define ARRAY_2D(nx, ny, type)
double *** Ax1
Vector potential component in the direction.
#define QUIT_PLUTO(e_code)
double *** Ax2
Vector potential component in the direction.