PLUTO
init.c File Reference

Magnetized accretion torus. More...

#include "pluto.h"
Include dependency graph for init.c:

Go to the source code of this file.

Functions

static void DipoleField (double x1, double x2, double x3, double *Bx1, double *Bx2, double *A)
 
void Init (double *v, double x1, double x2, double x3)
 
void Analysis (const Data *d, Grid *grid)
 
void BackgroundField (double x1, double x2, double x3, double *B0)
 
void UserDefBoundary (const Data *d, RBox *box, int side, Grid *grid)
 

Variables

static double kappa
 

Detailed Description

Magnetized accretion torus.

Magnetized accretion torus in 2D spherical coordinates in a radially stratified atmosphere. The accretion torus is determined by the equilibrium condition

\[ -\frac{1}{R} + \frac{1}{2(1-a)}\frac{L_k^2}{r^{2-2a}} +(n+1)\frac{p}{\rho} = const \]

where $p = K\rho^\gamma $, R is the spherical radius, r is the cylindrical radius. Since $ n = 1/(\gamma-1) $ then $ 1+n = \gamma/(\gamma-1) $ we can also write using $ a = 0 $ (constant angular momentum distribution, Kuwabara Eq [8]):

\[ -\frac{1}{R} + \frac{1}{2}\frac{L_k^2}{r^2} + \frac{\gamma}{\gamma-1}K\rho^{\gamma-1} = c = -\frac{1}{r_{\min}} + \frac{1}{2}\frac{L_k^2}{r_{\min}^2} \]

where the constant on the right hand side is determined at the zero pressure surface. The previous equation is used to compute K at the point where the density is maximum and then again to obtain the density distribution:

\[ K = \frac{\gamma-1}{\gamma}\left[ c + \frac{1}{r_{\max}} - \frac{1}{2}\frac{L_k^2}{r_{\max}^2} \right]\frac{1}{\rho_{\max}^{\gamma-1}}\,;\qquad \rho = \left[\frac{\gamma-1}{K\gamma}\left(c + \frac{1}{R} - \frac{1}{2}\frac{L_k^2}{r^2}\right)\right]^{1/(\gamma-1)} \]

Thus, specifying $ r_{\min} $, $ r_{\max} $ and $ \rho_{\max}$ determine the torus structure completely. The torus azimuthal velocity is compute from $v_\phi = L_k/r$.

The atmosphere is assumed to be isothermal and it is given by the condition of hydrostatic balance:

\[ \rho_a(R) = \eta\rho_{\max} \exp\left[\left(\frac{1}{R}-\frac{1}{r_{\min}}\right) \frac{GM}{a^2}\right] \]

where $\eta$ is the density contrast between the (maximum) torus density and the atmosphere density at $(r_{\min},0)$.

The torus surface is defined by the condition $p_t > p_a$.

The dimensionless form of the equation employs on the following units:

  • $ [\rho] = \rho_{\max}$: reference density;
  • $ [L] = R_{*} $: star radius;
  • $ [v^2] = GM/L $: reference (squared) velocity.

The user defined parameters of this problem, as they appear in pluto.ini, allows for control in the Torus shape and the contrast of physical values:

  1. g_inputParam[RMIN]: minimum cylindrical radius for the torus (inner rim)
  2. g_inputParam[RMAX]: radius of the Torus where pressure is maximum
  3. g_inputParam[RHO_CUT]: minimum density to define the last contour of the magnetic vec. pot.
  4. g_inputParam[BETA]: plasma beta
  5. g_inputParam[ETA] density contrast between atmosphere and Torus
  6. g_inputParam[SCALE_HEIGHT]: atmosphere scale height $ H=GM/a^2$

The magnetic field can be specified to be inside the torus or as a large-scale dipole field. In the first case, we give the vector potential:

\[ A_\phi = B_0(\rho_t - \rho_{\rm cut}) \]

