PLUTO
init.c
Go to the documentation of this file.
1 /* ///////////////////////////////////////////////////////////////////// */
2 /*!
3  \file
4  \brief Sod shock tube problem.
5 
6  The Sod shock tube problem is one of the most used benchmark for
7  shock-capturing schemes.
8  It is a one-dimensional problem with initial condition given
9  by a discontinuity separating two constant states:
10  \f[
11  \begin{array}{lcll}
12  \left(\rho,\, v_x,\, p\right)_L &=&
13  \left(1, 0, 1\right) & \qquad\mathrm{for}\quad x < 0.5
14  \\ \noalign{\medskip}
15  \left(\rho,\, v_x,\, p\right)_R &=&
16  \left(\frac{1}{8}, 0, \frac{1}{10}\right)
17  & \qquad\mathrm{for}\quad x > 0.5
18  \end{array}
19  \f]
20  The evolved structured at \c t=0.2 is shown in the panels below and consists of a
21  left-going rarefaction wave, a right-going contact discontinutity and a
22  right-going shock wave.
23  The results shown here were carried with \c PARABOLIC interpolation,
24  \c CHARACTERISIC_TRACING time stepping and the \c two_shock Riemann solver
25  on 400 zones (configuration #04).
26 
27  \image html hd_sod.04.jpg "Flow profiles for the Sod shock tube at t = 0.2 using configuration #04".
28 
29  \author A. Mignone (mignone@ph.unito.it)
30  \date June 08, 2014
31 
32  \b References
33  - Sod, G. A. (1978).
34  "A Survey of Several Finite Difference Methods for Systems of
35  Nonlinear Hyperbolic Conservation Laws".
36  JCP (1978) 27:1-31
37 
38 */
39 /* ///////////////////////////////////////////////////////////////////// */
40 #include "pluto.h"
41 
42 /* ********************************************************************* */
43 void Init (double *v, double x1, double x2, double x3)
44 /*
45  *
46  *********************************************************************** */
47 {
48  #if EOS == IDEAL
49  g_gamma = 1.4;
50  #endif
51 
52  if (fabs(x1) < 0.5) {
53  v[RHO] = 1.0;
54  v[PRS] = 1.0;
55  }else{
56  v[RHO] = 0.125;
57  v[PRS] = 0.1;
58  }
59  v[VX1] = 0.0;
60 
61 }
62 /* ********************************************************************* */
63 void Analysis (const Data *d, Grid *grid)
64 /*
65  *
66  *
67  *********************************************************************** */
68 {
69 }
70 /* ********************************************************************* */
71 void UserDefBoundary (const Data *d, RBox *box, int side, Grid *grid)
72 /*
73  *
74  *********************************************************************** */
75 {
76 }
double g_gamma
Definition: globals.h:112
void UserDefBoundary(const Data *d, RBox *box, int side, Grid *grid)
Definition: init.c:98
#define RHO
Definition: mod_defs.h:19
#define VX1
Definition: mod_defs.h:28
Definition: structs.h:78
PLUTO main header file.
Definition: structs.h:30
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