PLUTO
init.c
Go to the documentation of this file.
1 /* ///////////////////////////////////////////////////////////////////// */
2 /*!
3  \file
4  \brief Underexpanded jet.
5 
6  The domain is initialized with a static medium, whereas in the bottom
7  boundary the following conditions are applied (see Section 5.2 of [Mig07])
8  \f[
9  P_{\rm jet} = \frac{P_{\rm ratio}}{\Gamma}\left(\frac{2}{\Gamma + 1}\right)^{\Gamma/(\Gamma - 1)}
10  \,,\quad
11  \rho_{\rm jet} = \rho_{\rm ratio}\left(\frac{2}{\Gamma + 1}\right)^{1/(\Gamma - 1)}
12  \,,\quad
13  v_{\rm jet} = \sqrt{\frac{\Gamma P_{\rm jet}}{\rho_{\rm jet}}}\,.
14  \f]
15 
16  The runtime parameters that are read from \c pluto.ini are
17  - <tt>g_inputParam[DN_RATIO]</tt>: sets the value of \f$\rho_{\rm ratio}\f$;
18  - <tt>g_inputParam[PR_RATIO]</tt>: sets the value of \f$P_{\rm ratio}\f$;
19 
20  Configurations:
21 
22  - #01: Second order accuracy;
23  - #02: Third order accuracy;
24 
25  \author A. Mignone (mignone@ph.unito.it)
26  \date July 09, 2014
27 
28  \b References:
29  - [Mig07]: "PLUTO: a numerical code for computational astrophysics",
30  Mignone et al., ApJS (2007), 170, 228
31 
32 */
33 /* ///////////////////////////////////////////////////////////////////// */
34 #include "pluto.h"
35 
36 /* ********************************************************************* */
37 void Init (double *us, double x1, double x2, double x3)
38 /*
39  *
40  *********************************************************************** */
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 }
52 /* ********************************************************************* */
53 void Analysis (const Data *d, Grid *grid)
54 /*
55  *
56  *********************************************************************** */
57 {
58 
59 }
60 /* ********************************************************************* */
61 void UserDefBoundary (const Data *d, RBox *box, int side, Grid *grid)
62 /*
63  *
64  *********************************************************************** */
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 }
96 
double g_gamma
Definition: globals.h:112
void UserDefBoundary(const Data *d, RBox *box, int side, Grid *grid)
Definition: init.c:98
#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 TRC
Definition: pluto.h:581
#define VX1
Definition: mod_defs.h:28
#define X2_BEG_LOOP(k, j, i)
Definition: macros.h:47
#define IDIR
Definition: pluto.h:193
Definition: structs.h:78
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
PLUTO main header file.
Definition: structs.h:30
int i
Definition: analysis.c:2
#define VX3
Definition: mod_defs.h:30
#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
Definition: structs.h:346
#define PR_RATIO
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