PLUTO
hll_speed.c File Reference

Compute the outermost wave speeds for HLL-based solvers. More...

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

Go to the source code of this file.

Macros

#define DAVIS_ESTIMATE   YES
 
#define EINFELDT_ESTIMATE   NO
 
#define ROE_ESTIMATE   NO
 

Functions

void HLL_Speed (double **vL, double **vR, double *a2L, double *a2R, double *SL, double *SR, int beg, int end)
 

Detailed Description

Compute the outermost wave speeds for HLL-based solvers.

HLL_Speed() computes an estimate to the leftmost and rightmost wave signal speeds bounding the Riemann fan based on the input states ::vR and ::vL. Depending on the estimate, several variants are possible.

Authors
A. Mignone (migno.nosp@m.ne@p.nosp@m.h.uni.nosp@m.to.i.nosp@m.t)
Date
June 6, 2013

Definition in file hll_speed.c.

Macro Definition Documentation

#define DAVIS_ESTIMATE   YES

Definition at line 19 of file hll_speed.c.

#define EINFELDT_ESTIMATE   NO

Definition at line 20 of file hll_speed.c.

#define ROE_ESTIMATE   NO

Definition at line 21 of file hll_speed.c.

Function Documentation

void HLL_Speed ( double **  vL,
double **  vR,
double *  a2L,
double *  a2R,
double *  SL,
double *  SR,
int  beg,
int  end 
)

Compute leftmost (SL) and rightmost (SR) speed for the Riemann fan.

Parameters
[in]vLleft state for the Riemann solver
[in]vRright state for the Riemann solver
[in]a2L1-D array containing the square of the sound speed for the left state
[in]a2R1-D array containing the square of the sound speed for the right state
[out]SLthe (estimated) leftmost speed of the Riemann fan
[out]SRthe (estimated) rightmost speed of the Riemann fan
[in]begstarting index of computation
[in]endfinal index of computation

Switches:

ROE_ESTIMATE (YES/NO), DAVIS_ESTIMATE (YES/NO). TVD_ESTIMATE (YES/NO) JAN_HLL (YES/NO)

These switches set how the wave speed estimates are going to be computed. Only one can be set to 'YES', and the rest of them must be set to 'NO'

ROE_ESTIMATE: b_m = (0, (u_R - c_R, u_L - c_L, u_{roe} - c_{roe})) b_m = (0, (u_R + c_R, u_L + c_L, u_{roe} + c_{roe}))

where u_{roe} and c_{roe} are computed using Roe averages.

DAVIS_ESTIMATE: b_m = (0, (u_R - c_R, u_L - c_L)) b_m = (0, (u_R + c_R, u_L + c_L))

Definition at line 24 of file hll_speed.c.

58 {
59  int i;
60  double scrh, s, c;
61  double aL, dL;
62  double aR, dR;
63  double dvx, dvy, dvz;
64  double a_av, du, vx;
65  static double *sl_min, *sl_max;
66  static double *sr_min, *sr_max;
67 
68  if (sl_min == NULL){
69  sl_min = ARRAY_1D(NMAX_POINT, double);
70  sl_max = ARRAY_1D(NMAX_POINT, double);
71 
72  sr_min = ARRAY_1D(NMAX_POINT, double);
73  sr_max = ARRAY_1D(NMAX_POINT, double);
74  }
75 
76 /* ----------------------------------------------
77  DAVIS Estimate
78  ---------------------------------------------- */
79 
80  #if DAVIS_ESTIMATE == YES
81 
82  MaxSignalSpeed (vL, a2L, sl_min, sl_max, beg, end);
83  MaxSignalSpeed (vR, a2R, sr_min, sr_max, beg, end);
84  for (i = beg; i <= end; i++) {
85 
86  SL[i] = MIN(sl_min[i], sr_min[i]);
87  SR[i] = MAX(sl_max[i], sr_max[i]);
88 
89  aL = sqrt(a2L[i]);
90  aR = sqrt(a2R[i]);
91 
92  scrh = fabs(vL[i][VXn]) + fabs(vR[i][VXn]);
93  scrh /= aL + aR;
94 
95  g_maxMach = MAX(scrh, g_maxMach);
96  }
97 
98  #endif
99 
100 /* ----------------------------------------------
101  Einfeldt Estimate for wave speed
102  ---------------------------------------------- */
103 
104  #if EINFELDT_ESTIMATE == YES
105 
106  for (i = beg; i <= end; i++) {
107 
108  aL = sqrt(a2L[i]);
109  aR = sqrt(a2R[i]);
110 
111  dL = sqrt(vL[i][RHO]);
112  dR = sqrt(vR[i][RHO]);
113  a_av = 0.5*dL*dR/( (dL + dR)*(dL + dR));
114  du = vR[i][VXn] - vL[i][VXn];
115  scrh = (dR*aL*aL + dR*aR*aR)/(dL + dR);
116  scrh += a_av*du*du;
117 
118  SL[i] = (dl*ql[VXn] + dr*qr[VXn])/(dl + dr);
119 
120  bmin = MIN(0.0, um[VXn] - sqrt(scrh));
121  bmax = MAX(0.0, um[VXn] + sqrt(scrh));
122  }
123  #endif
124 
125 /* ----------------------------------------------
126  Roe-like Estimate
127  ---------------------------------------------- */
128 
129  #if ROE_ESTIMATE == YES
130 
131  for (i = beg; i <= end; i++) {
132 
133  aL = sqrt(a2L[i]);
134  aR = sqrt(a2R[i]);
135 
136  s = 1.0/(1.0 + sqrt(vR[i][RHO]/vL[i][RHO]));
137  c = 1.0 - s;
138 
139  vx = s*vL[i][VXn] + c*vR[i][VXn];
140 
141 /* ************************************************************
142  The following definition of the averaged sound speed
143  is equivalent to original formulation given by Roe;
144  here we just simplify the expression without explicitly
145  computing the Enthalpy:
146  ************************************************************ */
147 
148  EXPAND(dvx = vL[i][VX1] - vR[i][VX1]; ,
149  dvy = vL[i][VX2] - vR[i][VX2]; ,
150  dvz = vL[i][VX3] - vR[i][VX3];)
151 
152  scrh = EXPAND(dvx*dvx, + dvy*dvy, + dvz*dvz);
153 
154  a_av = sqrt(s*aL2 + c*aR2 + 0.5*s*c*gmm1*scrh);
155 
156  SL[i] = MIN(vL[i][VXn] - aL, vx - a_av);
157  SR[i] = MAX(vR[i][VXn] + aR, vx + a_av);
158 
159  scrh = (fabs(vL[i][VXn]) + fabs(vR[i][VXn]))/(aL + aR);
160  g_maxMach = MAX(scrh, g_maxMach);
161 
162  }
163  #endif
164 
165 }
#define MAX(a, b)
Definition: macros.h:101
#define VX2
Definition: mod_defs.h:29
#define RHO
Definition: mod_defs.h:19
tuple scrh
Definition: configure.py:200
#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
tuple c
Definition: menu.py:375
int VXn
Definition: globals.h:73
#define s
#define ARRAY_1D(nx, type)
Definition: prototypes.h:170
long int NMAX_POINT
Maximum number of points among the three directions, boundaries excluded.
Definition: globals.h:62
int i
Definition: analysis.c:2
#define VX3
Definition: mod_defs.h:30
void MaxSignalSpeed(double **v, double *cs2, double *cmin, double *cmax, int beg, int end)
Definition: eigenv.c:34

Here is the caller graph for this function: