PLUTO
init.c
Go to the documentation of this file.
1 /* ///////////////////////////////////////////////////////////////////// */
2 /*!
3  \file
4  \brief Hydrodynamics blast wave problem.
5 
6  Set up an isothermal blast wave in a non-uniform, randomnly
7  perturbed density field.
8  The background perturbation is interpolated read from an input
9  file generated externally.
10 
11  \authors A. Mignone (mignone@ph.unito.it)\n
12  P. Tzeferacos (petros.tzeferacos@ph.unito.it)
13  \date May 06, 2014
14 */
15 /* ///////////////////////////////////////////////////////////////////// */
16 #include "pluto.h"
17 
18 /* ********************************************************************* */
19 void Init (double *v, double x1, double x2, double x3)
20 /*!
21  *
22  *********************************************************************** */
23 {
24  static int first_call = 1;
25  double r;
26 
27  #if GEOMETRY == CARTESIAN
28  r = D_EXPAND(x1*x1, + x2*x2, + x3*x3);
29  r = sqrt(r);
30  #elif GEOMETRY == POLAR
31  r = x1;
32  #endif
33 
34  v[RHO] = 1.0;
35 
36  #if ADD_TURBULENCE == YES
37  if (first_call){
38  int k, input_var[256];
39 
40  input_var[0] = RHO;
41  input_var[1] = -1;
42  InputDataSet ("./grid0.out",input_var);
43  InputDataRead("./rho0.dbl"," ");
44  first_call = 0;
45  }
46  InputDataInterpolate(v, x1, x2, x3); /* -- interpolate density from
47  input data file -- */
48  #endif
49 
50  #if EOS == IDEAL
51  v[PRS] = 1.0/g_gamma; /* ambient pressure */
52  #elif EOS == PVTE_LAW
53  v[PRS] = 1.0;
54  #endif
55 
56 /* -- set a high pressure region inside r = 1 -- */
57 
58  if (r < 0.1) {
59  v[RHO] = g_inputParam[RHO_IN];
60  #if HAVE_ENERGY
61  v[PRS] = g_inputParam[PRS_IN];
62  #endif
63  }
64 
65  v[VX1] = 0.0;
66  v[VX2] = 0.0;
67  v[VX3] = 0.0;
68 
69 }
70 /* **************************************************************** */
71 void Analysis (const Data *d, Grid *grid)
72 /*
73  *
74  * PURPOSE
75  *
76  * Perform some pre-processing data
77  *
78  * ARGUMENTS
79  *
80  * d: the PLUTO Data structure.
81  * grid: pointer to array of GRID structures
82  *
83  **************************************************************** */
84 {
85 
86 }
87 
88 /* ************************************************************** */
89 void UserDefBoundary (const Data *d, RBox *box, int side, Grid *grid)
90 /*
91  *
92  *
93  **************************************************************** */
94 {
95  int i, j, k, nv;
96  real *x1, *x2, *x3;
97 
98  x1 = grid[IDIR].x;
99  x2 = grid[JDIR].x;
100  x3 = grid[KDIR].x;
101 
102  if (side == 0) { /* -- check solution inside domain -- */
103  DOM_LOOP(k,j,i){};
104  }
105 
106  if (side == X1_BEG){ /* -- X1_BEG boundary -- */
107  X1_BEG_LOOP(k,j,i){}
108  }
109 
110  if (side == X1_END){ /* -- X1_END boundary -- */
111  X1_END_LOOP(k,j,i){}
112  }
113 
114  if (side == X2_BEG){ /* -- X2_BEG boundary -- */
115  X2_BEG_LOOP(k,j,i){}
116  }
117 
118  if (side == X2_END){ /* -- X2_END boundary -- */
119  X2_END_LOOP(k,j,i){}
120  }
121 
122  if (side == X3_BEG){ /* -- X3_BEG boundary -- */
123  X3_BEG_LOOP(k,j,i){}
124  }
125 
126  if (side == X3_END) { /* -- X3_END boundary -- */
127  X3_END_LOOP(k,j,i){}
128  }
129 }
#define X3_BEG
Boundary region at X3 beg.
Definition: pluto.h:150
#define X1_BEG
Boundary region at X1 beg.
Definition: pluto.h:146
double g_gamma
Definition: globals.h:112
void UserDefBoundary(const Data *d, RBox *box, int side, Grid *grid)
Definition: init.c:98
DOM_LOOP(k, j, i)
Definition: analysis.c:22
#define VX2
Definition: mod_defs.h:29
#define RHO_IN
double real
Definition: pluto.h:488
#define RHO
Definition: mod_defs.h:19
#define X3_END_LOOP(k, j, i)
Definition: macros.h:52
#define X1_END
Boundary region at X1 end.
Definition: pluto.h:147
#define VX1
Definition: mod_defs.h:28
#define X2_BEG_LOOP(k, j, i)
Definition: macros.h:47
void InputDataInterpolate(double *vs, double x1, double x2, double x3)
Definition: input_data.c:287
#define KDIR
Definition: pluto.h:195
#define X2_END_LOOP(k, j, i)
Definition: macros.h:51
void InputDataRead(char *data_fname, char *endianity)
Definition: input_data.c:191
#define IDIR
Definition: pluto.h:193
#define X2_END
Boundary region at X2 end.
Definition: pluto.h:149
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 * x
Definition: structs.h:80
#define X1_END_LOOP(k, j, i)
Definition: macros.h:50
#define X3_END
Boundary region at X3 end.
Definition: pluto.h:151
PLUTO main header file.
D_EXPAND(tot/[n]=(double) grid[IDIR].np_int_glob;, tot/[n]=(double) grid[JDIR].np_int_glob;, tot/[n]=(double) grid[KDIR].np_int_glob;)
Definition: analysis.c:27
#define X1_BEG_LOOP(k, j, i)
Definition: macros.h:46
Definition: structs.h:30
int i
Definition: analysis.c:2
void InputDataSet(char *grid_fname, int *get_var)
Definition: input_data.c:54
#define VX3
Definition: mod_defs.h:30
#define X2_BEG
Boundary region at X2 beg.
Definition: pluto.h:148
#define PRS_IN
#define JDIR
Definition: pluto.h:194
Definition: structs.h:346
#define X3_BEG_LOOP(k, j, i)
Definition: macros.h:48
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