PLUTO
fargo_source.c
Go to the documentation of this file.
1 /* ///////////////////////////////////////////////////////////////////// */
2 /*!
3  \file
4  \brief Add source terms before the FARGO advection step.
5 
6  This function is called prior to the FARGO advection algorithm to add
7  source terms.
8  At present, we use it only for the energy equation in the
9  ShearingBox module:
10  \f[
11  \pd{E'}{t} + w\pd{E'}{y} = (B_xB_y - \rho v_xv'_y)\pd{w}{x}
12  \f]
13  where \f$w = -q\Omega x\f$.
14  The discretization follows the algorithm of [GS10], see
15  Eq. (51) and (63) of that paper.
16 
17  \b Reference
18  - [GS10] "Implementation of the shearing box approximation in Athena",
19  Stone & Gardiner, ApJS (2010) 189, 142.
20 
21  \author A. Mignone (mignone@ph.unito.it)
22  \date Aug 26, 2015
23 */
24 /* ///////////////////////////////////////////////////////////////////// */
25 #include "pluto.h"
26 
27 /* ********************************************************************* */
28 void FARGO_Source(Data_Arr UU, double dt, Grid *grid)
29 /*!
30  *
31  * \param [in,out] UU an array of conserved variables
32  * \param [in] dt the current time increment
33  * \param [in] grid pointer to an array of Grid structures
34  *********************************************************************** */
35 {
36 #if (HAVE_ENERGY) && (defined SHEARINGBOX)
37  int i,j,k;
38  double scrh, rho, mx, my, Bx, By;
39 
40  scrh = SB_Q*SB_OMEGA;
41  DOM_LOOP(k,j,i){
42  rho = UU[k][j][i][RHO];
43  mx = UU[k][j][i][MX1];
44  my = UU[k][j][i][MX2];
45  Bx = UU[k][j][i][BX1];
46  By = UU[k][j][i][BX2];
47 
48  UU[k][j][i][ENG] += - dt*scrh*Bx*(By - 0.5*dt*Bx*scrh)
49  + dt*scrh*mx*my/rho;
50  }
51 #endif
52 }
#define MX1
Definition: mod_defs.h:20
double **** Data_Arr
Definition: pluto.h:492
DOM_LOOP(k, j, i)
Definition: analysis.c:22
void FARGO_Source(Data_Arr UU, double dt, Grid *grid)
Definition: fargo_source.c:28
#define RHO
Definition: mod_defs.h:19
tuple scrh
Definition: configure.py:200
Definition: structs.h:78
static double Bx
Definition: hlld.c:62
#define SB_OMEGA
Disk local orbital frequency .
Definition: shearingbox.h:81
int j
Definition: analysis.c:2
#define MX2
Definition: mod_defs.h:21
int k
Definition: analysis.c:2
#define SB_Q
The shear parameter, .
Definition: shearingbox.h:76
PLUTO main header file.
int i
Definition: analysis.c:2
#define BX1
Definition: mod_defs.h:25
#define BX2
Definition: mod_defs.h:26