PLUTO
init.c File Reference

Orszag-Tang MHD vortex. More...

#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 UserDefBoundary (const Data *d, RBox *box, int side, Grid *grid)
 

Detailed Description

Orszag-Tang MHD vortex.

The Orszag Tang vortex system describes a doubly periodic fluid configuration leading to two-dimensional supersonic MHD turbulence. Although an analytical solution is not known, its simple and reproducible set of initial conditions has made it a widespread benchmark for inter-scheme comparison.

The computational domain is the periodic box $[0,2\pi]^D$ where D is the number of spatial dimensions. In 2D, the initial condition is given by

\[ \vec{v} = \left(-\sin y,\, \sin x, 0\right) \,,\qquad \vec{B} = \left(-\sin y,\, \sin 2x, 0\right) \,,\qquad \rho = 25/9\,,\qquad p = 5/3 \]

This test problem does not have any input parameter.

A snapshot of the solution on a 512x512 grid is shown below.

mhd_ot.02.jpg
Density at t=3.1 (configuration #02).
Author
A. Mignone (migno.nosp@m.ne@p.nosp@m.h.uni.nosp@m.to.i.nosp@m.t)
Date
April 13, 2014

References

  • "Comparison of some Flux Corrected Transport and TVD numerical schemes for hydrodynamic and magnetohydrodynamic problems", Toth & Odstrcil, JCP (1996) 128, 82
  • "High-order conservative finite difference GLM-MHD schemes for cell-centered MHD", Mignone, Tzeferacos & Bodo, JCP (2010) 229, 5896.

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

91 {
92 }
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 42 of file init.c.

46 {
47  double x=x1, y=x2 ,z=x3;
48 
49  us[VX1] = - sin(y);
50  us[VX2] = sin(x);
51  us[VX3] = 0.0;
52  us[BX1] = - sin(y);
53  us[BX2] = sin(2.0*x);
54  us[BX3] = 0.0;
55  us[RHO] = 25./9.;
56  #if EOS != ISOTHERMAL && EOS != BAROTROPIC
57  us[PRS] = 5.0/3.0;
58  #endif
59  us[TRC] = (y>CONST_PI)*1.0;
60 
61  us[AX1] = 0.0;
62  us[AX2] = 0.0;
63  us[AX3] = cos(y) + 0.5*cos(2.0*x);
64 
65  #if DIMENSIONS == 3
66  {
67  double c0 = 0.8;
68  us[VX2] = - sin(z);
69  us[VX3] = sin(y);
70  us[VX1] = 0.0;
71 
72  us[BX2] = c0*( - 2.0*sin(2.0*z) + sin(x));
73  us[BX3] = c0*( sin(x) + sin(y));
74  us[BX1] = c0*( sin(y) + sin(z));
75  us[RHO] = 25./9.;
76  us[PRS] = 5.0/3.0;
77 
78  us[AX2] = c0*( cos(z) - cos(x));
79  us[AX3] = c0*(-cos(y) + cos(x));
80  us[AX1] = c0*( cos(y) + cos(2.0*z));
81 
82  }
83  #endif
84 }
#define VX2
Definition: mod_defs.h:29
#define RHO
Definition: mod_defs.h:19
#define AX2
Definition: mod_defs.h:86
#define TRC
Definition: pluto.h:581
#define VX1
Definition: mod_defs.h:28
#define AX3
Definition: mod_defs.h:87
double * x
Definition: structs.h:80
#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
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.

Assign user-defined boundary conditions in the lower boundary ghost zones. The profile is top-hat:

\[ V_{ij} = \left\{\begin{array}{ll} V_{\rm jet} & \quad\mathrm{for}\quad r_i < 1 \\ \noalign{\medskip} \mathrm{Reflect}(V) & \quad\mathrm{otherwise} \end{array}\right. \]

where $ V_{\rm jet} = (\rho,v,p)_{\rm jet} = (1,M,1/\Gamma)$ and M is the flow Mach number (the unit velocity is the jet sound speed, so $ v = M$).

Assign user-defined boundary conditions:

  • left side (x beg): constant shocked values
  • bottom side (y beg): constant shocked values for x < 1/6 and reflective boundary otherwise.
  • top side (y end): time-dependent boundary: for $ x < x_s(t) = 10 t/\sin\alpha + 1/6 + 1.0/\tan\alpha $ we use fixed (post-shock) values. Unperturbed values otherwise.

Assign user-defined boundary conditions at inner and outer radial boundaries. Reflective conditions are applied except for the azimuthal velocity which is fixed.

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.

Set the injection boundary condition at the lower z-boundary (X2-beg must be set to userdef in pluto.ini). For $ R \le 1 $ we set constant input values (given by the GetJetValues() function while for $ R > 1 $ the solution has equatorial symmetry with respect to the z=0 plane. To avoid numerical problems with a "top-hat" discontinuous jump, we smoothly merge the inlet and reflected value using a profile function Profile().

Definition at line 94 of file init.c.

99 {
100 }