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

Go to the source code of this file.

Macros

#define LEFTGOING   YES
 

Functions

void Init (real *us, real x1, real x2, real x3)
 
void Analysis (const Data *d, Grid *grid)
 
void UserDefBoundary (const Data *d, RBox *box, int side, Grid *grid)
 
void USERDEF_BOUNDARY (const Data *d, int side, Grid *grid)
 

Macro Definition Documentation

#define LEFTGOING   YES

Definition at line 3 of 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

Compute volume-integrated magnetic pressure, Maxwell and Reynolds stresses. Save them to "averages.dat"

Definition at line 82 of file init.c.

87 {
88 }
void Init ( real us,
real  x1,
real  x2,
real  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 6 of file init.c.

12 {
13  #if EOS == IDEAL
15  #endif
16 
17 #if LEFTGOING == YES
18  if (x1 < 0.5){
19 
20  us[RHO] = g_inputParam[RHO_LEFT];
21  us[VX1] = g_inputParam[VX_LEFT];
22  us[VX2] = g_inputParam[VY_LEFT];
23  us[VX3] = g_inputParam[VZ_LEFT];
24  us[BX1] = g_inputParam[BX_CONST];
25  us[BX2] = g_inputParam[BY_LEFT];
26  us[BX3] = g_inputParam[BZ_LEFT];
27  #if EOS == IDEAL
28  us[PRS] = g_inputParam[PR_LEFT];
29  #endif
30 
31  }else{
32 
33  us[RHO] = g_inputParam[RHO_RIGHT];
34  us[VX1] = g_inputParam[VX_RIGHT];
35  us[VX2] = g_inputParam[VY_RIGHT];
36  us[VX3] = g_inputParam[VZ_RIGHT];
37  us[BX1] = g_inputParam[BX_CONST];
38  us[BX2] = g_inputParam[BY_RIGHT];
39  us[BX3] = g_inputParam[BZ_RIGHT];
40  #if EOS == IDEAL
41  us[PRS] = g_inputParam[PR_RIGHT];
42  #endif
43  }
44 
45 #else
46 
47  if (x1 > 0.5){
48 
49  us[RHO] = g_inputParam[RHO_LEFT];
50  us[VX1] = -g_inputParam[VX_LEFT];
51  us[VX2] = g_inputParam[VY_LEFT];
52  us[VX3] = g_inputParam[VZ_LEFT];
53  us[BX1] = -g_inputParam[BX_CONST];
54  us[BX2] = g_inputParam[BY_LEFT];
55  us[BX3] = g_inputParam[BZ_LEFT];
56  #if EOS == IDEAL
57  us[PRS] = g_inputParam[PR_LEFT];
58  #endif
59 
60  }else{
61 
62  us[RHO] = g_inputParam[RHO_RIGHT];
63  us[VX1] = -g_inputParam[VX_RIGHT];
64  us[VX2] = g_inputParam[VY_RIGHT];
65  us[VX3] = g_inputParam[VZ_RIGHT];
66  us[BX1] = -g_inputParam[BX_CONST];
67  us[BX2] = g_inputParam[BY_RIGHT];
68  us[BX3] = g_inputParam[BZ_RIGHT];
69  #if EOS == IDEAL
70  us[PRS] = g_inputParam[PR_RIGHT];
71  #endif
72  }
73 #endif
74 
75  if (g_inputParam[DIVIDE_BY_4PI] > 0.5){
76  us[BX1] /= sqrt(4.0*CONST_PI);
77  us[BX2] /= sqrt(4.0*CONST_PI);
78  us[BX3] /= sqrt(4.0*CONST_PI);
79  }
80 }
#define BZ_RIGHT
double g_gamma
Definition: globals.h:112
#define PR_RIGHT
#define VX2
Definition: mod_defs.h:29
#define PR_LEFT
#define RHO
Definition: mod_defs.h:19
#define BY_LEFT
#define VY_RIGHT
#define VX1
Definition: mod_defs.h:28
#define RHO_LEFT
#define RHO_RIGHT
#define VZ_LEFT
#define VY_LEFT
#define BZ_LEFT
double g_inputParam[32]
Array containing the user-defined parameters.
Definition: globals.h:131
#define DIVIDE_BY_4PI
#define BX3
Definition: mod_defs.h:27
#define BX_CONST
#define VX_LEFT
#define VZ_RIGHT
#define GAMMA_EOS
#define BY_RIGHT
#define BX1
Definition: mod_defs.h:25
#define VX3
Definition: mod_defs.h:30
#define CONST_PI
.
Definition: pluto.h:269
#define BX2
Definition: mod_defs.h:26
#define VX_RIGHT
void USERDEF_BOUNDARY ( const Data d,
int  side,
Grid grid 
)

Definition at line 114 of file init.c.

119 {
120 }
void UserDefBoundary ( const Data d,
RBox box,
int  side,
Grid grid 
)

Assign user-defined boundary conditions.

Parameters
[in/out]d pointer 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 on which side boundary conditions need to be assigned. side 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 91 of file init.c.

112 { }