PLUTO
hll.c File Reference

HLL Riemann solver for HD. More...

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

Go to the source code of this file.

Functions

void HLL_Solver (const State_1D *state, int beg, int end, double *cmax, Grid *grid)
 

Detailed Description

HLL Riemann solver for HD.

Solve the Riemann problem for the HD equations using the single-state HLL solver by Toro.

On input, this function takes left and right primitive state vectors state->vL and state->vR at zone edge i+1/2; On output, return flux and pressure vectors at the same interface i+1/2 (note that the i refers to i+1/2).

Also during this step, compute maximum wave propagation speed (cmax) for explicit time step computation.

Reference:

  • "Riemann Solver and Numerical Methods for Fluid Dynamics" by E.F. Toro (Chapter 10)
  • "On Godunov-Type Method near Low Densities" by B. Einfeldt, C.D. Munz, P.L. Roe, JCP 92, 273-295 (1991)
Authors
A. Mignone (migno.nosp@m.ne@p.nosp@m.h.uni.nosp@m.to.i.nosp@m.t)
Date
March 23, 2012

Definition in file hll.c.

Function Documentation

void HLL_Solver ( const State_1D state,
int  beg,
int  end,
double *  cmax,
Grid grid 
)

Solve Riemann problem for the adiabatic/isothermal MHD equations using the HLL Riemann solver.

Parameters
[in,out]statepointer to State_1D structure
[in]beginitial grid index
[out]endfinal grid index
[out]cmax1D array of maximum characteristic speeds
[in]gridpointer to array of Grid structures.

Definition at line 30 of file hll.c.

43 {
44  int nv, i;
45  double scrh;
46  static double *pL, *pR, *SL, *SR, *a2L, *a2R;
47  static double **fL, **fR;
48  double *uR, *uL;
49  double bmax, bmin, *vL, *vR, aL, aR;
50 
51 /* -- Allocate memory -- */
52 
53  if (fL == NULL){
54  fL = ARRAY_2D(NMAX_POINT, NFLX, double);
55  fR = ARRAY_2D(NMAX_POINT, NFLX, double);
56 
57  pR = ARRAY_1D(NMAX_POINT, double);
58  pL = ARRAY_1D(NMAX_POINT, double);
59  SR = ARRAY_1D(NMAX_POINT, double);
60  SL = ARRAY_1D(NMAX_POINT, double);
61 
62  a2R = ARRAY_1D(NMAX_POINT, double);
63  a2L = ARRAY_1D(NMAX_POINT, double);
64  }
65 
66 /* ----------------------------------------------------
67  compute sound speed & fluxes at zone interfaces
68  ---------------------------------------------------- */
69 
70  SoundSpeed2 (state->vL, a2L, NULL, beg, end, FACE_CENTER, grid);
71  SoundSpeed2 (state->vR, a2R, NULL, beg, end, FACE_CENTER, grid);
72 
73  Flux (state->uL, state->vL, a2L, fL, pL, beg, end);
74  Flux (state->uR, state->vR, a2R, fR, pR, beg, end);
75 
76  HLL_Speed (state->vL, state->vR, a2L, a2R, SL, SR, beg, end);
77  for (i = beg; i <= end; i++) {
78 
79  scrh = MAX(fabs(SL[i]), fabs(SR[i]));
80  cmax[i] = scrh;
81 
82  if (SL[i] > 0.0){
83 
84  for (nv = NFLX; nv--; ) state->flux[i][nv] = fL[i][nv];
85  state->press[i] = pL[i];
86 
87  }else if (SR[i] < 0.0){
88 
89  for (nv = NFLX; nv--; ) state->flux[i][nv] = fR[i][nv];
90  state->press[i] = pR[i];
91 
92  }else{
93 
94  uR = state->uR[i];
95  uL = state->uL[i];
96 
97  scrh = 1.0 / (SR[i] - SL[i]);
98  for (nv = NFLX; nv--; ) {
99  state->flux[i][nv] = SL[i]*SR[i]*(uR[nv] - uL[nv]) +
100  SR[i]*fL[i][nv] - SL[i]*fR[i][nv];
101  state->flux[i][nv] *= scrh;
102  }
103  state->press[i] = (SR[i]*pL[i] - SL[i]*pR[i])*scrh;
104 
105  }
106  } /* end loops on points */
107 }
#define MAX(a, b)
Definition: macros.h:101
double ** flux
upwind flux computed with the Riemann solver
Definition: structs.h:149
void Flux(double **u, double **w, double *a2, double **fx, double *p, int beg, int end)
Definition: fluxes.c:23
tuple scrh
Definition: configure.py:200
double ** vR
Primitive variables to the right of the interface, .
Definition: structs.h:139
void SoundSpeed2(double **v, double *cs2, double *h, int beg, int end, int pos, Grid *grid)
Definition: eos.c:16
#define NFLX
Definition: mod_defs.h:32
#define FACE_CENTER
Definition: pluto.h:206
double ** uR
same as vR, in conservative vars
Definition: structs.h:145
#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 HLL_Speed(double **vL, double **vR, double *a2L, double *a2R, double *SL, double *SR, int beg, int end)
Definition: hll_speed.c:24
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
double ** uL
same as vL, in conservative vars
Definition: structs.h:144

Here is the call graph for this function: