PLUTO
init.c File Reference

Relativistic magnetized blast wave. More...

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

Go to the source code of this file.

Functions

void Init (double *us, double x1, double x2, double x3)
 
void Analysis (const Data *d, Grid *grid)
 
void UserDefBoundary (const Data *d, RBox *box, int side, Grid *grid)
 

Detailed Description

Relativistic magnetized blast wave.

Set the initial condition for the relativistic magnetized blast wave problem in 2D or 3D. It consists of a highly pressurized region inside a circle (in 2D) or a sphere (in 3D) embeddd in a static uniform medium with lower pressure. The magnetic field is constant and threads the whole computational domain.

\[ (\rho,\, p) = \left\{\begin{array}{lcl} (\rho_{\rm in},\, p_{\rm in}) & \quad\mathrm{or}\quad & r < r_c \\ \noalign{\medskip} (\rho_{\rm out},\, p_{\rm out}) & \quad\mathrm{or}\quad & r \ge r_c \end{array}\right. \,,\qquad |\vec{B}| = B_0 \]

In 3D, a linear smoothing is applied in the region $ r_c<r<1$. The input parameters used in this problem are:

  1. g_inputParam[PRS_IN]: pressure inside the initial circular (2D) or spherical (3D) region.
  2. g_inputParam[PRS_OUT]: ambient pressure
  3. g_inputParam[RHO_OUT]: ambient density
  4. g_inputParam[BMAG]: magnetic field intensity
  5. g_inputParam[THETA]: angle between mag. field and z-axis (Cartesian only )
  6. g_inputParam[PHI]: angle between mag. field and xy-plane (Cartesian only)
  7. g_inputParam[RADIUS]: radius of the initial over-pressurized region.

Note that a given choice of parameters can be re-scaled by an arbitrary factor $\eta$ by letting $ \{\rho,\, p\} \to \eta^2\{\rho,\,p\},\, B \to \eta B $.

The different configurations are:

  • #01 and #02 are taken from Del Zanna et al, A&A (2003) 400,397
  • #03 and #04 are taken from Mignone et al, ApJS (2007), 170, 228
  • #05 and #06 are taken from Beckwith & Stone, ApJS (2011), 193, 6 Strongly magnetized case, sec. 4.6 (Fig. 14)

Strongly magnetized configurations can pass this test only by taking some precautions (e.g. correcting total energy with staggered magnetic field).

rmhd_blast.02.jpg
Density map (in log scale) for configuration #02
Authors
A. Mignone (migno.nosp@m.ne@p.nosp@m.h.uni.nosp@m.to.i.nosp@m.t)
Date
Sept 16, 2014

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 119 of file init.c.

124 {
125 
126 }
void Init ( double *  us,
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 58 of file init.c.

62 {
63  double r, rc, theta, phi;
64  double dc, pc, de, pe;
65 
66  g_gamma = 4./3.;
67 
68  #if DIMENSIONS == 2
69  r = sqrt(x1*x1 + x2*x2);
70  #elif DIMENSIONS == 3
71  r = sqrt(x1*x1 + x2*x2 + x3*x3);
72  #endif
73  rc = g_inputParam[RADIUS];
74 
75  dc = g_inputParam[RHO_IN];
76  pc = g_inputParam[PRS_IN];
77  de = g_inputParam[RHO_OUT];
78  pe = g_inputParam[PRS_OUT];
79 
80  if (r <= rc) {
81  us[RHO] = dc;
82  us[PRS] = pc;
83  #if DIMENSIONS == 3
84  }else if (r > rc && r < 1.0){
85  us[RHO] = de*(r - rc)/(1.0 - rc) + dc*(r - 1.0)/(rc - 1.0);
86  us[PRS] = pe*(r - rc)/(1.0 - rc) + pc*(r - 1.0)/(rc - 1.0);
87  #endif
88  }else{
89  us[RHO] = de;
90  us[PRS] = pe;
91  }
92 
93  us[VX1] = us[VX2] = us[VX3] = 0.0;
94  us[AX1] = us[AX2] = us[AX3] = 0.0;
95 
96  theta = g_inputParam[THETA]*CONST_PI/180.0;
97  phi = g_inputParam[PHI]*CONST_PI/180.0;
98 
99  #if GEOMETRY == CARTESIAN
100  us[BX1] = g_inputParam[BMAG]*sin(theta)*cos(phi);
101  us[BX2] = g_inputParam[BMAG]*sin(theta)*sin(phi);
102  us[BX3] = g_inputParam[BMAG]*cos(theta);
103 
104  us[AX1] = 0.0;
105  us[AX2] = us[BX3]*x1;
106  us[AX3] = -us[BX2]*x1 + us[BX1]*x2;
107  #elif GEOMETRY == CYLINDRICAL
108  us[BX1] = 0.0;
109  us[BX2] = g_inputParam[BMAG];
110  us[BX3] = 0.0;
111 
112  us[AX1] = us[AX2] = 0.0;
113  us[AX3] = 0.5*us[BX2]*x1;
114  #endif
115 
116  g_smallPressure = 1.e-6;
117 }
double g_gamma
Definition: globals.h:112
#define PHI
#define VX2
Definition: mod_defs.h:29
#define RHO_IN
#define RHO
Definition: mod_defs.h:19
#define AX2
Definition: mod_defs.h:86
double g_smallPressure
Small value for pressure fix.
Definition: globals.h:110
#define RHO_OUT
#define VX1
Definition: mod_defs.h:28
#define BMAG
#define AX3
Definition: mod_defs.h:87
double g_inputParam[32]
Array containing the user-defined parameters.
Definition: globals.h:131
#define PRS_OUT
#define BX3
Definition: mod_defs.h:27
#define RADIUS
static double pe
Definition: init.c:3
#define AX1
Definition: mod_defs.h:85
#define THETA
#define BX1
Definition: mod_defs.h:25
#define VX3
Definition: mod_defs.h:30
#define CONST_PI
.
Definition: pluto.h:269
#define BX2
Definition: mod_defs.h:26
#define PRS_IN
void UserDefBoundary ( const Data d,
RBox box,
int  side,
Grid grid 
)

Assign user-defined boundary conditions.

Parameters
[in,out]dpointer to the PLUTO data structure containing cell-centered primitive quantities (d->Vc) and staggered magnetic fields (d->Vs, when used) to be filled.
[in]boxpointer to a RBox structure containing the lower and upper indices of the ghost zone-centers/nodes or edges at which data values should be assigned.
[in]sidespecifies the boundary side where ghost zones need to be filled. It can assume the following pre-definite values: X1_BEG, X1_END, X2_BEG, X2_END, X3_BEG, X3_END. The special value side == 0 is used to control a region inside the computational domain.
[in]gridpointer to an array of Grid structures.

Assign user-defined boundary conditions in the lower boundary ghost zones. The profile is top-hat:

\[ V_{ij} = \left\{\begin{array}{ll} V_{\rm jet} & \quad\mathrm{for}\quad r_i < 1 \\ \noalign{\medskip} \mathrm{Reflect}(V) & \quad\mathrm{otherwise} \end{array}\right. \]

where $ V_{\rm jet} = (\rho,v,p)_{\rm jet} = (1,M,1/\Gamma)$ and M is the flow Mach number (the unit velocity is the jet sound speed, so $ v = M$).

Assign user-defined boundary conditions:

  • left side (x beg): constant shocked values
  • bottom side (y beg): constant shocked values for x < 1/6 and reflective boundary otherwise.
  • top side (y end): time-dependent boundary: for $ x < x_s(t) = 10 t/\sin\alpha + 1/6 + 1.0/\tan\alpha $ we use fixed (post-shock) values. Unperturbed values otherwise.

Assign user-defined boundary conditions at inner and outer radial boundaries. Reflective conditions are applied except for the azimuthal velocity which is fixed.

Assign user-defined boundary conditions.

Parameters
[in/out]d pointer to the PLUTO data structure containing cell-centered primitive quantities (d->Vc) and staggered magnetic fields (d->Vs, when used) to be filled.
[in]boxpointer to a RBox structure containing the lower and upper indices of the ghost zone-centers/nodes or edges at which data values should be assigned.
[in]sidespecifies on which side boundary conditions need to be assigned. side can assume the following pre-definite values: X1_BEG, X1_END, X2_BEG, X2_END, X3_BEG, X3_END. The special value side == 0 is used to control a region inside the computational domain.
[in]gridpointer to an array of Grid structures.

Set the injection boundary condition at the lower z-boundary (X2-beg must be set to userdef in pluto.ini). For $ R \le 1 $ we set constant input values (given by the GetJetValues() function while for $ R > 1 $ the solution has equatorial symmetry with respect to the z=0 plane. To avoid numerical problems with a "top-hat" discontinuous jump, we smoothly merge the inlet and reflected value using a profile function Profile().

Provide inner radial boundary condition in polar geometry. Zero gradient is prescribed on density, pressure and magnetic field. For the velocity, zero gradient is imposed on v/r (v = vr, vphi).

The user-defined boundary is used to impose stress-free boundary and purely vertical magnetic field at the top and bottom boundaries, as done in Bodo et al. (2012). In addition, constant temperature and hydrostatic balance are imposed. For instance, at the bottom boundary, one has:

\[ \left\{\begin{array}{lcl} \DS \frac{dp}{dz} &=& \rho g_z \\ \noalign{\medskip} p &=& \rho c_s^2 \end{array}\right. \qquad\Longrightarrow\qquad \frac{p_{k+1}-p_k}{\Delta z} = \frac{p_{k} + p_{k+1}}{2c_s^2}g_z \]

where $g_z$ is the value of gravity at the lower boundary. Solving for $p_k$ at the bottom boundary where $k=k_b-1$ gives:

\[ \left\{\begin{array}{lcl} p_k &=& \DS p_{k+1} \frac{1-a}{1+a} \\ \noalign{\medskip} \rho_k &=& \DS \frac{p_k}{c_s^2} \end{array}\right. \qquad\mathrm{where}\qquad a = \frac{\Delta z g_z}{2c_s^2} > 0 \]

where, for simplicity, we keep constant temperature in the ghost zones rather than at the boundary interface (this seems to give a more stable behavior and avoids negative densities). A similar treatment holds at the top boundary.

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 128 of file init.c.

134 { }