PLUTO
init.c File Reference

Sod shock tube problem. More...

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

Go to the source code of this file.

Functions

void Init (double *v, 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

Sod shock tube problem.

The Sod shock tube problem is one of the most used benchmark for shock-capturing schemes. It is a one-dimensional problem with initial condition given by a discontinuity separating two constant states:

\[ \begin{array}{lcll} \left(\rho,\, v_x,\, p\right)_L &=& \left(1, 0, 1\right) & \qquad\mathrm{for}\quad x < 0.5 \\ \noalign{\medskip} \left(\rho,\, v_x,\, p\right)_R &=& \left(\frac{1}{8}, 0, \frac{1}{10}\right) & \qquad\mathrm{for}\quad x > 0.5 \end{array} \]

The evolved structured at t=0.2 is shown in the panels below and consists of a left-going rarefaction wave, a right-going contact discontinutity and a right-going shock wave. The results shown here were carried with PARABOLIC interpolation, CHARACTERISIC_TRACING time stepping and the two_shock Riemann solver on 400 zones (configuration #04).

hd_sod.04.jpg
Flow profiles for the Sod shock tube at t = 0.2 using configuration #04

.

Author
A. Mignone (migno.nosp@m.ne@p.nosp@m.h.uni.nosp@m.to.i.nosp@m.t)
Date
June 08, 2014

References

  • Sod, G. A. (1978). "A Survey of Several Finite Difference Methods for Systems of Nonlinear Hyperbolic Conservation Laws". JCP (1978) 27:1-31

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

Definition at line 63 of file init.c.

68 {
69 }
void Init ( double *  v,
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 43 of file init.c.

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 }
double g_gamma
Definition: globals.h:112
#define RHO
Definition: mod_defs.h:19
#define VX1
Definition: mod_defs.h:28
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.

Definition at line 71 of file init.c.

75 {
76 }