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

Go to the source code of this file.

Functions

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

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

90 {
91 
92 }
void BACKGROUND_FIELD ( real  x1,
real  x2,
real  x3,
real B0 
)

Definition at line 95 of file init.c.

112 {
113  B0[0] = 0.0;
114  B0[1] = 0.0;
115  B0[2] = 0.0;
116 }

Here is the caller graph for this function:

void Init ( double *  us,
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 4 of file init.c.

10 {
11  static int first_call = 1;
12  double Bx, By, Bz, B0;
13  double vx, vy, vz, vA;
14  double eta, w, kx, scrh;
15  double c,s;
16 
17  g_gamma = 4.0/3.0;
18 
19  B0 = eta = 1.0;
20  us[RHO] = 1.0;
21  us[PRS] = 1.0;
22 
23  w = us[RHO] + g_gamma*us[PRS]/(g_gamma - 1.0);
24  vA = B0*B0/(w + B0*B0*(1.0 + eta*eta));
25  vA /= 0.5*(1.0 + sqrt(1.0 - 4.0*eta*eta*vA*vA));
26  vA = sqrt(vA);
27 
28  #if DIMENSIONS == 1
29  c = 1.0;
30  s = 0.0;
31  kx = 2.0*CONST_PI*x1;
32  #elif DIMENSIONS == 2
33  c = 1.0/sqrt(2.0);
34  s = 1.0/sqrt(2.0);
35  kx = 2.0*CONST_PI*sqrt(2.0)*(c*x1 + s*x2);
36  #endif
37 
38 /* -------------------------------------------------
39  define 1D solution
40  ------------------------------------------------- */
41 
42  Bx = B0;
43  By = eta*B0*cos(kx);
44  Bz = eta*B0*sin(kx);
45 
46  vx = 0.0;
47  vy = -vA*By/B0;
48  vz = -vA*Bz/B0;
49 
50 /* -------------------------------------------------
51  rotate solution
52  ------------------------------------------------- */
53 
54  us[VX1] = vx*c - vy*s;
55  us[VX2] = vx*s + vy*c;
56  us[VX3] = vz;
57 
58  us[BX1] = Bx*c - By*s;
59  us[BX2] = Bx*s + By*c;
60  us[BX3] = Bz;
61 
62  us[AX1] = 0.0;
63  us[AX2] = 0.0;
64  us[AX3] = B0*((-x1*s + x2*c) - eta*sin(kx)/(2.0*CONST_PI*sqrt(2.0)));
65 
66  if (first_call == 1){
67  print1 ("vA = %18.12e\n",vA);
68  print1 ("T = %18.12e\n",c/vA);
69  first_call = 0;
70  }
71 /*
72 restart;
73 B[t] := eta*B[0]*cos(k*(c*x+s*y));
74 B[x] := B[0]*c - B[t]*s;
75 B[y] := B[0]*s + B[t]*c;
76 
77 A[z]:= B[0]*((-x*s+y*c) - eta*sin(k*(c*x+s*y))/k);
78 simplify( diff(A[z],y) - B[x]);
79 simplify(-diff(A[z],x) - B[y]);
80 */
81 
82 
83 }
double g_gamma
Definition: globals.h:112
#define VX2
Definition: mod_defs.h:29
void print1(const char *fmt,...)
Definition: amrPluto.cpp:511
#define RHO
Definition: mod_defs.h:19
tuple scrh
Definition: configure.py:200
static double *** eta[3]
Definition: res_functions.c:94
#define AX2
Definition: mod_defs.h:86
#define VX1
Definition: mod_defs.h:28
#define AX3
Definition: mod_defs.h:87
static double Bx
Definition: hlld.c:62
tuple c
Definition: menu.py:375
#define s
#define BX3
Definition: mod_defs.h:27
#define AX1
Definition: mod_defs.h:85
#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

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

141 { }