PLUTO
ausm_up.c File Reference
#include "pluto.h"
Include dependency graph for ausm_up.c:

Go to the source code of this file.

Functions

void AUSMp_Solver (const State_1D *state, real *cmax, Grid *grid)
 

Function Documentation

void AUSMp_Solver ( const State_1D state,
real cmax,
Grid grid 
)

Definition at line 4 of file ausm_up.c.

21 {
22  int i, nv, beg, end;
23  real aL, asL2, asL, atL, phiL[NFLX];
24  real aR, asR2, asR, atR, phiR[NFLX];
25  real ML, Mp1L, Mp2L, Mm2L, Mp4L, Pp5L;
26  real MR, Mm1R, Mp2R, Mm2R, Mm4R, Pm5R;
27  real a, m;
28  real Ku, Kp, sigma, fa, Mm2, Mo2, Mo, M, scrh;
29  real *vL, *vR, *uL, *uR;
30  real alpha = 3.0/16.0, beta = 0.125;
31  static real **fl, **fr, **ul, **ur;
32 
33 
34  beg = grid[g_dir].lbeg - 1;
35  end = grid[g_dir].lend;
36 
37  if (fl == NULL){
38  fl = array_2D(NMAX_POINT, NFLX);
39  fr = array_2D(NMAX_POINT, NFLX);
40  ul = array_2D(NMAX_POINT, NVAR);
41  ur = array_2D(NMAX_POINT, NVAR);
42  }
43 
44  PrimToCons (state->vL, ul, beg, end);
45  PrimToCons (state->vR, ur, beg, end);
46 
47  Ku = 0.75; Kp = 0.25; sigma = 1.0;
48 
49  for (i = beg; i <= end; i++) {
50 
51  vL = state->vL[i];
52  vR = state->vR[i];
53 
54  uL = ul[i];
55  uR = ur[i];
56 
57  phiL[RHO] = 1.0;
58  EXPAND(phiL[MX1] = vL[VX1]; ,
59  phiL[MX2] = vL[VX2]; ,
60  phiL[MX3] = vL[VX3];)
61  phiL[ENG] = (uL[ENG] - vL[PRS])/vL[RHO];
62 
63  phiR[RHO] = 1.0;
64  EXPAND(phiR[MX1] = vR[VX1]; ,
65  phiR[MX2] = vR[VX2]; ,
66  phiR[MX3] = vR[VX3];)
67  phiR[ENG] = (uR[ENG] - vR[PRS])/vR[RHO];
68 
69 
70  aL = sqrt(g_gamma*vL[PRS]/vL[RHO]);
71  aR = sqrt(g_gamma*vR[PRS]/vR[RHO]);
72 
73  asL2 = EXPAND(vL[VX1]*vL[VX1], + vL[VX2]*vL[VX2], + vL[VX3]*vL[VX3]);
74  asL2 = aL*aL/(g_gamma - 1.0) + 0.5*asL2;
75  asL2 *= 2.0*(g_gamma - 1.0)/(g_gamma + 1.0);
76 
77  asR2 = EXPAND(vR[VX1]*vR[VX1], + vR[VX2]*vR[VX2], + vR[VX3]*vR[VZ);
78  asR2 = aR*aR/(g_gamma - 1.0) + 0.5*asR2;
79  asR2 *= 2.0*(g_gamma - 1.0)/(g_gamma + 1.0);
80 
81  asL = sqrt(asL2);
82  asR = sqrt(asR2);
83 
84  atL = asL2/MAX(asL, fabs(vL[VXn]));
85  atR = asR2/MAX(asR, fabs(vR[VXn]));
86 
87  a = MIN(atL, atR);
88 /*
89  a = 0.5*(aL + aR);
90 */
91 
92 
93  /* --------------------------------------------
94  Compute alpha and beta coeff
95  -------------------------------------------- */
96 
97  Mm2 = 0.5*(vL[VXn]*vL[VXn] + vR[VXn]*vR[VXn])/a/a;
98  Mo2 = MAX(Mm2, 0.4);
99  Mo2 = MIN(1.0, Mo2);
100  Mo = sqrt(Mo2);
101  fa = Mo*(2.0 - Mo);
102 
103  alpha = 3.0/16.0*(-4.0 + 5.0*fa*fa);
104  beta = 1.0/8.0;
105 
106  /* --------------------------------------------
107  define split Mach numbers
108  define pressure terms
109  -------------------------------------------- */
110 
111  ML = vL[VXn]/a;
112  MR = vR[VXn]/a;
113 
114  Mp1L = 0.5*(ML + fabs(ML));
115  Mm1R = 0.5*(MR - fabs(MR));
116 
117  Mp2L = 0.25*(ML + 1.0)*(ML + 1.0);
118  Mm2L = - 0.25*(ML - 1.0)*(ML - 1.0);
119 
120  Mp2R = 0.25*(MR + 1.0)*(MR + 1.0);
121  Mm2R = - 0.25*(MR - 1.0)*(MR - 1.0);
122 
123  if (fabs(ML) >= 1.0){
124  Mp4L = Mp1L;
125  Pp5L = Mp1L/ML;
126  }else{
127  Mp4L = Mp2L*(1.0 - 16.0*beta*Mm2L);
128  Pp5L = Mp2L*((2.0 - ML) - 16.0*alpha*ML*Mm2L);
129  }
130 
131  if (fabs(MR) >= 1.0){
132  Mm4R = Mm1R;
133  Pm5R = Mm1R/MR;
134  }else{
135  Mm4R = Mm2R*(1.0 + 16.0*beta*Mp2R);
136  Pm5R = Mm2R*(( - 2.0 - MR) + 16.0*alpha*MR*Mp2R);
137  }
138 
139  scrh = MAX(1.0 - sigma*Mm2, 0.0);
140 
141  M = Mp4L + Mm4R - Kp/fa*scrh*(vR[PRS] - vL[PRS])/(vL[RHO] + vR[RHO])/a/a*2.0;
142 
143  m = a*M;
144  m *= M > 0.0 ? vL[RHO]: vR[RHO];
145 
146  /* -------------------------------------------------------------
147  Compute fluxes
148  ------------------------------------------------------------- */
149 
150  state->press[i] = Pp5L*vL[PRS] + Pm5R*vR[PRS];
151  state->press[i] -= Ku*Pp5L*Pm5R*(vL[RHO] + vR[RHO])*fa*a*(vR[VXn] - vL[VXn]);
152 
153  if (m > 0.0){
154  for (nv = NFLX; nv--; ) state->flux[i][nv] = m*phiL[nv];
155  }else{
156  for (nv = NFLX; nv--; ) state->flux[i][nv] = m*phiR[nv];
157  }
158 
159  /* ---- get max eigenvalue ---- */
160 
161  *cmax = MAX(*cmax, fabs(vL[VXn]) + aL);
162  *cmax = MAX(*cmax, fabs(vR[VXn]) + aR);
163 
164  g_maxMach = MAX(fabs(ML), g_maxMach);
165  g_maxMach = MAX(fabs(MR), g_maxMach);
166 
167  }
168 }
#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
#define RHO
Definition: mod_defs.h:19
tuple scrh
Definition: configure.py:200
int lend
Local end index for the local array.
Definition: structs.h:118
int lbeg
Local start index for the local array.
Definition: structs.h:117
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
int g_dir
Specifies the current sweep or direction of integration.
Definition: globals.h:86
#define MX2
Definition: mod_defs.h:21
int VXn
Definition: globals.h:73
double ** array_2D(int nx, int ny)
Definition: Turbulence.c:111
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 VZ
Definition: mod_defs.h:102
#define NVAR
Definition: pluto.h:609

Here is the call graph for this function: