PLUTO
init.c
Go to the documentation of this file.
1 /* ///////////////////////////////////////////////////////////////////// */
2 /*!
3  \file
4  \brief 2D Blast wave problem with thermal conduction.
5 
6  Sets the initial conditions for a 2D Blast wave problem with thermal conduction.
7  For the HD case:
8  \f[
9  \rho = \rho_{\rm out} + \frac{\rho_{\rm in} - \rho_{\rm out}}{\cosh\left[10(r/r_0)^{10}\right]}\,,
10  \quad\quad\quad
11  T = \left\{\begin{array}{ll}
12  T_{\rm in} & \quad{\rm for} \quad r \le r_0 \\ \noalign{\medskip}
13  T_{\rm out} & \quad{\rm for} \quad r > r_0
14  \end{array}\right.\,,
15  \f]
16  where \f$r_0\f$ is the cloud radius.
17 
18  Input Parameters are that are read from \c pluto.ini are
19  - <tt>g_inputParam[T_IN], g_inputParam[T_OUT]</tt>: Temperature inside and outside the circle (in K);
20  - <tt>g_inputParam[RHO_IN], g_inputParam[RHO_OUT]</tt>: Density inside and outside (in dimensionless units);
21  - <tt>g_inputParam[BMAG]</tt>: Magnetic field strength (in Gauss);
22  - <tt>g_inputParam[THETA]</tt>: Orientation of the field (in degrees);
23 
24  Configurations:
25  - #01-04 have the same initial condition and are done either with
26  an explicit time stepping or STS, HD and MHD and do not show
27  evidence for any numerical artifact.
28  - #05-06, on the other hand, show that STS suffers from some kind of
29  unstable behavior due to the flux limiter switching from classical
30  to saturated regimes. Only small CFL (0.1 or less) or larger values
31  of STS_NU (e.g 0.05) mitigate the problem.
32  Future improvement (RKC/RKL ?) should address this issue.
33 
34  \author A. Mignone (mignone@ph.unito.it)
35  \date Aug 27, 2015
36 
37 */
38 /* ///////////////////////////////////////////////////////////////////// */
39 #include "pluto.h"
40 
41 /* ********************************************************************* */
42 void Init (double *us, double x1, double x2, double x3)
43 /*
44  *
45  *
46  *********************************************************************** */
47 {
48  static int first_call=1;
49  double r, r0, mu, T, prs_ref, prof;
50 
51  mu = 1.26;
52  g_gamma = 5.0/3.0;
53 
55 
56 /* ----------------------------------------------
57  Use c.g.s units
58  ---------------------------------------------- */
59 
60  r = sqrt(EXPAND(x1*x1, + x2*x2, + x3*x3));
61  r0 = 1.0; /* -- cloud radius -- */
62  prof = 1.0/cosh(10.0*pow(r/r0,10));
63 
64  us[VX1] = us[VX2] = 0.0;
65  T = g_inputParam[T_OUT] + (g_inputParam[T_IN] - g_inputParam[T_OUT])*(r <= r0);
67 
68  us[PRS] = T*us[RHO]/KELVIN;
69 
70  #if PHYSICS == MHD
71  us[BX1] = g_inputParam[BMAG]*cos(g_inputParam[THETA]*CONST_PI/180.0);
72  us[BX2] = g_inputParam[BMAG]*sin(g_inputParam[THETA]*CONST_PI/180.0);
73  us[BX3] = 0.0;
74 
75  us[BX1] /= sqrt(prs_ref*4.0*CONST_PI);
76  us[BX2] /= sqrt(prs_ref*4.0*CONST_PI);
77  us[BX3] /= sqrt(prs_ref*4.0*CONST_PI);
78 
79  us[AX1] = us[AX2] = 0.0;
80  us[AX3] = x2*us[BX1] - x1*us[BX2];
81  #endif
82 
83  #ifdef GLM_MHD
84  us[PSI_GLM] = 0.0;
85  #endif
86 
87 }
88 /* ********************************************************************* */
89 void Analysis (const Data *d, Grid *grid)
90 /*
91  *
92  *
93  *********************************************************************** */
94 { }
95 
96 /* ********************************************************************* */
97 void UserDefBoundary (const Data *d, RBox *box, int side, Grid *grid)
98 /*
99  *
100  *********************************************************************** */
101 {
102  static int first_call = 1;
103  int i, j, k, nv;
104  static double vin[256];
105 
106  if (side == X2_BEG){ /* -- X2_BEG boundary -- */
107  if (first_call){
108  Init(vin, 0.0, -10.0, 0.0);
109  first_call = 0;
110  }
111  if (box->vpos == CENTER){
112  for (nv = 0; nv < NVAR; nv++ ) BOX_LOOP(box,k,j,i){
113  d->Vc[nv][k][j][i] = vin[nv];
114  }
115  }
116  }
117 }
118 
tuple T
Definition: Sph_disk.py:33
double g_gamma
Definition: globals.h:112
void UserDefBoundary(const Data *d, RBox *box, int side, Grid *grid)
Definition: init.c:98
#define UNIT_DENSITY
Unit density in gr/cm^3.
Definition: pluto.h:369
#define VX2
Definition: mod_defs.h:29
#define RHO_IN
#define CENTER
Definition: pluto.h:200
int vpos
Location of the variable inside the cell.
Definition: structs.h:359
#define RHO
Definition: mod_defs.h:19
#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 PSI_GLM
Definition: mod_defs.h:34
#define AX2
Definition: mod_defs.h:86
#define T_OUT
#define RHO_OUT
#define KELVIN
Definition: pluto.h:401
#define VX1
Definition: mod_defs.h:28
#define BMAG
#define UNIT_VELOCITY
Unit velocity in cm/sec.
Definition: pluto.h:377
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
int j
Definition: analysis.c:2
int k
Definition: analysis.c:2
#define BX3
Definition: mod_defs.h:27
PLUTO main header file.
Definition: structs.h:30
int i
Definition: analysis.c:2
#define AX1
Definition: mod_defs.h:85
#define THETA
#define BX1
Definition: mod_defs.h:25
#define CONST_PI
.
Definition: pluto.h:269
#define X2_BEG
Boundary region at X2 beg.
Definition: pluto.h:148
#define T_IN
#define BX2
Definition: mod_defs.h:26
#define NVAR
Definition: pluto.h:609
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