PLUTO
fluxes.c File Reference

Compute the RMHD flux. More...

#include "pluto.h"
Include dependency graph for fluxes.c:

Go to the source code of this file.

Functions

void Flux (double **ucons, double **uprim, double *h, double **fx, real *pr, int beg, int end)
 

Detailed Description

Compute the RMHD flux.

Compute the flux of the conservative RMHD equations in the direction given by g_dir. This function defines the component of the hyperbolic flux tensor of the standard MHD equations.
In what follows:

  • VXn, MXn, BXn are the velocity, momentum and magnetic field components in the direction given by g_dir (normal, "n")
  • VXt, MXt, BXt and VXb, MXb, BXb are the transverse components (tangent "t" and bi-tangent "b").
Author
A. Mignone (migno.nosp@m.ne@p.nosp@m.h.uni.nosp@m.to.i.nosp@m.t)
Date
Jun 10, 2015

Definition in file fluxes.c.

Function Documentation

void Flux ( double **  ucons,
double **  uprim,
double *  h,
double **  fx,
real pr,
int  beg,
int  end 
)
Parameters
[in]u1D array of conserved quantities
[in]w1D array of primitive quantities
[in]a21D array of sound speeds
[out]fx1D array of fluxes (total pressure excluded)
[out]p1D array of pressure values
[in]beginitial index of computation
[in]endfinal index of computation
Returns
This function has no return value.

Definition at line 23 of file fluxes.c.

30 {
31  int nv, i;
32  double vB, uB, b2, wt, wtg2, Bmag2, pt;
33  double *u, *v, b[4], g, g2, g_2;
34 
35  for (i = beg; i <= end; i++) {
36 
37  u = ucons[i];
38  v = uprim[i];
39 
40  g = u[RHO]/v[RHO];
41  g2 = g*g;
42  g_2 = 1.0/g2;
43 
44  Bmag2 = EXPAND(v[BX1]*v[BX1], + v[BX2]*v[BX2], + v[BX3]*v[BX3]);
45 
46  vB = EXPAND(v[VX1]*v[BX1], + v[VX2]*v[BX2], + v[VX3]*v[BX3]);
47  EXPAND(b[IDIR] = g*(v[BX1]*g_2 + vB*v[VX1]); ,
48  b[JDIR] = g*(v[BX2]*g_2 + vB*v[VX2]); ,
49  b[KDIR] = g*(v[BX3]*g_2 + vB*v[VX3]);)
50  b2 = Bmag2*g_2 + vB*vB;
51 
52  pt = v[PRS] + 0.5*b2;
53  wt = v[RHO]*h[i] + b2;
54  wtg2 = wt*g2;
55 
56  fx[i][RHO] = u[RHO]*v[VXn];
57  EXPAND(fx[i][MX1] = wtg2*v[VX1]*v[VXn] - b[IDIR]*b[g_dir]; ,
58  fx[i][MX2] = wtg2*v[VX2]*v[VXn] - b[JDIR]*b[g_dir]; ,
59  fx[i][MX3] = wtg2*v[VX3]*v[VXn] - b[KDIR]*b[g_dir];)
60  EXPAND(fx[i][BXn] = 0.0; ,
61  fx[i][BXt] = v[VXn]*v[BXt] - v[BXn]*v[VXt]; ,
62  fx[i][BXb] = v[VXn]*v[BXb] - v[BXn]*v[VXb]; )
63 
64  fx[i][ENG] = u[MXn];
65  #if RMHD_REDUCED_ENERGY
66  fx[i][ENG] -= fx[i][RHO];
67  #endif
68 
69  pr[i] = pt;
70 
71 #ifdef GLM_MHD
72  fx[i][BXn] = v[PSI_GLM];
73  fx[i][PSI_GLM] = glm_ch*glm_ch*v[BXn];
74 #endif
75 
76  }
77 }
#define MX3
Definition: mod_defs.h:22
#define MX1
Definition: mod_defs.h:20
#define VX2
Definition: mod_defs.h:29
#define RHO
Definition: mod_defs.h:19
#define PSI_GLM
Definition: mod_defs.h:34
double v[NVAR]
Definition: eos.h:106
#define VX1
Definition: mod_defs.h:28
#define KDIR
Definition: pluto.h:195
int VXb
Definition: globals.h:73
int BXn
Definition: globals.h:75
#define IDIR
Definition: pluto.h:193
int g_dir
Specifies the current sweep or direction of integration.
Definition: globals.h:86
#define MX2
Definition: mod_defs.h:21
int VXt
Definition: globals.h:73
int MXn
Definition: globals.h:74
int VXn
Definition: globals.h:73
#define BX3
Definition: mod_defs.h:27
int i
Definition: analysis.c:2
#define BX1
Definition: mod_defs.h:25
#define VX3
Definition: mod_defs.h:30
#define BX2
Definition: mod_defs.h:26
double glm_ch
The propagation speed of divergence error.
Definition: glm.c:21
#define JDIR
Definition: pluto.h:194
int BXt
Definition: globals.h:75
int BXb
Definition: globals.h:75