37 #define small_rho 1.e-9
41 double *cmax,
Grid *grid)
49 double vxl, taul, cl, *ql;
50 double vxr, taur, cr, *qr;
51 double zs, taus, cs, *qs;
52 double pstar, ustar, rho_star, cstar;
53 double sigma, lambda_s, lambda_star, zeta, dp;
54 double g1_g, scrh1, scrh2, scrh3, scrh4;
55 static double **ws, **us;
56 static double **fL, **fR, *pL, *pR, *a2L, *a2R;
77 for (i = beg; i <= end; i++) {
82 #if SHOCK_FLATTENING == MULTID
86 HLL_Speed (state->
vL, state->
vR, a2L, a2R, &cl - i, &cr - i, i, i);
87 Flux (state->
uL, state->
vL, a2L, fL, pL, i, i);
88 Flux (state->
uR, state->
vR, a2R, fR, pR, i, i);
90 cs =
MAX(fabs(cl), fabs(cr));
94 scrh1 = 1.0/(cr - cl);
95 for (nv =
NFLX; nv--; ){
96 state->
flux[
i][nv] = cl*cr*(uR[nv] - uL[nv])
97 + cr*fL[i][nv] - cl*fR[i][nv];
98 state->
flux[
i][nv] *= scrh1;
100 state->
press[
i] = (cr*pL[
i] - cl*pR[
i])*scrh1;
109 cr = sqrt(
g_gamma*qr[PRS]*qr[RHO]);
116 pstar = qr[PRS] - ql[PRS] - cr*(qr[
VXn] - ql[
VXn]);
117 pstar = ql[PRS] + pstar*cl/(cl + cr);
122 for (iter = 1; iter <=
MAX_ITER; iter++) {
123 vxl = cl*sqrt(1.0 + g1_g*(pstar - ql[PRS])/ql[PRS]);
124 vxr = cr*sqrt(1.0 + g1_g*(pstar - qr[PRS])/qr[PRS]);
127 scrh1 = 2.0*scrh1*vxl/(scrh1 + cl*cl);
130 scrh2 = 2.0*scrh2*vxr/(scrh2 + cr*cr);
132 scrh3 = ql[
VXn] - (pstar - ql[PRS])/vxl;
133 scrh4 = qr[
VXn] + (pstar - qr[PRS])/vxr;
135 dp = scrh1*scrh2/(scrh1 + scrh2)*(scrh4 - scrh3);
152 if (fabs(dp/pstar) < 1.e-6)
break;
163 scrh3 = ql[
VXn] - (pstar - ql[PRS])/vxl;
164 scrh4 = qr[
VXn] + (pstar - qr[PRS])/vxr;
165 ustar = 0.5*(scrh3 + scrh4);
181 rho_star = taus - (pstar - qs[PRS])/(zs*zs);
183 cstar = sqrt(
g_gamma*pstar/rho_star);
184 if (pstar < qs[PRS]){
185 lambda_s = cs - sigma*qs[
VXn];
186 lambda_star = cstar - sigma*ustar;
188 lambda_s = lambda_star = zs*taus - sigma*qs[
VXn];
193 if (lambda_star > 0.0){
195 ws[
i][
RHO] = rho_star;
199 }
else if (lambda_s < 0.0){
203 ws[
i][PRS] = qs[PRS];
207 scrh1 =
MAX(lambda_s - lambda_star, lambda_s + lambda_star);
208 zeta = 0.5*(1.0 + (lambda_s + lambda_star)/scrh1);
210 ws[
i][
RHO] = zeta*rho_star + (1.0 - zeta)*qs[RHO];
211 ws[
i][
VXn] = zeta*ustar + (1.0 - zeta)*qs[
VXn];
212 ws[
i][PRS] = zeta*pstar + (1.0 - zeta)*qs[PRS];
230 scrh1 = fabs(ws[i][
VXn])/cstar;
232 scrh1 = fabs(ws[i][VXn]) + cstar;
237 #ifdef ARTIFICIAL_VISC
239 for (nv = 0; nv <
NFLX; nv++) {
240 state->
flux[
i][nv] += scrh1*(uL[nv] - uR[nv]);
248 print1 (
"! TwoShock_Solver: not defined for this EOS\n");
double ** flux
upwind flux computed with the Riemann solver
void print1(const char *fmt,...)
void Flux(double **u, double **w, double *a2, double **fx, double *p, int beg, int end)
void TwoShock_Solver(const State_1D *state, int beg, int end, double *cmax, Grid *grid)
int g_maxRiemannIter
Maximum number of iterations for iterative Riemann Solver.
double ** vR
Primitive variables to the right of the interface, .
double g_maxMach
The maximum Mach number computed during integration.
double ** uR
same as vR, in conservative vars
#define ARRAY_1D(nx, type)
long int NMAX_POINT
Maximum number of points among the three directions, boundaries excluded.
void PrimToCons(double **uprim, double **ucons, int ibeg, int iend)
void HLL_Speed(double **vL, double **vR, double *a2L, double *a2R, double *SL, double *SR, int beg, int end)
double ** vL
Primitive variables to the left of the interface, .
double * press
Upwind pressure term computed with the Riemann solver.
#define FLAG_HLL
Use HLL Riemann solver.
#define ARRAY_2D(nx, ny, type)
#define QUIT_PLUTO(e_code)
double ** uL
same as vL, in conservative vars