PLUTO
init.c
Go to the documentation of this file.
1 /* ///////////////////////////////////////////////////////////////////// */
2 /*!
3  \file
4  \brief Relativistic magnetized blast wave.
5 
6  Set the initial condition for the relativistic magnetized blast wave
7  problem in 2D or 3D.
8  It consists of a highly pressurized region inside a circle (in 2D) or
9  a sphere (in 3D) embeddd in a static uniform medium with lower pressure.
10  The magnetic field is constant and threads the whole computational domain.
11  \f[
12  (\rho,\, p) = \left\{\begin{array}{lcl}
13  (\rho_{\rm in},\, p_{\rm in}) & \quad\mathrm{or}\quad & r < r_c
14  \\ \noalign{\medskip}
15  (\rho_{\rm out},\, p_{\rm out}) & \quad\mathrm{or}\quad & r \ge r_c
16  \end{array}\right.
17  \,,\qquad
18  |\vec{B}| = B_0
19  \f]
20  In 3D, a linear smoothing is applied in the region \f$ r_c<r<1\f$.
21  The input parameters used in this problem are:
22 
23  -# <tt>g_inputParam[PRS_IN]</tt>: pressure inside the initial circular (2D)
24  or spherical (3D) region.
25  -# <tt>g_inputParam[PRS_OUT]</tt>: ambient pressure
26  -# <tt>g_inputParam[RHO_OUT]</tt>: ambient density
27  -# <tt>g_inputParam[BMAG]</tt>: magnetic field intensity
28  -# <tt>g_inputParam[THETA]</tt>: angle between mag. field and z-axis
29  (Cartesian only )
30  -# <tt>g_inputParam[PHI]</tt>: angle between mag. field and xy-plane
31  (Cartesian only)
32  -# <tt>g_inputParam[RADIUS]</tt>: radius of the initial over-pressurized region.
33 
34  Note that a given choice of parameters can be re-scaled by an arbitrary
35  factor \f$\eta\f$ by letting
36  \f$ \{\rho,\, p\} \to \eta^2\{\rho,\,p\},\, B \to \eta B \f$.
37 
38  The different configurations are:
39  - #01 and #02 are taken from Del Zanna et al, A&A (2003) 400,397
40  - #03 and #04 are taken from Mignone et al, ApJS (2007), 170, 228
41 
42  - #05 and #06 are taken from Beckwith & Stone, ApJS (2011), 193, 6
43  Strongly magnetized case, sec. 4.6 (Fig. 14)
44 
45  Strongly magnetized configurations can pass this test only by taking
46  some precautions (e.g. correcting total energy with staggered magnetic
47  field).
48 
49  \image html rmhd_blast.02.jpg "Density map (in log scale) for configuration #02"
50 
51  \authors A. Mignone (mignone@ph.unito.it)\n
52  \date Sept 16, 2014
53 */
54 /* ///////////////////////////////////////////////////////////////////// */
55 #include "pluto.h"
56 
57 /* ********************************************************************* */
58 void Init (double *us, double x1, double x2, double x3)
59 /*
60  *
61  *********************************************************************** */
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 }
118 /* ********************************************************************* */
119 void Analysis (const Data *d, Grid *grid)
120 /*
121  *
122  *
123  *********************************************************************** */
124 {
125 
126 }
127 /* ********************************************************************* */
128 void UserDefBoundary (const Data *d, RBox *box, int side, Grid *grid)
129 /*
130  *
131  *
132  *
133  *********************************************************************** */
134 { }
135 
double g_gamma
Definition: globals.h:112
void UserDefBoundary(const Data *d, RBox *box, int side, Grid *grid)
Definition: init.c:98
#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
Definition: structs.h:78
#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
PLUTO main header file.
#define RADIUS
Definition: structs.h:30
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
Definition: structs.h:346
void Analysis(const Data *d, Grid *grid)
Definition: init.c:66
void Init(double *v, double x1, double x2, double x3)
Definition: init.c:17