PLUTO
init.c File Reference

Hydrodynamics blast wave problem. More...

#include "pluto.h"
Include dependency graph for init.c:

Go to the source code of this file.

Functions

void Init (double *v, 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

Hydrodynamics blast wave problem.

Set up an isothermal blast wave in a non-uniform, randomnly perturbed density field. The background perturbation is interpolated read from an input file generated externally.

Authors
A. Mignone (migno.nosp@m.ne@p.nosp@m.h.uni.nosp@m.to.i.nosp@m.t)
P. Tzeferacos (petro.nosp@m.s.tz.nosp@m.efera.nosp@m.cos@.nosp@m.ph.un.nosp@m.ito..nosp@m.it)
Date
May 06, 2014

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

84 {
85 
86 }
void Init ( double *  v,
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 19 of file init.c.

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 }
double g_gamma
Definition: globals.h:112
#define VX2
Definition: mod_defs.h:29
#define RHO_IN
#define RHO
Definition: mod_defs.h:19
#define VX1
Definition: mod_defs.h:28
void InputDataInterpolate(double *vs, double x1, double x2, double x3)
Definition: input_data.c:287
void InputDataRead(char *data_fname, char *endianity)
Definition: input_data.c:191
double g_inputParam[32]
Array containing the user-defined parameters.
Definition: globals.h:131
int k
Definition: analysis.c:2
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
void InputDataSet(char *grid_fname, int *get_var)
Definition: input_data.c:54
#define VX3
Definition: mod_defs.h:30
#define PRS_IN

Here is the call graph for this function:

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.

Definition at line 89 of file init.c.

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
DOM_LOOP(k, j, i)
Definition: analysis.c:22
double real
Definition: pluto.h:488
#define X3_END_LOOP(k, j, i)
Definition: macros.h:52
#define X1_END
Boundary region at X1 end.
Definition: pluto.h:147
#define X2_BEG_LOOP(k, j, i)
Definition: macros.h:47
#define KDIR
Definition: pluto.h:195
#define X2_END_LOOP(k, j, i)
Definition: macros.h:51
#define IDIR
Definition: pluto.h:193
#define X2_END
Boundary region at X2 end.
Definition: pluto.h:149
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
#define X1_BEG_LOOP(k, j, i)
Definition: macros.h:46
int i
Definition: analysis.c:2
#define X2_BEG
Boundary region at X2 beg.
Definition: pluto.h:148
#define JDIR
Definition: pluto.h:194
#define X3_BEG_LOOP(k, j, i)
Definition: macros.h:48

Here is the call graph for this function: