PLUTO
init.c File Reference

Two-Dimensional Riemann 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

Two-Dimensional Riemann problem.

Sets the initial condition for a 2D Riemann problem in terms of 4 four constant states at each corner of the computational domain.

For example, the top right corner, $x > 0$, $y > 0$, is denoted with PP and its initial values are:

\[ \rho = \rho_{\rm PP} \,,\quad\quad P = P_{\rm PP} \,,\quad\quad v_x = v_{x\,{\rm PP}} \,,\quad\quad v_y = v_{y\,{\rm PP}}\,. \]

Similar conditions hold for the bottom right corner ( $x > 0$, $y < 0$; PM), the top left ( $x < 0$, $y > 0$; MP), and the bottom left ( $x < 0$, $y < 0$; MM). The 4 flow quantities of each corner are defined by the 16 parameters that are read from pluto.ini.

  • DN_PP, PR_PP, VX_PP, VY_PP
  • DN_MP, PR_MP, VX_MP, VY_MP
  • DN_PM, PR_PM, VX_PM, VY_PM
  • DN_MM, PR_MM, VX_MM, VY_MM
  • Configurations #01, #02 and #05 involve the interaction between four contact discontinuities (see fig. below).
  • Configurations #03 and #04 (with AMR) involve the interaction of shocks.
hd_riemann2D.05.jpg
Final state for configuration #05.
Author
A. Mignone (migno.nosp@m.ne@p.nosp@m.h.uni.nosp@m.to.i.nosp@m.t)
Date
Sept 15, 2014

References

  • C. W. Schulz-Rinne, "Classification of the Riemann problem for two-dimensional gas dynamics", SIAM J. Math. Anal., 24 (1993), pp. 76-88.
  • C. W. Schulz-Rinne, J. P. Collins and H. M. Glaz, "Numerical solution of the Riemann problem for two-dimensional gas dynamics", SIAM J. Sci. Comp., 14 (1993), pp. 1394-1414.

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

107 {
108 
109 }
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 55 of file init.c.

60 {
61  double x,y;
62 
63  x = x1;
64  y = x2;
65  #if EOS == IDEAL
66  g_gamma = 1.4;
67  #elif EOS == ISOTHERMAL
68  g_isoSoundSpeed = 1.0;
69  #endif
70 
71  if (x > 0.0 && y > 0.0){
72  us[RHO] = g_inputParam[DN_PP];
73  #if EOS == IDEAL
74  us[PRS] = g_inputParam[PR_PP];
75  #endif
76  us[VX1] = g_inputParam[VX_PP];
77  us[VX2] = g_inputParam[VY_PP];
78  }else if(x < 0.0 && y > 0.0){
79  us[RHO] = g_inputParam[DN_MP];
80  #if EOS == IDEAL
81  us[PRS] = g_inputParam[PR_MP];
82  #endif
83  us[VX1] = g_inputParam[VX_MP];
84  us[VX2] = g_inputParam[VY_MP];
85  }else if(x < 0.0 && y < 0.0){
86  us[RHO] = g_inputParam[DN_MM];
87  #if EOS == IDEAL
88  us[PRS] = g_inputParam[PR_MM];
89  #endif
90  us[VX1] = g_inputParam[VX_MM];
91  us[VX2] = g_inputParam[VY_MM];
92  }else if(x > 0.0 && y < 0.0){
93  us[RHO] = g_inputParam[DN_PM];
94  #if EOS == IDEAL
95  us[PRS] = g_inputParam[PR_PM];
96  #endif
97  us[VX1] = g_inputParam[VX_PM];
98  us[VX2] = g_inputParam[VY_PM];
99  }
100 }
#define PR_PM
#define VX_MP
double g_gamma
Definition: globals.h:112
#define VX2
Definition: mod_defs.h:29
#define DN_MP
#define RHO
Definition: mod_defs.h:19
#define VX_MM
#define PR_PP
#define VX1
Definition: mod_defs.h:28
#define DN_MM
#define VX_PM
double g_inputParam[32]
Array containing the user-defined parameters.
Definition: globals.h:131
#define VY_PP
double * x
Definition: structs.h:80
#define PR_MP
#define VX_PP
#define VY_PM
#define DN_PM
#define DN_PP
#define VY_MP
#define PR_MM
#define VY_MM
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 112 of file init.c.

116 { }