98 static void DipoleField(
double x1,
double x2,
double x3,
99 double *Bx1,
double *Bx2,
double *A);
104 void Init (
double *v,
double x1,
double x2,
double x3)
109 double rmin, rmax, beta;
110 double r, R, z, A_phi,
gmmr, H;
111 double a,
c, l_k, l_k2;
113 double prt, pra, phi;
114 double rhot, rhoa, rhocut;
117 #if GEOMETRY == CYLINDRICAL
120 R = sqrt(x1*x1 + x2*x2);
121 #elif GEOMETRY == SPHERICAL
143 c = - 1.0/rmin + 0.5*l_k2/(rmin*rmin);
144 kappa = (c + 1.0/rmax - 0.5*l_k2/(rmax*rmax))/
gmmr;
150 a = c + 1.0/R - 0.5*l_k2/(r*r);
163 Bo = sqrt(2.0*kappa/beta);
165 if (prt > pra && r > 2.0) {
181 #if PHYSICS == MHD || PHYSICS == RMHD
188 if (rhot > rhocut && r > 2.0) A_phi = Bo*(rhot - rhocut);
196 #if (USE_DIPOLE == YES) && (BACKGROUND_FIELD == NO)
224 #if USE_DIPOLE == YES
239 double *x1, *x2, *x3;
240 static double vR1[
NVAR];
250 for (nv = 0; nv <
NVAR; nv++){
263 #if (BODY_FORCE & VECTOR)
265 void BodyForceVector(
double *v,
double *g,
double x1,
double x2,
double x3)
273 #if GEOMETRY == CYLINDRICAL
274 R = sqrt(x1*x1 + x2*x2);
275 g[
IDIR] = -1.0/(R*R*R)*x1;
276 g[
JDIR] = -1.0/(R*R*R)*x2;
278 #elif GEOMETRY == SPHERICAL
280 g[
IDIR] = -1.0/(R*R);
287 #if (BODY_FORCE & POTENTIAL)
301 double *Bx1,
double *Bx2,
double *A)
308 double R, z, r, r2, r3, Bmag;
313 #if GEOMETRY == CYLINDRICAL
314 R = x1; z = x2; r = sqrt(x1*x1 + x2*x2);
317 *Bx1 = 3.0*Bmag*z*R/(r2*r3);
318 *Bx2 = -Bmag*(R*R - 3.0*z*z)/(r2*r3);
320 #elif GEOMETRY == SPHERICAL
324 *Bx1 = 2.0*Bmag*cos(x2)/r3;
325 *Bx2 = Bmag*sin(x2)/r3;
326 *A = Bmag*sin(x2)/r2;
#define X1_BEG
Boundary region at X1 beg.
void UserDefBoundary(const Data *d, RBox *box, int side, Grid *grid)
int vpos
Location of the variable inside the cell.
void BackgroundField(double x1, double x2, double x3, double *B0)
#define BOX_LOOP(B, k, j, i)
double **** Vc
The main four-index data array used for cell-centered primitive variables.
static void DipoleField(double x1, double x2, double x3, double *Bx1, double *Bx2, double *A)
double g_smallPressure
Small value for pressure fix.
double g_inputParam[32]
Array containing the user-defined parameters.
double BodyForcePotential(double x, double y, double z)
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)
void BodyForceVector(double *v, double *g, double x, double y, double z)