In the second case, a dipole field is specified in the function DipoleField(). The user-defined constant USE_DIPOLE can be used to select between the two configurations.

Author
A. Mignone (migno.nosp@m.ne@p.nosp@m.h.uni.nosp@m.to.i.nosp@m.t)
T. Matsakos (titos.nosp@m.@odd.nosp@m.job.u.nosp@m.chic.nosp@m.ago.e.nosp@m.du)
Date
Aug 16, 2012

References

  • "Global Magnetohydrodynamical Simulations of Accretion Tori", Hawley, J.F., ApJ (2000) 528 462.
  • "The dynamical stability of differentially rotating discs with constant specific angular momentum" Papaloizou, J.C.B, Pringle, J.E, MNRAS (1984) 208 721
  • "The Acceleration Mechanism of Resistive Magnetohydrodynamic Jets Launched from Accretion Disks." Kuwabara, T., Shibata, K., Kudoh, T., Matsumoto, R. ApJ (2005) 621 921

Definition in file init.c.

Function Documentation

void Analysis ( const Data d,
Grid grid 
)

Perform runtime data analysis.

Parameters
[in]dthe PLUTO Data structure
[in]gridpointer to array of Grid structures

Compute volume-integrated magnetic pressure, Maxwell and Reynolds stresses. Save them to "averages.dat"

Definition at line 203 of file init.c.

208 {
209 }
void BackgroundField ( double  x1,
double  x2,
double  x3,
double *  B0 
)

Define the component of a static, curl-free background magnetic field.

Definition at line 212 of file init.c.

218 {
219  double A;
220 
221  B0[0] = 0.0;
222  B0[1] = 0.0;
223  B0[2] = 0.0;
224  #if USE_DIPOLE == YES
225  DipoleField (x1,x2,x3,B0, B0+1, &A);
226  #endif
227 }
static void DipoleField(double x1, double x2, double x3, double *Bx1, double *Bx2, double *A)
Definition: init.c:300
double * A
Right interface area, A[i] = .
Definition: structs.h:87

Here is the call graph for this function:

void DipoleField ( double  x1,
double  x2,
double  x3,
double *  Bx1,
double *  Bx2,
double *  A 
)
static

Assign the polodial component of magnetic fields and vector potential for a dipole.

Definition at line 300 of file init.c.

307 {
308  double R, z, r, r2, r3, Bmag;
309  double a;
310 
311  Bmag = sqrt(2.0*kappa/g_inputParam[BETA]);
312 
313  #if GEOMETRY == CYLINDRICAL
314  R = x1; z = x2; r = sqrt(x1*x1 + x2*x2);
315  r2 = r*r;
316  r3 = r2*r;
317  *Bx1 = 3.0*Bmag*z*R/(r2*r3);
318  *Bx2 = -Bmag*(R*R - 3.0*z*z)/(r2*r3);
319  *A = Bmag*R/r3;
320  #elif GEOMETRY == SPHERICAL
321  r = x1;
322  r2 = r*r;
323  r3 = r2*r;
324  *Bx1 = 2.0*Bmag*cos(x2)/r3;
325  *Bx2 = Bmag*sin(x2)/r3;
326  *A = Bmag*sin(x2)/r2;
327  #endif
328 }
static double a
Definition: init.c:135
#define BETA
static double kappa
Definition: init.c:101
double g_inputParam[32]
Array containing the user-defined parameters.
Definition: globals.h:131
double * A
Right interface area, A[i] = .
Definition: structs.h:87

Here is the caller graph for this function:

void Init ( double *  v,
double  x1,
double  x2,
double  x3 
)

The Init() function can be used to assign initial conditions as as a function of spatial position.

Parameters
[out]va pointer to a vector of primitive variables
[in]x1coordinate point in the 1st dimension
[in]x2coordinate point in the 2nd dimension
[in]x3coordinate point in the 3rdt dimension

