PLUTO
init.c File Reference

Double Mach reflection test problem. More...

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

Go to the source code of this file.

Functions

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

Double Mach reflection test problem.

Sets the initial condition for a planar shock front making an angle of $ \pi/3 $ with a reflecting wall:

\[ \left(\rho,v_x,v_y,p\right) = \left\{\begin{array}{ll} (1.4,0,0,1) & \qquad {\rm for} \quad x >x_s(0) \\ \noalign{\medskip} (8,8,25,-8.25,116.5) & \qquad {\rm otherwise} \end{array}\right. \]

where $x_s(t) = 10t/\sin\alpha + 1/6 + y/\tan\alpha$ is the shock position. The ideal equation of state with $ \Gamma = 1.4$ is used. The wedge is represented by a reflecting boundary starting at x=1/6 along the lower y-boundary. As the shock reflects off the lower wall, a complex flow structure develops with two curved reflected shocks propagating at directions almost orthogonal to each other and a tangential discontinuity separating them. At the wall, a pressure gradient sets up a denser fluid jet propagating along the wall. Kelvin-Helmholtz instability patterns may be identified with the rolls developing at the slip line. This feature is very sensitive to numerical diffusion and it becomes visible at high resolution and/or low dissipative schemes.

In the frames below we show configuration # 02 using a high-order finite difference scheme with 5-th order WENO-Z reconstruction and RK3 time stepping. The resolution is 960 x 240.

dmr_rho.gif
Density contours for the double Mach reflection test
dmr_prs.gif
Pressure contours for the double Mach reflection test
Author
A. Mignone (migno.nosp@m.ne@p.nosp@m.h.uni.nosp@m.to.i.nosp@m.t)
Date
May 23, 2014

References

  • "The Numerical Simulation of Two-Dimensional Fluid Flow with Strong Shocks"
    Woodward, P.R., & Colella, P., JCP (1984) 54, 115.
  • "The PLUTO Code for computational astrophysics"
    Mignone et al., ApJS(2007) 170,228
  • "Comparison of some FLux Corrected Transport and Total variatiion diminishing numerical schemes for hydrodynamics and magnetohydrodynamic problems"
    Toth, G., Odstrcil, D., JCP (1996) 128, 82.

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 82 of file init.c.

86 {
87 
88 }
void Init ( double *  us,
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 58 of file init.c.

62 {
63  double alpha, xs;
64 
65  g_gamma = 1.4;
66  alpha = 1.0/3.0*CONST_PI;
67  xs = 1.0/6.0 + x2/tan(alpha);
68 
69  if (x1 > xs){
70  us[RHO] = 1.4;
71  us[VX1] = 0.0;
72  us[VX2] = 0.0;
73  us[PRS] = 1.0;
74  }else{
75  us[RHO] = 8.0;
76  us[VX1] = 8.25*sin(alpha);
77  us[VX2] = -8.25*cos(alpha);
78  us[PRS] = 116.5;
79  }
80 }
static double alpha
Definition: init.c:3
double g_gamma
Definition: globals.h:112
#define VX2
Definition: mod_defs.h:29
#define RHO
Definition: mod_defs.h:19
#define VX1
Definition: mod_defs.h:28
#define CONST_PI
.
Definition: pluto.h:269
void UserDefBoundary ( const Data d,
RBox box,
int  side,
Grid grid 
)

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 90 of file init.c.

102 {
103  int i, j, k;
104  double x1, x2, x3;
105  double alpha,xs;
106 
107  alpha = 60./180.*CONST_PI;
108 
109  if (side == X1_BEG){
110 
111  X1_BEG_LOOP(k,j,i) {
112  d->Vc[RHO][k][j][i] = 8.0;
113  d->Vc[VX1][k][j][i] = 8.25*sin(alpha);
114  d->Vc[VX2][k][j][i] = - 8.25*cos(alpha);
115  d->Vc[PRS][k][j][i] = 116.5;
116  }
117 
118  } else if (side == X2_BEG){
119 
120  X2_BEG_LOOP(k,j,i) {
121  x1 = grid[IDIR].x[i];
122  if (x1 < 1.0/6.0){
123  d->Vc[RHO][k][j][i] = 8.0;
124  d->Vc[VX1][k][j][i] = 8.25*sin(alpha);
125  d->Vc[VX2][k][j][i] = - 8.25*cos(alpha);
126  d->Vc[PRS][k][j][i] = 116.5;
127  }else{ /* reflective boundary */
128  d->Vc[RHO][k][j][i] = d->Vc[RHO][k][2*JBEG - j - 1][i];
129  d->Vc[VX1][k][j][i] = d->Vc[VX1][k][2*JBEG - j - 1][i];
130  d->Vc[VX2][k][j][i] = - d->Vc[VX2][k][2*JBEG - j - 1][i];
131  d->Vc[PRS][k][j][i] = d->Vc[PRS][k][2*JBEG - j - 1][i];
132  }
133  }
134 
135  } else if (side == X2_END) {
136 
137  X2_END_LOOP(k,j,i){
138 
139  x1 = grid[IDIR].x[i];
140  xs = 10.0*g_time/sin(alpha) + 1.0/6.0 + 1.0/tan(alpha);
141  if (x1 < xs){
142  d->Vc[RHO][k][j][i] = 8.0;
143  d->Vc[VX1][k][j][i] = 8.25*sin(alpha);
144  d->Vc[VX2][k][j][i] = - 8.25*cos(alpha);
145  d->Vc[PRS][k][j][i] = 116.5;
146  }else{ /* reflective boundary */
147  d->Vc[RHO][k][j][i] = 1.4;
148  d->Vc[VX1][k][j][i] = 0.;
149  d->Vc[VX2][k][j][i] = 0.;
150  d->Vc[PRS][k][j][i] = 1.;
151  }
152  }
153  }
154 }
static double alpha
Definition: init.c:3
#define X1_BEG
Boundary region at X1 beg.
Definition: pluto.h:146
#define VX2
Definition: mod_defs.h:29
#define RHO
Definition: mod_defs.h:19
double **** Vc
The main four-index data array used for cell-centered primitive variables.
Definition: structs.h:31
#define VX1
Definition: mod_defs.h:28
#define X2_BEG_LOOP(k, j, i)
Definition: macros.h:47
#define X2_END_LOOP(k, j, i)
Definition: macros.h:51
#define IDIR
Definition: pluto.h:193
#define X2_END
Boundary region at X2 end.
Definition: pluto.h:149
int j
Definition: analysis.c:2
int k
Definition: analysis.c:2
double * x
Definition: structs.h:80
#define X1_BEG_LOOP(k, j, i)
Definition: macros.h:46
int i
Definition: analysis.c:2
double g_time
The current integration time.
Definition: globals.h:117
#define CONST_PI
.
Definition: pluto.h:269
#define X2_BEG
Boundary region at X2 beg.
Definition: pluto.h:148
long int JBEG
Lower grid index of the computational domain in the the X2 direction for the local processor...
Definition: globals.h:39