PLUTO
init.c File Reference

Underexpanded jet. 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

Underexpanded jet.

The domain is initialized with a static medium, whereas in the bottom boundary the following conditions are applied (see Section 5.2 of [Mig07])

\[ P_{\rm jet} = \frac{P_{\rm ratio}}{\Gamma}\left(\frac{2}{\Gamma + 1}\right)^{\Gamma/(\Gamma - 1)} \,,\quad \rho_{\rm jet} = \rho_{\rm ratio}\left(\frac{2}{\Gamma + 1}\right)^{1/(\Gamma - 1)} \,,\quad v_{\rm jet} = \sqrt{\frac{\Gamma P_{\rm jet}}{\rho_{\rm jet}}}\,. \]

The runtime parameters that are read from pluto.ini are

  • g_inputParam[DN_RATIO]: sets the value of $\rho_{\rm ratio}$;
  • g_inputParam[PR_RATIO]: sets the value of $P_{\rm ratio}$;

Configurations:

  • #01: Second order accuracy;
  • #02: Third order accuracy;
Author
A. Mignone (migno.nosp@m.ne@p.nosp@m.h.uni.nosp@m.to.i.nosp@m.t)
Date
July 09, 2014

References:

  • [Mig07]: "PLUTO: a numerical code for computational astrophysics", Mignone et al., ApJS (2007), 170, 228

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

57 {
58 
59 }
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 37 of file init.c.

41 {
42  g_gamma = 5./3.;
43 
44  us[RHO] = 1.0;
45  us[VX1] = 0.0;
46  us[VX2] = 0.0;
47  us[VX3] = 0.0;
48  us[PRS] = 1.0/g_gamma;
49  us[TRC] = 0.0;
50 
51 }
double g_gamma
Definition: globals.h:112
#define VX2
Definition: mod_defs.h:29
#define RHO
Definition: mod_defs.h:19
#define TRC
Definition: pluto.h:581
#define VX1
Definition: mod_defs.h:28
#define VX3
Definition: mod_defs.h:30
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 61 of file init.c.

65 {
66  int i, j, k;
67  double *R;
68  real pjet, dnjet, vjet;
69  real scrh;
70 
71  scrh = 1.0/(g_gamma - 1.0);
72 
73  R = grid[IDIR].xgc;
74  pjet = g_inputParam[PR_RATIO]*pow(2.0/(g_gamma + 1.0),g_gamma*scrh)/g_gamma;
75  dnjet = g_inputParam[DN_RATIO]*pow(2.0/(g_gamma + 1.0),scrh);
76  vjet = sqrt(g_gamma*pjet/dnjet);
77 
78  if (side == X2_BEG){
79 
80  X2_BEG_LOOP(k,j,i){
81 
82  if (R[i] <= 1.) {
83  d->Vc[RHO][k][j][i] = dnjet;
84  d->Vc[VX1][k][j][i] = 0.;
85  d->Vc[VX2][k][j][i] = vjet;
86  d->Vc[PRS][k][j][i] = pjet;
87  } else {
88  d->Vc[RHO][k][j][i] = d->Vc[RHO][k][2*JBEG - j - 1][i];
89  d->Vc[VX1][k][j][i] = d->Vc[VX1][k][2*JBEG - j - 1][i];
90  d->Vc[VX2][k][j][i] = -d->Vc[VX2][k][2*JBEG - j - 1][i];
91  d->Vc[PRS][k][j][i] = d->Vc[PRS][k][2*JBEG - j - 1][i];
92  }
93  }
94  }
95 }
double g_gamma
Definition: globals.h:112
#define VX2
Definition: mod_defs.h:29
double real
Definition: pluto.h:488
#define RHO
Definition: mod_defs.h:19
tuple scrh
Definition: configure.py:200
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 IDIR
Definition: pluto.h:193
double g_inputParam[32]
Array containing the user-defined parameters.
Definition: globals.h:131
int j
Definition: analysis.c:2
int k
Definition: analysis.c:2
#define DN_RATIO
double * xgc
Cell volumetric centroid (!= x when geometry != CARTESIAN).
Definition: structs.h:84
int i
Definition: analysis.c:2
#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
#define PR_RATIO