PLUTO
init.c
Go to the documentation of this file.
1 /* ///////////////////////////////////////////////////////////////////// */
2 /*!
3  \file
4  \brief Sedov-Taylor blast wave.
5 
6  Set the initial condition for a Sedov-Taylor blast wave problem.
7  Ambient density and pressure are constant everywhere and equal to
8  \c rho0 and \c p0.
9  While \c rho0 is an input parameter, \c p0=1.e-5.
10  A large amount of energy is deposited in a small volume (a
11  line, circle or sphere depending on geometry and dimensions)
12  consisting of 2 or 3 computational zones.
13 
14  The input parameters read from pluto.ini are labeled as:
15  - <tt>g_inputParam[ENRG0]</tt>: initial energy of the blast wave
16  (\e not energy density);
17  - <tt>g_inputParam[DNST0]</tt>: initial constant density;
18  - <tt>g_inputParam[GAMMA]</tt>: specific heat ratio.
19 
20  The available configurations refer to:
21  -# Cartesian (1D)
22  -# Cylindrical (1D)
23  -# Spherical (1D)
24  -# Cartesian (2D, equivalent to cylindrical)
25  -# Cartesian (3D, equivalent to spherical)
26 
27  \image html hd_sedov.02.jpg "Density plot at t=0.5 for configuration #02 (cylindrical blast)"
28 
29  \author A. Mignone (mignone@ph.unito.it)
30  \date July 08, 2014
31 
32  \b References:
33  - L.I. Sedov, "Similarity and Dimensional Methods in Mechanics",
34  Academic Press, New York, 1959.
35 */
36 /* ///////////////////////////////////////////////////////////////////// */
37 #include "pluto.h"
38 
39 /* ********************************************************************* */
40 void Init (double *us, double x1, double x2, double x3)
41 /*
42  *
43  *
44  *
45  *********************************************************************** */
46 {
47  double dr, vol, r;
48 
50 
51 /* --------------------------------------------------
52  dr is the size of the initial energy deposition
53  region: 2 ghost zones.
54  -------------------------------------------------- */
55 
56  #if DIMENSIONS == 1
57  dr = 2.0*(g_domEnd[IDIR]-g_domBeg[IDIR])/(double)NX1;
58  #else
59  dr = 3.5*(g_domEnd[IDIR]-g_domBeg[IDIR])/(double)NX1;
60  #endif
61 
62 /* ---------------------------------------
63  compute region volume
64  --------------------------------------- */
65 
66  #if (GEOMETRY == CARTESIAN) && (DIMENSIONS == 1)
67  vol = 2.0*dr;
68  #elif (GEOMETRY == CYLINDRICAL && DIMENSIONS == 1)|| \
69  (GEOMETRY == CARTESIAN && DIMENSIONS == 2)
70  vol = CONST_PI*dr*dr;
71  #elif (GEOMETRY == SPHERICAL && DIMENSIONS == 1)|| \
72  (GEOMETRY == CYLINDRICAL && DIMENSIONS == 2)|| \
73  (GEOMETRY == CARTESIAN && DIMENSIONS == 3)
74  vol = 4.0/3.0*CONST_PI*dr*dr*dr;
75  #else
76  print1 ("! Init: geometrical configuration not allowed\n");
77  QUIT_PLUTO(1);
78  #endif
79 
80  r = EXPAND(x1*x1, + x2*x2, +x3*x3);
81  r = sqrt(r);
82 
83  us[RHO] = g_inputParam[DNST0];
84  us[VX1] = 0.0;
85  us[VX2] = 0.0;
86  us[VX3] = 0.0;
87 
88  if (r <= dr) us[PRS] = (g_gamma - 1.0)*g_inputParam[ENRG0]/vol;
89  else us[PRS] = 1.e-5;
90 
91  us[TRC] = 0.0;
92 }
93 /* ********************************************************************* */
94 void Analysis (const Data *d, Grid *grid)
95 /*
96  *
97  *
98  *********************************************************************** */
99 {
100 
101 }
102 
103 /* ********************************************************************* */
104 void UserDefBoundary (const Data *d, RBox *box, int side, Grid *grid)
105 /*
106  *
107  *
108  *********************************************************************** */
109 { }
110 
double g_gamma
Definition: globals.h:112
void UserDefBoundary(const Data *d, RBox *box, int side, Grid *grid)
Definition: init.c:98
#define VX2
Definition: mod_defs.h:29
long int NX1
Number of interior zones in the X1 directions (boundaries excluded) for the local processor...
Definition: globals.h:48
void print1(const char *fmt,...)
Definition: amrPluto.cpp:511
#define ENRG0
#define RHO
Definition: mod_defs.h:19
#define DNST0
#define TRC
Definition: pluto.h:581
#define VX1
Definition: mod_defs.h:28
#define GAMMA
#define IDIR
Definition: pluto.h:193
Definition: structs.h:78
double g_inputParam[32]
Array containing the user-defined parameters.
Definition: globals.h:131
double g_domBeg[3]
Lower limits of the computational domain.
Definition: globals.h:125
PLUTO main header file.
Definition: structs.h:30
#define VX3
Definition: mod_defs.h:30
#define CONST_PI
.
Definition: pluto.h:269
double g_domEnd[3]
Upper limits of the computational domain.
Definition: globals.h:126
Definition: structs.h:346
#define QUIT_PLUTO(e_code)
Definition: macros.h:125
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