PLUTO
init.c
Go to the documentation of this file.
1 #include "pluto.h"
2 
3 #define LEFTGOING YES
4 
5 /* ********************************************************************* */
6 void Init (real *us, real x1, real x2, real x3)
7 /*
8  *
9  *
10  *
11  *********************************************************************** */
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 }
81 /* ********************************************************************* */
82 void Analysis (const Data *d, Grid *grid)
83 /*
84  *
85  *
86  *********************************************************************** */
87 {
88 }
89 
90 /* ********************************************************************* */
91 void UserDefBoundary (const Data *d, RBox *box, int side, Grid *grid)
92 /*!
93  * Assign user-defined boundary conditions.
94  *
95  * \param [in/out] d pointer to the PLUTO data structure containing
96  * cell-centered primitive quantities (d->Vc) and
97  * staggered magnetic fields (d->Vs, when used) to
98  * be filled.
99  * \param [in] box pointer to a RBox structure containing the lower
100  * and upper indices of the ghost zone-centers/nodes
101  * or edges at which data values should be assigned.
102  * \param [in] side specifies on which side boundary conditions need
103  * to be assigned. side can assume the following
104  * pre-definite values: X1_BEG, X1_END,
105  * X2_BEG, X2_END,
106  * X3_BEG, X3_END.
107  * The special value side == 0 is used to control
108  * a region inside the computational domain.
109  * \param [in] grid pointer to an array of Grid structures.
110  *
111  *********************************************************************** */
112 { }
113 /* ************************************************************** */
114 void USERDEF_BOUNDARY (const Data *d, int side, Grid *grid)
115 /*
116  *
117  *
118  **************************************************************** */
119 {
120 }
#define BZ_RIGHT
double g_gamma
Definition: globals.h:112
#define PR_RIGHT
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 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
Definition: structs.h:78
double g_inputParam[32]
Array containing the user-defined parameters.
Definition: globals.h:131
void USERDEF_BOUNDARY(const Data *d, int side, Grid *grid)
Definition: init.c:114
#define DIVIDE_BY_4PI
#define BX3
Definition: mod_defs.h:27
PLUTO main header file.
#define BX_CONST
#define VX_LEFT
Definition: structs.h:30
#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
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