The meaning of x1, x2 and x3 depends on the geometry:

\[ \begin{array}{cccl} x_1 & x_2 & x_3 & \mathrm{Geometry} \\ \noalign{\medskip} \hline x & y & z & \mathrm{Cartesian} \\ \noalign{\medskip} R & z & - & \mathrm{cylindrical} \\ \noalign{\medskip} R & \phi & z & \mathrm{polar} \\ \noalign{\medskip} r & \theta & \phi & \mathrm{spherical} \end{array} \]

Variable names are accessed by means of an index v[nv], where nv = RHO is density, nv = PRS is pressure, nv = (VX1, VX2, VX3) are the three components of velocity, and so forth.

Definition at line 104 of file init.c.

108 {
109  double rmin, rmax, beta;
110  double r, R, z, A_phi, gmmr, H;
111  double a,c, l_k, l_k2;
112  double Bo, Vo;
113  double prt, pra, phi;
114  double rhot, rhoa, rhocut;
115 
116  gmmr = g_gamma/(g_gamma - 1.0);
117  #if GEOMETRY == CYLINDRICAL
118  r = x1; /* cylindrical radius */
119  z = x2;
120  R = sqrt(x1*x1 + x2*x2); /* spherical radius */
121  #elif GEOMETRY == SPHERICAL
122  r = x1*sin(x2); /* cylindrical radius */
123  z = x1*cos(x2);
124  R = x1; /* spherical radius */
125  #endif
126 
127  phi = 0.0;
128 
129  rmax = g_inputParam[RMAX];
130  rmin = g_inputParam[RMIN];
131  beta = g_inputParam[BETA];
132  rhocut = g_inputParam[RHO_CUT];
134 
135  l_k = sqrt(rmax);
136  l_k2 = l_k*l_k;
137  Vo = l_k;
138 
139 /* ----------------------------------------
140  Solve for kappa and c assuming pra=0
141  ---------------------------------------- */
142 
143  c = - 1.0/rmin + 0.5*l_k2/(rmin*rmin);
144  kappa = (c + 1.0/rmax - 0.5*l_k2/(rmax*rmax))/gmmr;
145 
146 /* ----------------------------
147  Torus density + pressure
148  ---------------------------- */
149 
150  a = c + 1.0/R - 0.5*l_k2/(r*r);
151  a = MAX(a, 0.0);
152  rhot = pow(a/(gmmr*kappa), 1.0/(g_gamma-1));
153  prt = kappa*pow(rhot,g_gamma);
154 
155 /* -------------------------------------
156  Atmospheric density + pressure
157  (force equilibrium Fg and \nabla P)
158  ------------------------------------- */
159 
160  rhoa = g_inputParam[ETA]*exp((1./R - 1./rmin)/H);
161  pra = rhoa*H;
162 
163  Bo = sqrt(2.0*kappa/beta);
164 
165  if (prt > pra && r > 2.0) { /* Torus */
166  v[RHO] = rhot;
167  v[PRS] = prt;
168  v[VX1] = 0.0;
169  v[VX2] = 0.0;
170  v[VX3] = Vo/r;
171  v[TRC] = 1.0;
172  }else{ /* Atmosphere */
173  v[RHO] = rhoa;
174  v[PRS] = pra;
175  v[VX1] = 0.0;
176  v[VX2] = 0.0;
177  v[VX3] = 0.0;
178  v[TRC] = 0.0;
179  }
180 
181  #if PHYSICS == MHD || PHYSICS == RMHD
182  v[BX1] = 0.0;
183  v[BX2] = 0.0;
184  v[BX3] = 0.0;
185 
186  A_phi = 0.0;
187  #if USE_DIPOLE == NO
188  if (rhot > rhocut && r > 2.0) A_phi = Bo*(rhot - rhocut);
189  #endif
190 
191  v[AX1] = 0.0;
192  v[AX2] = 0.0;
193  v[AX3] = A_phi;
194  #endif
195 
196  #if (USE_DIPOLE == YES) && (BACKGROUND_FIELD == NO)
197  DipoleField (x1,x2,x3,v+BX1, v+BX2, v+AX3);
198  #endif
199 
200  g_smallPressure = 1.e-8;
201 }
static double a
Definition: init.c:135
#define MAX(a, b)
Definition: macros.h:101
double g_gamma
Definition: globals.h:112
#define VX2
Definition: mod_defs.h:29
#define BETA
#define RHO
Definition: mod_defs.h:19
static double gmmr
Definition: two_shock.c:42
static void DipoleField(double x1, double x2, double x3, double *Bx1, double *Bx2, double *A)
Definition: init.c:300
#define AX2
Definition: mod_defs.h:86
#define TRC
Definition: pluto.h:581
double g_smallPressure
Small value for pressure fix.
Definition: globals.h:110
#define RHO_CUT
#define SCALE_HEIGHT
#define VX1
Definition: mod_defs.h:28
#define RMAX
static double kappa
Definition: init.c:101
#define AX3
Definition: mod_defs.h:87
double g_inputParam[32]
Array containing the user-defined parameters.
Definition: globals.h:131
tuple c
Definition: menu.py:375
#define BX3
Definition: mod_defs.h:27
#define ETA
#define AX1
Definition: mod_defs.h:85
#define BX1
Definition: mod_defs.h:25
#define VX3
Definition: mod_defs.h:30
#define BX2
Definition: mod_defs.h:26
#define RMIN

