PLUTO
ausm.c
Go to the documentation of this file.
1 #include"pluto.h"
2 
3 /* ********************************************************************** */
4 void AUSMp_Solver (const State_1D *state, int beg, int end,
5  real *cmax, Grid *grid)
6 /*!
7  * Solve Riemann problem for the Euler equations using the AUSM+
8  * scheme given in
9  *
10  * "A Sequel to AUSM: AUSM+"
11  * Liou, M.S., JCP (1996), 129, 364
12  *
13  * LAST_MODIFIED
14  *
15  * July 17th 2006, by Andrea Mignone (mignone@to.astro.it)
16  *
17  ************************************************************************ */
18 {
19 #if EOS == IDEAL
20  int i, nv;
21  real aL, ML, MpL, PpL, asL2, asL, atL;
22  real aR, MR, MmR, PmR, asR2, asR, atR;
23  real a, m, p, mp, mm;
24  real *vL, *vR, *uL, *uR;
25  real alpha = 3.0/16.0, beta = 0.125;
26  static real **fl, **fr, **ul, **ur;
27 
28  if (fl == NULL){
29  fl = ARRAY_2D(NMAX_POINT, NFLX, double);
30  fr = ARRAY_2D(NMAX_POINT, NFLX, double);
31  ul = ARRAY_2D(NMAX_POINT, NVAR, double);
32  ur = ARRAY_2D(NMAX_POINT, NVAR, double);
33  }
34 
35  PrimToCons (state->vL, ul, beg, end);
36  PrimToCons (state->vR, ur, beg, end);
37 
38  for (i = beg; i <= end; i++) {
39 
40  vL = state->vL[i];
41  vR = state->vR[i];
42 
43  uL = ul[i];
44  uR = ur[i];
45 
46  aL = sqrt(g_gamma*vL[PRS]/vL[RHO]);
47  aR = sqrt(g_gamma*vR[PRS]/vR[RHO]);
48 
49  asL2 = EXPAND(vL[VX1]*vL[VX1], + vL[VX2]*vL[VX2], + vL[VX3]*vL[VX3]);
50  asL2 = aL*aL/(g_gamma - 1.0) + 0.5*asL2;
51  asL2 *= 2.0*(g_gamma - 1.0)/(g_gamma + 1.0);
52 
53  asR2 = EXPAND(vR[VX1]*vR[VX1], + vR[VX2]*vR[VX2], + vR[VX3]*vR[VX3]);
54  asR2 = aR*aR/(g_gamma - 1.0) + 0.5*asR2;
55  asR2 *= 2.0*(g_gamma - 1.0)/(g_gamma + 1.0);
56 
57  asL = sqrt(asL2);
58  asR = sqrt(asR2);
59 
60  atL = asL2/MAX(asL, fabs(vL[VXn]));
61  atR = asR2/MAX(asR, fabs(vR[VXn]));
62 
63  a = MIN(atL, atR);
64 /*
65  a = 0.5*(aL + aR);
66 */
67  /* --------------------------------------------
68  define split Mach numbers
69  define pressure terms
70  -------------------------------------------- */
71 
72  ML = vL[VXn]/a;
73  if ( fabs(ML) >= 1.0){
74  MpL = 0.5*(ML + fabs(ML));
75  PpL = ML > 0.0 ? 1.0:0.0;
76  }else{
77  MpL = 0.25*(ML + 1.0)*(ML + 1.0) + beta*(ML*ML - 1.0)*(ML*ML - 1.0);
78  PpL = 0.25*(ML + 1.0)*(ML + 1.0)*(2.0 - ML) + alpha*ML*(ML*ML - 1.0)*(ML*ML - 1.0);
79  }
80 
81  MR = vR[VXn]/a;
82  if ( fabs(MR) >= 1.0){
83  MmR = 0.5*(MR - fabs(MR));
84  PmR = MR > 0.0 ? 0.0:1.0;
85  }else{
86  MmR = - 0.25*(MR - 1.0)*(MR - 1.0) - beta*(MR*MR - 1.0)*(MR*MR - 1.0);
87  PmR = 0.25*(MR - 1.0)*(MR - 1.0)*(2.0 + MR) - alpha*MR*(MR*MR - 1.0)*(MR*MR - 1.0);
88  }
89 
90  m = MpL + MmR;
91 
92  mp = 0.5*(m + fabs(m));
93  mm = 0.5*(m - fabs(m));
94 
95  /* -------------------------------------------------------------
96  Compute fluxes
97  ------------------------------------------------------------- */
98 
99  state->press[i] = PpL*vL[PRS] + PmR*vR[PRS];
100  state->flux[i][RHO] = a*(mp*uL[RHO] + mm*uR[RHO]);
101  EXPAND(state->flux[i][MX1] = a*(mp*uL[MX1] + mm*uR[MX1]); ,
102  state->flux[i][MX2] = a*(mp*uL[MX2] + mm*uR[MX2]); ,
103  state->flux[i][MX3] = a*(mp*uL[MX3] + mm*uR[MX3]); )
104  state->flux[i][ENG] = a*(mp*(uL[ENG] + vL[PRS]) + mm*(uR[ENG] + vR[PRS]));
105 
106  /* ---- get max eigenvalue ---- */
107 
108  cmax[i] = MAX(fabs(vL[VXn]) + aL, fabs(vR[VXn]) + aR);
109 
110  g_maxMach = MAX(fabs(ML), g_maxMach);
111  g_maxMach = MAX(fabs(MR), g_maxMach);
112 
113  }
114 #else
115  print1 ("! AUSMp_Solver: not defined for this EOS\n");
116  QUIT_PLUTO(1);
117 #endif /* EOS == IDEAL */
118 }
#define MX3
Definition: mod_defs.h:22
static double alpha
Definition: init.c:3
static double a
Definition: init.c:135
#define MAX(a, b)
Definition: macros.h:101
double g_gamma
Definition: globals.h:112
#define MX1
Definition: mod_defs.h:20
#define VX2
Definition: mod_defs.h:29
double ** flux
upwind flux computed with the Riemann solver
Definition: structs.h:149
double real
Definition: pluto.h:488
void print1(const char *fmt,...)
Definition: amrPluto.cpp:511
#define RHO
Definition: mod_defs.h:19
double ** vR
Primitive variables to the right of the interface, .
Definition: structs.h:139
#define VX1
Definition: mod_defs.h:28
#define MIN(a, b)
Definition: macros.h:104
double g_maxMach
The maximum Mach number computed during integration.
Definition: globals.h:119
#define NFLX
Definition: mod_defs.h:32
Definition: structs.h:78
#define MX2
Definition: mod_defs.h:21
int VXn
Definition: globals.h:73
void AUSMp_Solver(const State_1D *state, int beg, int end, real *cmax, Grid *grid)
Definition: ausm.c:4
PLUTO main header file.
long int NMAX_POINT
Maximum number of points among the three directions, boundaries excluded.
Definition: globals.h:62
void PrimToCons(double **uprim, double **ucons, int ibeg, int iend)
Definition: mappers.c:26
int i
Definition: analysis.c:2
#define VX3
Definition: mod_defs.h:30
double ** vL
Primitive variables to the left of the interface, .
Definition: structs.h:136
double * press
Upwind pressure term computed with the Riemann solver.
Definition: structs.h:164
#define ARRAY_2D(nx, ny, type)
Definition: prototypes.h:171
#define NVAR
Definition: pluto.h:609
#define QUIT_PLUTO(e_code)
Definition: macros.h:125