PLUTO
init.c
Go to the documentation of this file.
1 /* ///////////////////////////////////////////////////////////////////// */
2 /*!
3  \file
4  \brief Hydrodynamic jet propagation in 2D cylindrical coordinates.
5 
6  This problem considers the propagation of a hydrodynamic jet into a
7  static uniform medium with constant density and pressure.
8  The ambient density, in units of the jet density, is prescribed to be
9  \f$ \rho_a = \eta \f$ where \f$\eta\f$ is the ambient/jet density ratio.
10  The ambient pressure is \f$ p = 1/\Gamma \f$ when an \c IDEAL EoS is used
11  or it is computed from temperature as \f$ p = p(\rho_a, T_a) \f$ for the
12  \c PVTE_LAW EoS (here Ta is the ambient temperature).
13  These values are set in Init() while the jet inflow is set through
14  a user-defined boundary condition at the lower z-boundary.
15  A simple top-hat injection nozzle is used.
16 
17  The configuration is defined in terms of the following parameters:
18 
19  - <tt>g_inputParam[ETA]</tt>: density ratio between ambient and jet;
20  - <tt>g_inputParam[MACH]</tt>: jet Mach number;
21  - <tt>g_inputParam[TJET]</tt>: jet temperature (only for \c PVTE_LAW EoS).
22 
23  defined in \c pluto.ini.
24  The reference density and length are given by the jet density and radius
25  while the reference velocity is 1 Km/s.
26  The actual numerical values are needed only when using the \c PVTE_LAW EoS.
27 
28  - Configuration #01 uses an \c IDEAL EoS
29  - Configurations #02 and #03 set a highly supersonic molecular jet
30  evolving with the \c PVTE_LAW EoS.
31  The first one adopts the root-finder version while the second one
32  adopts the tabulated version.
33 
34  \image html hd_jet.jpg "Pressure (left) and density (right) maps for configuration #01 at t=15"
35  \author A. Mignone (mignone@ph.unito.it)
36  \date April 13, 2014
37 */
38 /* ///////////////////////////////////////////////////////////////////// */
39 #include "pluto.h"
40 
41 /* ********************************************************************* */
42 void Init (double *v, double x1, double x2, double x3)
43 /*
44  *
45  *********************************************************************** */
46 {
47  double Ta = 50.0; /* Ambient temperature */
48 
49  v[RHO] = g_inputParam[ETA];
50  v[VX1] = 0.0;
51  v[VX2] = 0.0;
52 
53  #if EOS == IDEAL
54  g_gamma = 5.0/3.0;
55  v[PRS] = 1.0/g_gamma;
56  #elif EOS == PVTE_LAW
57  v[PRS] = Pressure(v,Ta);
58  #endif
59 
60 }
61 /* **************************************************************** */
62 void Analysis (const Data *d, Grid *grid)
63 /*
64  *
65  **************************************************************** */
66 { }
67 /* ********************************************************************* */
68 void UserDefBoundary (const Data *d, RBox *box, int side, Grid *grid)
69 /*!
70  * Assign user-defined boundary conditions in the lower boundary ghost
71  * zones. The profile is top-hat:
72  * \f[
73  * V_{ij} = \left\{\begin{array}{ll}
74  * V_{\rm jet} & \quad\mathrm{for}\quad r_i < 1 \\ \noalign{\medskip}
75  * \mathrm{Reflect}(V) & \quad\mathrm{otherwise}
76  * \end{array}\right.
77  * \f]
78  * where \f$ V_{\rm jet} = (\rho,v,p)_{\rm jet} = (1,M,1/\Gamma)\f$ and
79  * \c M is the flow Mach number (the unit velocity is the jet sound speed,
80  * so \f$ v = M\f$).
81  *
82  *********************************************************************** */
83 {
84  int i, j, k, nv;
85  double *x1, *x2, *x3;
86  double cs, Tj, vj[NVAR];
87 
88  x1 = grid[IDIR].xgc; /* -- array pointer to x1 coordinate -- */
89  x2 = grid[JDIR].xgc; /* -- array pointer to x2 coordinate -- */
90  x3 = grid[KDIR].xgc; /* -- array pointer to x3 coordinate -- */
91 
92  vj[RHO] = 1.0;
93  #if EOS == IDEAL
94  vj[PRS] = 1.0/g_gamma; /* -- Pressure-matched jet -- */
95  vj[VX2] = g_inputParam[MACH]; /* -- Sound speed is one in this case -- */
96  #elif EOS == PVTE_LAW
97  Tj = g_inputParam[TJET];
98  vj[PRS] = Pressure(vj,Tj);
99  cs = sqrt(vj[PRS]/vj[RHO]); /* -- For simplicity, isothermal cs is used -- */
100  vj[VX2] = g_inputParam[MACH]*cs;
101  #endif
102 
103  if (side == X2_BEG){ /* -- select the boundary side -- */
104  BOX_LOOP(box,k,j,i){ /* -- Loop over boundary zones -- */
105  if (x1[i] <= 1.0){ /* -- set jet values for r <= 1 -- */
106  d->Vc[RHO][k][j][i] = vj[RHO];
107  d->Vc[VX1][k][j][i] = 0.0;
108  d->Vc[VX2][k][j][i] = vj[VX2];
109  d->Vc[PRS][k][j][i] = vj[PRS];
110  }else{ /* -- reflective boundary for r > 1 --*/
111  VAR_LOOP(nv) d->Vc[nv][k][j][i] = d->Vc[nv][k][2*JBEG-j-1][i];
112  d->Vc[VX2][k][j][i] *= -1.0;
113 /*
114  d->Vc[RHO][k][j][i] = d->Vc[RHO][k][2*JBEG - j - 1][i];
115  d->Vc[VX1][k][j][i] = d->Vc[VX1][k][2*JBEG - j - 1][i];
116  d->Vc[VX2][k][j][i] = -d->Vc[VX2][k][2*JBEG - j - 1][i];
117  d->Vc[PRS][k][j][i] = d->Vc[PRS][k][2*JBEG - j - 1][i];
118 */
119  }
120  }
121  }
122 }
123 
124 #if (BODY_FORCE & VECTOR)
125 /* ********************************************************************* */
126 void BodyForceVector(double *v, double *g, double x1, double x2, double x3)
127 /*!
128  * Prescribe the acceleration vector as a function of the coordinates
129  * and the vector of primitive variables *v.
130  *
131  *********************************************************************** */
132 {
133  g[IDIR] = 0.0;
134  g[JDIR] = 0.0;
135  g[KDIR] = 0.0;
136 }
137 #endif
138 
139 #if (BODY_FORCE & POTENTIAL)
140 /* ********************************************************************* */
141 double BodyForcePotential(double x1, double x2, double x3)
142 /*!
143  * Return the graviational potential as function of the coordinates.
144  *
145  *********************************************************************** */
146 {
147  return 0.0;
148 }
149 #endif
double g_gamma
Definition: globals.h:112
#define MACH
void UserDefBoundary(const Data *d, RBox *box, int side, Grid *grid)
Definition: init.c:98
#define VX2
Definition: mod_defs.h:29
#define RHO
Definition: mod_defs.h:19
#define BOX_LOOP(B, k, j, i)
Definition: macros.h:70
double **** Vc
The main four-index data array used for cell-centered primitive variables.
Definition: structs.h:31
#define TJET
#define VX1
Definition: mod_defs.h:28
#define KDIR
Definition: pluto.h:195
static double Ta
Definition: init.c:136
#define VAR_LOOP(n)
Definition: macros.h:226
#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
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
double Pressure(double *v, double T)
Definition: thermal_eos.c:179
double BodyForcePotential(double x, double y, double z)
Definition: init.c:479
#define ETA
#define X2_BEG
Boundary region at X2 beg.
Definition: pluto.h:148
#define JDIR
Definition: pluto.h:194
long int JBEG
Lower grid index of the computational domain in the the X2 direction for the local processor...
Definition: globals.h:39
#define NVAR
Definition: pluto.h:609
Definition: structs.h:346
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
void BodyForceVector(double *v, double *g, double x, double y, double z)
Definition: init.c:441