Here is the call graph for this function:

void UserDefBoundary ( const Data d,
RBox box,
int  side,
Grid grid 
)

Assign user-defined boundary conditions. At the inner boundary we use outflow conditions, except for velocity which we reset to zero when there's an inflow

Definition at line 230 of file init.c.

237 {
238  int i, j, k, nv;
239  double *x1, *x2, *x3;
240  static double vR1[NVAR];
241  double R;
242 
243  x1 = grid[IDIR].x;
244  x2 = grid[JDIR].x;
245  x3 = grid[KDIR].x;
246 
247  if (side == X1_BEG){
248  if (box->vpos == CENTER){
249  BOX_LOOP(box,k,j,i){
250  for (nv = 0; nv < NVAR; nv++){
251  d->Vc[nv][k][j][i] = d->Vc[nv][k][j][IBEG];
252  }
253  d->Vc[VX1][k][j][i] = MIN(d->Vc[VX1][k][j][i],0.0);
254  }
255  }else if (box->vpos == X2FACE){
256  #ifdef STAGGERED_MHD
257 // BOX_LOOP(box,k,j,i) d->Vs[BX2s][k][j][i] = d->Vs[BX2s][k][j][IBEG];
258  #endif
259  }
260  }
261 }
#define X1_BEG
Boundary region at X1 beg.
Definition: pluto.h:146
#define CENTER
Definition: pluto.h:200
int vpos
Location of the variable inside the cell.
Definition: structs.h:359
#define BOX_LOOP(B, k, j, i)
Definition: macros.h:70
double **** Vc
The main four-index data array used for cell-centered primitive variables.
Definition: structs.h:31
#define VX1
Definition: mod_defs.h:28
#define KDIR
Definition: pluto.h:195
#define MIN(a, b)
Definition: macros.h:104
#define IDIR
Definition: pluto.h:193
int j
Definition: analysis.c:2
int k
Definition: analysis.c:2
double * x
Definition: structs.h:80
int i
Definition: analysis.c:2
#define JDIR
Definition: pluto.h:194
#define NVAR
Definition: pluto.h:609
#define X2FACE
Definition: pluto.h:202
long int IBEG
Lower grid index of the computational domain in the the X1 direction for the local processor...
Definition: globals.h:35

Variable Documentation

double kappa
static

Definition at line 101 of file init.c.