PLUTO
init.c
Go to the documentation of this file.
1 /* ///////////////////////////////////////////////////////////////////// */
2 /*!
3  \file
4  \brief Orszag-Tang MHD vortex.
5 
6  The Orszag Tang vortex system describes a doubly periodic fluid
7  configuration leading to two-dimensional supersonic MHD turbulence.
8  Although an analytical solution is not known, its simple and reproducible
9  set of initial conditions has made it a widespread benchmark for
10  inter-scheme comparison.
11 
12  The computational domain is the periodic box \f$[0,2\pi]^D\f$ where
13  \c D is the number of spatial dimensions.
14  In 2D, the initial condition is given by
15  \f[
16  \vec{v} = \left(-\sin y,\, \sin x, 0\right) \,,\qquad
17  \vec{B} = \left(-\sin y,\, \sin 2x, 0\right) \,,\qquad
18  \rho = 25/9\,,\qquad
19  p = 5/3
20  \f]
21 
22  This test problem does not have any input parameter.
23 
24  A snapshot of the solution on a \c 512x512 grid is shown below.
25 
26  \image html mhd_ot.02.jpg "Density at t=3.1 (configuration #02)."
27 
28  \author A. Mignone (mignone@ph.unito.it)
29  \date April 13, 2014
30 
31  \b References
32  - "Comparison of some Flux Corrected Transport and TVD numerical
33  schemes for hydrodynamic and magnetohydrodynamic problems",
34  Toth & Odstrcil, JCP (1996) 128, 82
35  - "High-order conservative finite difference GLM-MHD schemes for
36  cell-centered MHD", Mignone, Tzeferacos & Bodo, JCP (2010) 229, 5896.
37 */
38 /* ///////////////////////////////////////////////////////////////////// */
39 #include "pluto.h"
40 
41 /* ********************************************************************* */
42 void Init (double *us, double x1, double x2, double x3)
43 /*
44  *
45  *********************************************************************** */
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 }
85 /* ********************************************************************* */
86 void Analysis (const Data *d, Grid *grid)
87 /*
88  *
89  *
90  *********************************************************************** */
91 {
92 }
93 /* ********************************************************************* */
94 void UserDefBoundary (const Data *d, RBox *box, int side, Grid *grid)
95 /*
96  *
97  *
98  *********************************************************************** */
99 {
100 }
void UserDefBoundary(const Data *d, RBox *box, int side, Grid *grid)
Definition: init.c:98
#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
Definition: structs.h:78
#define AX3
Definition: mod_defs.h:87
#define BX3
Definition: mod_defs.h:27
PLUTO main header file.
Definition: structs.h:30
#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
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