33 double *cmax,
Grid *grid)
49 double vBl, usl[
NFLX];
50 double vBr, usr[
NFLX];
52 double Bxs, Bys, Bzs, ps, vBs;
53 double vxl, vxr, vxs, vys, vzs;
54 double Fhll[
NFLX], alpha_l, alpha_r;
55 double **bgf, *vL, *vR, *uL, *uR, *SL, *SR;
56 static double **fL, **fR, **Uhll;
57 static double **VL, **VR, **UL, **UR;
58 static double *pL, *pR, *a2L, *a2R;
76 #if BACKGROUND_FIELD == YES
77 print (
"! Background field splitting not allowed with HLLC solver\n");
82 GLM_Solve (state, VL, VR, beg, end, grid);
86 VL = state->
vL; UL = state->
uL;
87 VR = state->
vR; UR = state->
uR;
97 Flux (UL, VL, a2L, bgf, fL, pL, beg, end);
98 Flux (UR, VR, a2R, bgf, fR, pR, beg, end);
104 SL = state->
SL; SR = state->
SR;
105 HLL_Speed (VL, VR, a2L, a2R, bgf, SL, SR, beg, end);
107 for (i = beg; i <= end; i++) {
109 scrh =
MAX(fabs(SL[i]), fabs(SR[i]));
118 for (nv = 0; nv <
NFLX; nv++) {
119 state->
flux[
i][nv] = fL[
i][nv];
123 }
else if (SR[i] <= 0.0){
125 for (nv = 0; nv <
NFLX; nv++) {
126 state->
flux[
i][nv] = fR[
i][nv];
132 vL = VL[
i]; uL = UL[
i];
133 vR = VR[
i]; uR = UR[
i];
137 scrh = 1.0/(SR[
i] - SL[
i]);
138 for (nv = 0; nv <
NFLX; nv++){
139 Uhll[
i][nv] = SR[
i]*uR[nv] - SL[
i]*uL[nv]
140 + fL[
i][nv] - fR[
i][nv];
143 Fhll[nv] = SL[
i]*SR[
i]*(uR[nv] - uL[nv])
144 + SR[i]*fL[i][nv] - SL[i]*fR[i][nv];
147 Uhll[
i][
MXn] += (pL[
i] - pR[
i])*scrh;
148 Fhll[
MXn] += (SR[
i]*pL[
i] - SL[
i]*pR[
i])*scrh;
150 #if SHOCK_FLATTENING == MULTID
152 for (nv = NFLX; nv--; ){
153 state->
flux[
i][nv] = SL[
i]*SR[
i]*(uR[nv] - uL[nv])
154 + SR[i]*fL[i][nv] - SL[i]*fR[i][nv];
157 state->
press[
i] = (SR[
i]*pL[
i] - SL[
i]*pR[
i])*scrh;
167 pl = vL[PRS] + 0.5*pl;
168 pr = vR[PRS] + 0.5*pr;
178 EXPAND(Bxs = Uhll[i][
BXn]; ,
179 Bys = Uhll[
i][
BXt]; ,
184 vxs = Uhll[i][
MXn]/Uhll[i][
RHO];
185 ps = Fhll[
MXn] + Bxs*Bxs - Fhll[
RHO]*vxs;
189 vBs = EXPAND(Uhll[i][
BX1]*Uhll[i][
MX1], +
190 Uhll[i][
BX2]*Uhll[i][
MX2], +
191 Uhll[i][
BX3]*Uhll[i][
MX3]);
195 usl[
RHO] = uL[
RHO]*(SL[
i] - vxl)/(SL[i] - vxs);
196 usr[
RHO] = uR[
RHO]*(SR[
i] - vxr)/(SR[i] - vxs);
198 usl[ENG] = (uL[ENG]*(SL[
i] - vxl) +
199 ps*vxs - pl*vxl - Bxs*vBs + vL[
BXn]*vBl)/(SL[
i] - vxs);
200 usr[ENG] = (uR[ENG]*(SR[
i] - vxr) +
201 ps*vxs - pr*vxr - Bxs*vBs + vR[
BXn]*vBr)/(SR[
i] - vxs);
203 EXPAND(usl[
MXn] = usl[
RHO]*vxs;
204 usr[
MXn] = usr[
RHO]*vxs; ,
206 usl[
MXt] = (uL[
MXt]*(SL[
i] - vxl)
207 - (Bxs*Bys - vL[
BXn]*vL[
BXt]))/(SL[i] - vxs);
208 usr[
MXt] = (uR[
MXt]*(SR[
i] - vxr)
209 - (Bxs*Bys - vR[
BXn]*vR[
BXt]))/(SR[i] - vxs); ,
211 usl[
MXb] = (uL[
MXb]*(SL[
i] - vxl)
212 - (Bxs*Bzs - vL[
BXn]*vL[
BXb]))/(SL[i] - vxs);
213 usr[
MXb] = (uR[
MXb]*(SR[
i] - vxr)
214 - (Bxs*Bzs - vR[
BXn]*vR[
BXb]))/(SR[i] - vxs);)
216 EXPAND(usl[
BXn] = usr[
BXn] = Bxs; ,
217 usl[
BXt] = usr[
BXt] = Bys; ,
218 usl[
BXb] = usr[
BXb] = Bzs;)
225 for (nv = 0; nv <
NFLX; nv++) {
226 state->
flux[
i][nv] = fL[
i][nv] + SL[
i]*(usl[nv] - uL[nv]);
230 for (nv = 0; nv <
NFLX; nv++) {
231 state->
flux[
i][nv] = fR[
i][nv] + SR[
i]*(usr[nv] - uR[nv]);
242 #if DIVB_CONTROL == EIGHT_WAVES
247 #elif EOS == ISOTHERMAL
251 double *cmax,
Grid *grid)
258 print1 (
"! HLLC solver not implemented for Isothermal EOS\n");
259 print1 (
"! Use hll or hlld instead.\n");
void GLM_Solve(const State_1D *state, double **VL, double **VR, int beg, int end, Grid *grid)
void HLL_DivBSource(const State_1D *state, double **Uhll, int beg, int end, Grid *grid)
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)
double * SR
Rightmost velocity in the Riemann fan at i+1/2.
double ** vR
Primitive variables to the right of the interface, .
void HLLC_Solver(const State_1D *state, int beg, int end, real *cmax, Grid *grid)
void SoundSpeed2(double **v, double *cs2, double *h, int beg, int end, int pos, Grid *grid)
double * SL
Leftmost velocity in the Riemann fan at i+1/2.
void print(const char *fmt,...)
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