20 size = backtrace(array, 10);
23 cout <<
"Error: signal " << sig << endl;
24 backtrace_symbols_fd(array, size, 2);
29 double &nq,
double &
ns,
double &
vx,
double &
vy,
double &
vz) {
35 const int MAXIT = 100;
36 const double dpe = 1. / 3.;
37 const double corrf = 0.9999;
39 double v, vl = 0., vh = 1., dvold, dv,
f,
df;
41 cout <<
"transformPV debug---------------\n";
42 cout << setw(14) << Q[0] << setw(14) << Q[1] << setw(14) << Q[2] << setw(14)
44 cout << setw(14) << Q[4] << setw(14) << Q[5] << setw(14) << Q[6] << endl;
46 double M = sqrt(Q[
X_] * Q[
X_] + Q[
Y_] * Q[
Y_] + Q[
Z_] * Q[
Z_]);
62 p = eos->
p(e, nb, nq, ns);
66 Q[
X_] *= corrf * Q[
T_] / M;
67 Q[
Y_] *= corrf * Q[
T_] / M;
68 Q[
Z_] *= corrf * Q[
T_] / M;
75 nb = Q[
NB_] * sqrt(1 - v * v);
76 nq = Q[
NQ_] * sqrt(1 - v * v);
77 ns = Q[
NS_] * sqrt(1 - v * v);
78 p = eos->
p(e, nb, nq, ns);
79 f = (Q[
T_] +
p) * v - M;
80 df = (Q[
T_] +
p) - M * v * dpe;
83 for (
int i = 0;
i < MAXIT;
i++) {
84 if ((f + df * (vh - v)) * (f + df * (vl - v)) > 0. ||
85 fabs(2. * f) > fabs(dvold * df)) {
96 if (fabs(dv) < 0.00001)
break;
100 nb = Q[
NB_] * sqrt(1 - v * v);
101 nq = Q[
NQ_] * sqrt(1 - v * v);
102 ns = Q[
NS_] * sqrt(1 - v * v);
103 p = eos->
p(e, nb, nq, ns);
104 f = (Q[
T_] +
p) * v - M;
105 df = (Q[
T_] +
p) - M * v * dpe;
112 cout <<
"step " <<
i <<
" " << e <<
" " << nb <<
" " << nq <<
" "
113 << ns <<
" " << p <<
" " << vx <<
" " << vy <<
" " << vz << endl;
122 p = eos->
p(e, nb, nq, ns);
123 nb = Q[
NB_] * sqrt(1 - vx * vx - vy * vy - vz * vz);
124 nq = Q[
NQ_] * sqrt(1 - vx * vx - vy * vy - vz * vz);
125 ns = Q[
NS_] * sqrt(1 - vx * vx - vy * vy - vz * vz);
126 if (e < 0. || sqrt(vx * vx + vy * vy + vz * vz) > 1.) {
127 cout << Q[
T_] <<
" " << Q[
X_] <<
" " << Q[
Y_] <<
" " << Q[
Z_] <<
" "
129 cout <<
"transformRF::Error\n";
131 if (!(nb < 0. || nb >= 0.)) {
132 cout <<
"transformRF::Error nb=#ind\n";
138 double &nb,
double &nq,
double &
ns,
double &
vx,
double &
vy,
140 const int MAXIT = 100;
141 const double dpe = 1. / 3.;
142 const double corrf = 0.9999;
143 double v, vl = 0., vh = 1., dvold, dv,
f,
df;
145 cout <<
"transformPVBulk debug---------------\n";
146 cout << setw(14) << Q[0] << setw(14) << Q[1] << setw(14) << Q[2] << setw(14)
148 cout << setw(14) << Q[4] << setw(14) << Q[5] << setw(14) << Q[6] << endl;
150 double M = sqrt(Q[
X_] * Q[
X_] + Q[
Y_] * Q[
Y_] + Q[
Z_] * Q[
Z_]);
166 p = eos->
p(e, nb, nq, ns) + Pi;
170 Q[
X_] *= corrf * Q[
T_] / M;
171 Q[
Y_] *= corrf * Q[
T_] / M;
172 Q[
Z_] *= corrf * Q[
T_] / M;
179 nb = Q[
NB_] * sqrt(1 - v * v);
180 nq = Q[
NQ_] * sqrt(1 - v * v);
181 ns = Q[
NS_] * sqrt(1 - v * v);
182 p = eos->
p(e, nb, nq, ns) + Pi;
183 f = (Q[
T_] +
p) * v - M;
184 df = (Q[
T_] +
p) - M * v * dpe;
187 for (
int i = 0;
i < MAXIT;
i++) {
188 if ((f + df * (vh - v)) * (f + df * (vl - v)) > 0. ||
189 fabs(2. * f) > fabs(dvold * df)) {
191 dv = 0.5 * (vh - vl);
200 if (fabs(dv) < 0.00001)
break;
204 nb = Q[
NB_] * sqrt(1 - v * v);
205 nq = Q[
NQ_] * sqrt(1 - v * v);
206 ns = Q[
NS_] * sqrt(1 - v * v);
207 p = eos->
p(e, nb, nq, ns) + Pi;
208 f = (Q[
T_] +
p) * v - M;
209 df = (Q[
T_] +
p) - M * v * dpe;
216 cout <<
"step " <<
i <<
" " << e <<
" " << nb <<
" " << nq <<
" "
217 << ns <<
" " << p <<
" " << vx <<
" " << vy <<
" " << vz << endl;
226 p = eos->
p(e, nb, nq, ns);
227 nb = Q[
NB_] * sqrt(1 - vx * vx - vy * vy - vz * vz);
228 nq = Q[
NQ_] * sqrt(1 - vx * vx - vy * vy - vz * vz);
229 ns = Q[
NS_] * sqrt(1 - vx * vx - vy * vy - vz * vz);
230 if (e < 0. || sqrt(vx * vx + vy * vy + vz * vz) > 1.) {
231 cout << Q[
T_] <<
" " << Q[
X_] <<
" " << Q[
Y_] <<
" " << Q[
Z_] <<
" "
233 cout <<
"transformRF::Error\n";
235 if (!(nb < 0. || nb >= 0.)) {
236 cout <<
"transformRF::Error nb=#ind\n";
237 cout <<
"Q [7]: " << Q[0] <<
" " << Q[1] <<
" " << Q[2] <<
" " << Q[3]
238 <<
" " << Q[4] <<
" " << Q[5] <<
" " << Q[6] << endl;
239 cout <<
"e vx vy vz nb nq ns: " << e <<
" " << vx <<
" " << vy <<
" " << vz
240 <<
" " << nb <<
" " << nq <<
" " << ns << endl;
247 double vy,
double vz,
double Q[]) {
248 const double gamma2 = 1. / (1 - vx * vx - vy * vy - vz *
vz);
249 Q[
T_] = (e + p * (vx * vx + vy * vy + vz *
vz)) * gamma2;
250 Q[
X_] = (e +
p) * vx * gamma2;
251 Q[
Y_] = (e +
p) * vy * gamma2;
252 Q[
Z_] = (e +
p) * vz * gamma2;
253 Q[
NB_] = nb * sqrt(gamma2);
254 Q[
NQ_] = nq * sqrt(gamma2);
255 Q[
NS_] = ns * sqrt(gamma2);