12 if (a * b <= 0.)
return 0.;
14 if (fabs(a) > fabs(b))
22 if (i > 3 || j > 3 || i < 0 || j < 0) {
23 std::cout <<
"index44: i j " << i <<
" " << j << endl;
27 return (i * (i + 1)) / 2 +
j;
29 return (j * (j + 1)) / 2 +
i;
33 for (
int i = 0;
i < 7;
i++) {
40 for (
int i = 0;
i < 10;
i++) {
54 for (
int i = 0;
i < 7;
i++)
Q[
i] += flux[
i];
58 for (
int i = 0;
i < 7;
i++) Qh[
i] =
Q[
i] + flux[
i];
62 double &_nq,
double &_ns,
double &_vx,
double &_vy,
65 for (
int i = 0;
i < 7;
i++) _Q[
i] =
Q[
i] / tau;
66 transformPV(eos, _Q, _e, _p, _nb, _nq, _ns, _vx, _vy, _vz);
69 cout <<
"---error in getPrimVar:\n";
76 double &_nb,
double &_nq,
double &_ns,
double &_vx,
77 double &_vy,
double &_vz,
int dir) {
78 double Qr[7], Ql[7], dQ[7];
80 next[dir - 1]->getQ(Qr);
81 prev[dir - 1]->getQ(Ql);
83 for (
int i = 0;
i < 7;
i++)
84 dQ[
i] =
minmod((Qr[
i] -
Q[
i]) / 2., (
Q[i] - Ql[i]) / 2.);
86 for (
int i = 0; i < 7; i++) Ql[i] = (
Q[i] - dQ[i]) /
tau;
88 transformPV(eos, Ql, _e, _p, _nb, _nq, _ns, _vx, _vy, _vz);
92 cout <<
"---error in getPrimVarLeft:\n";
94 next[dir - 1]->Dump(tau);
95 prev[dir - 1]->Dump(tau);
101 double &_nb,
double &_nq,
double &_ns,
double &_vx,
102 double &_vy,
double &_vz,
int dir) {
103 double Qr[7], Ql[7], dQ[7];
105 next[dir - 1]->getQ(Qr);
106 prev[dir - 1]->getQ(Ql);
108 for (
int i = 0;
i < 7;
i++)
109 dQ[
i] =
minmod((Qr[
i] -
Q[
i]) / 2., (
Q[i] - Ql[i]) / 2.);
111 for (
int i = 0; i < 7; i++) Qr[i] = (
Q[i] + dQ[i]) /
tau;
113 transformPV(eos, Qr, _e, _p, _nb, _nq, _ns, _vx, _vy, _vz);
117 cout <<
"---error in getPrimVarRight:\n";
119 next[dir - 1]->Dump(tau);
120 prev[dir - 1]->Dump(tau);
126 double &_nb,
double &_nq,
double &_ns,
double &_vx,
127 double &_vy,
double &_vz,
int dir) {
128 double Qr[7], Ql[7], dQ[7];
130 next[dir - 1]->getQh(Qr);
131 prev[dir - 1]->getQh(Ql);
133 for (
int i = 0;
i < 7;
i++)
134 dQ[
i] =
minmod((Qr[
i] - Qh[
i]) / 2., (Qh[i] - Ql[i]) / 2.);
136 for (
int i = 0; i < 7; i++) Ql[i] = (Qh[i] - dQ[i]) /
tau;
138 transformPV(eos, Ql, _e, _p, _nb, _nq, _ns, _vx, _vy, _vz);
142 cout <<
"---error in getPrimVarHLeft:\n";
144 next[dir - 1]->Dump(tau);
145 prev[dir - 1]->Dump(tau);
151 double &_nb,
double &_nq,
double &_ns,
double &_vx,
152 double &_vy,
double &_vz,
int dir) {
153 double Qr[7], Ql[7], dQ[7];
155 next[dir - 1]->getQh(Qr);
156 prev[dir - 1]->getQh(Ql);
158 for (
int i = 0;
i < 7;
i++)
159 dQ[
i] =
minmod((Qr[
i] - Qh[
i]) / 2., (Qh[i] - Ql[i]) / 2.);
161 for (
int i = 0; i < 7; i++) Qr[i] = (Qh[i] + dQ[i]) /
tau;
163 transformPV(eos, Qr, _e, _p, _nb, _nq, _ns, _vx, _vy, _vz);
167 cout <<
"---error in getPrimVarHRight:\n";
169 next[dir - 1]->Dump(tau);
170 prev[dir - 1]->Dump(tau);
176 double &_nb,
double &_nq,
double &_ns,
double &_vx,
177 double &_vy,
double &_vz) {
179 for (
int i = 0;
i < 7;
i++) _Q[
i] = Qh[
i] / tau;
180 transformPV(eos, _Q, _e, _p, _nb, _nq, _ns, _vx, _vy, _vz);
184 double &_nb,
double &_nq,
double &_ns,
double &_vx,
185 double &_vy,
double &_vz) {
187 for (
int i = 0;
i < 7;
i++) _Q[
i] = Qprev[
i] / tau;
188 transformPV(eos, _Q, _e, _p, _nb, _nq, _ns, _vx, _vy, _vz);
193 double _ns,
double _vx,
double _vy,
double _vz) {
194 const double gamma2 = 1. / (1 - _vx * _vx - _vy * _vy - _vz * _vz);
195 const double p = eos->
p(_e, _nb, _nq, _ns);
196 Q[
T_] = tau * (_e + p * (_vx * _vx + _vy * _vy + _vz * _vz)) * gamma2;
197 Q[
X_] = tau * (_e +
p) * _vx * gamma2;
198 Q[
Y_] = tau * (_e +
p) * _vy * gamma2;
199 Q[
Z_] = tau * (_e +
p) * _vz * gamma2;
200 Q[
NB_] = tau * _nb * sqrt(gamma2);
201 Q[
NQ_] = tau * _nq * sqrt(gamma2);
202 Q[
NS_] = tau * _ns * sqrt(gamma2);
204 cout <<
"init error!\n";
205 eos->
p(_e, _nb, _nq, _ns);
206 cout <<
"e = " << _e <<
" p = " << p <<
" vx = " << _vx <<
" vy = " << _vy
207 <<
" vz = " << _vz <<
" gamma2 = " << gamma2 << endl;
214 cout <<
"---------cell values dump-------\n";
215 cout << setw(5) << ix << setw(5) << iy << setw(5) << iz << endl;
216 cout << setw(14) <<
Q[0] / tau << setw(14) <<
Q[1] / tau << setw(14)
217 <<
Q[2] / tau << setw(14) <<
Q[3] / tau << endl;
218 cout << setw(14) <<
Q[4] / tau << setw(14) <<
Q[5] / tau << setw(14)
219 <<
Q[6] / tau << endl;
220 cout << setw(14) << Qh[0] / tau << setw(14) << Qh[1] / tau << setw(14)
221 << Qh[2] / tau << setw(14) << Qh[3] / tau << endl;
222 cout << setw(14) << Qh[4] / tau << setw(14) << Qh[5] / tau << setw(14)
223 << Qh[6] / tau << endl;
225 cout <<
"--------------------------------\n";