46 int riemann(
int nmin,
int nmax,
double *clft,
double *crgh,
47 double *rlft,
double *rrgh,
double *plfti,
48 double *prghi,
double *pmid,
double *pmold,
49 double *plft,
double *wrgh,
double *prgh,
double *wlft,
50 double *zlft,
double *zrgh,
double *umidl,
double *umidr,
51 double *umid,
double *urgh,
double *ulft) {
55 double gamfac2, gamfac1;
58 gamfac1 = 0.5 * (gamfac2) /
Gamma1;
62 for (n = nmin; n <= nmax; n++) {
63 clft[n] = sqrt(
Gamma1 * plft[n] * rlft[n]);
64 crgh[n] = sqrt(
Gamma1 * prgh[n] * rrgh[n]);
65 rlft[n] = 1.0 / rlft[n];
66 rrgh[n] = 1.0 / rrgh[n];
67 plfti[n] = 1.0 / plft[n];
68 prghi[n] = 1.0 / prgh[n];
69 pmid[n] = prgh[n] - plft[n] - crgh[n]*(urgh[n] - ulft[n]);
70 pmid[n] = plft[n] + pmid[n] * clft[n] / (clft[n] + crgh[n]);
82 for (n = nmin; n <= nmax; n++) {
83 for (l = 0; l < 12; l++) {
85 wlft[n] = 1.0 + gamfac1 * (pmid[n] - plft[n]) * plfti[n];
86 wrgh[n] = 1.0 + gamfac1 * (pmid[n] - prgh[n]) * prghi[n];
87 wlft[n] = clft[n] * sqrt(wlft[n]);
88 wrgh[n] = crgh[n] * sqrt(wrgh[n]);
89 zlft[n] = 4.0 * rlft[n] * wlft[n] * wlft[n];
90 zrgh[n] = 4.0 * rrgh[n] * wrgh[n] * wrgh[n];
91 zlft[n] = -zlft[n] * wlft[n] / (zlft[n] - gamfac2 * (pmid[n] - plft[n]));
92 zrgh[n] = zrgh[n] * wrgh[n] / (zrgh[n] - gamfac2 * (pmid[n] - prgh[n]));
93 umidl[n] = ulft[n] - (pmid[n] - plft[n]) / wlft[n];
94 umidr[n] = urgh[n] + (pmid[n] - prgh[n]) / wrgh[n];
95 pmid[n] = pmid[n] + (umidr[n] - umidl[n])*(zlft[n] * zrgh[n]) / (zrgh[n] - zlft[n]);
97 if (fabs(pmid[n] - pmold[n]) / pmid[n] < tol)
break;
103 for (n = nmin; n <= nmax; n++) {
104 umidl[n] = ulft[n] - (pmid[n] - plft[n]) / wlft[n];
105 umidr[n] = urgh[n] + (pmid[n] - prgh[n]) / wrgh[n];
106 umid [n] = 0.5 * (umidl[n] + umidr[n]);