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 ROE_ESTIMATE   NO
 
#define DAVIS_ESTIMATE   YES
 

Functions

void HLL_Speed (double **vL, double **vR, double *a2L, double *a2R, double **bgf, 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 20 of file hll_speed.c.

#define ROE_ESTIMATE   NO

Definition at line 19 of file hll_speed.c.

Function Documentation

void HLL_Speed ( double **  vL,
double **  vR,
double *  a2L,
double *  a2R,
double **  bgf,
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 23 of file hll_speed.c.

57 {
58  int i;
59  double scrh, s, c;
60  static double *sl_min, *sl_max;
61  static double *sr_min, *sr_max;
62  static double *sm_min, *sm_max;
63  static double **vm;
64 
65  if (sl_min == NULL){
66  vm = ARRAY_2D(NMAX_POINT, NVAR, double);
67  sl_min = ARRAY_1D(NMAX_POINT, double);
68  sl_max = ARRAY_1D(NMAX_POINT, double);
69 
70  sr_min = ARRAY_1D(NMAX_POINT, double);
71  sr_max = ARRAY_1D(NMAX_POINT, double);
72 
73  sm_min = ARRAY_1D(NMAX_POINT, double);
74  sm_max = ARRAY_1D(NMAX_POINT, double);
75  }
76 
77 /* ----------------------------------------------
78  DAVIS Estimate
79  ---------------------------------------------- */
80 
81  #if DAVIS_ESTIMATE == YES
82 
83  MaxSignalSpeed (vL, a2L, sl_min, sl_max, bgf, beg, end);
84  MaxSignalSpeed (vR, a2R, sr_min, sr_max, bgf, beg, end);
85 
86  for (i = beg; i <= end; i++) {
87 
88  SL[i] = MIN(sl_min[i], sr_min[i]);
89  SR[i] = MAX(sl_max[i], sr_max[i]);
90 
91  /* -- define g_maxMach -- */
92 
93  scrh = fabs(vL[i][VXn]) + fabs(vR[i][VXn]);
94  scrh /= sqrt(a2L[i]) + sqrt(a2R[i]);
95 /*
96  #if EOS == IDEAL
97  scrh = fabs(vL[i][VXn]) + fabs(vR[i][VXn]);
98  scrh = scrh/(sqrt(g_gamma*vL[i][PRS]/vL[i][RHO]) + sqrt(g_gamma*vR[i][PRS]/vR[i][RHO]));
99  #elif EOS == ISOTHERMAL
100  scrh = 0.5*( fabs(vL[i][VXn]) + fabs(vR[i][VXn]) )/g_isoSoundSpeed;
101  #elif EOS == BAROTROPIC
102  scrh = 0.5*(fabs(vL[i][VXn]) + fabs(vR[i][VXn]));
103  s = 0.5*(vL[i][RHO] + vR[i][RHO]);
104  c = BAROTROPIC_PR(s);
105  scrh /= sqrt(g_gamma*c/s);
106  #else
107  print ("! HLL_SPEED: not defined for this EoS\n");
108  QUIT_PLUTO(1);
109  #endif
110 */
111  g_maxMach = MAX(scrh, g_maxMach);
112 
113  }
114 
115  #endif
116 
117 /* ----------------------------------------------
118  Roe-like Estimate
119  ---------------------------------------------- */
120 
121  #if ROE_ESTIMATE == YES
122 
123  MaxSignalSpeed (vL, a2L, sl_min, sl_max, bgf, beg, end);
124  MaxSignalSpeed (vR, a2R, sr_min, sr_max, bgf, beg, end);
125 
126  for (i = beg; i <= end; i++) {
127 
128  scrh = sqrt(vR[i][RHO]/vL[i][RHO]);
129  s = 1.0/(1.0 + scrh);
130  c = 1.0 - s;
131 
132  vm[i][RHO] = vL[i][RHO]*scrh;
133  vm[i][VXn] = s*vL[i][VXn] + c*vR[i][VXn];
134 
135  /* ----------------------------------
136  the next definition is not the
137  same as the one given by Roe; it
138  is used here to define the sound
139  speed.
140  ---------------------------------- */
141 
142  #if EOS == IDEAL
143  vm[i][PRS] = s*gpl + c*gpr;
144  #endif
145 
146  /* ---------------------------------------
147  this is the definitions given by
148  Cargo and Gallice, see the Roe
149  Solver
150  --------------------------------------- */
151 
152  EXPAND(vm[i][BXn] = c*vL[i][BXn] + s*vR[i][BXn]; ,
153  vm[i][BXt] = c*vL[i][BXt] + s*vR[i][BXt]; ,
154  vm[i][BXb] = c*vL[i][BXb] + s*vR[i][BXb];)
155 
156  }
157 
158  MAX_CH_SPEED(vm, sm_min, sm_max, bgf, beg, end);
159 
160  for (i = beg; i <= end; i++) {
161  SL[i] = MIN(sl_min[i], sm_min[i]);
162  SR[i] = MAX(sr_max[i], sm_max[i]);
163 
164  /* -- define g_maxMach -- */
165 
166  #if EOS == IDEAL
167  scrh = fabs(vm[i][VXn])/sqrt(vm[i][PRS]/vm[i][RHO]);
168  #elif EOS == ISOTHERMAL
169  scrh = fabs(vm[i][VXn])/g_isoSoundSpeed;
170  #elif EOS == BAROTROPIC
171  print ("! HLL_SPEED: stop\n");
172  QUIT_PLUTO(1);
173  #endif
174  g_maxMach = MAX(scrh, g_maxMach);
175  }
176 
177  #endif
178 }
#define MAX(a, b)
Definition: macros.h:101
#define RHO
Definition: mod_defs.h:19
tuple scrh
Definition: configure.py:200
int BXn
Definition: globals.h:75
#define MIN(a, b)
Definition: macros.h:104
double g_maxMach
The maximum Mach number computed during integration.
Definition: globals.h:119
void print(const char *fmt,...)
Definition: amrPluto.cpp:497
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
void MaxSignalSpeed(double **v, double *cs2, double *cmin, double *cmax, int beg, int end)
Definition: eigenv.c:34
#define ARRAY_2D(nx, ny, type)
Definition: prototypes.h:171
int BXt
Definition: globals.h:75
#define NVAR
Definition: pluto.h:609
int BXb
Definition: globals.h:75
#define QUIT_PLUTO(e_code)
Definition: macros.h:125

Here is the call graph for this function: