3 #include <vdt/vdtMath.h>
48 #if defined(USE_SSEVECT) && !defined(TRPRFN_SCALAR)
49 #include "AnalyticalCurvilinearJacobianSSE.icc"
50 #elif defined(USE_EXTVECT) && !defined(TRPRFN_SCALAR)
51 #include "AnalyticalCurvilinearJacobianEXT.icc"
81 double cosl0 =
p1.perp();
82 double cosl1 = 1. /
p2.perp();
92 vdt::fast_sincos(
theta, sint, cost);
99 double gamma = hn1 * t21 + hn2 * t22 + hn3 * t23;
100 double an1 = hn2 * t23 - hn3 * t22;
101 double an2 = hn3 * t21 - hn1 * t23;
102 double an3 = hn1 * t22 - hn2 * t21;
103 double au = 1. /
sqrt(t11 * t11 + t12 * t12);
104 double u11 = -au * t12;
105 double u12 = au * t11;
106 double v11 = -t13 * u12;
107 double v12 = t13 * u11;
108 double v13 = t11 * u12 - t12 * u11;
109 au = 1. /
sqrt(t21 * t21 + t22 * t22);
110 double u21 = -au * t22;
111 double u22 = au * t21;
112 double v21 = -t23 * u22;
113 double v22 = t23 * u21;
114 double v23 = t21 * u22 - t22 * u21;
121 double anv = -(hn1 * u21 + hn2 * u22);
122 double anu = (hn1 * v21 + hn2 * v22 + hn3 * v23);
123 double omcost = 1. - cost;
124 double tmsint =
theta - sint;
126 double hu1 = -hn3 * u12;
127 double hu2 = hn3 * u11;
128 double hu3 = hn1 * u12 - hn2 * u11;
130 double hv1 = hn2 * v13 - hn3 * v12;
131 double hv2 = hn3 * v11 - hn1 * v13;
132 double hv3 = hn1 * v12 - hn2 * v11;
136 for (
auto i = 1;
i < 5; ++
i)
140 theJacobian(1, 0) = -qp * anv * (t21 * dx1 + t22 * dx2 + t23 * dx3);
143 cost * (v11 * v21 + v12 * v22 + v13 * v23) + sint * (hv1 * v21 + hv2 * v22 + hv3 * v23) +
144 omcost * (hn1 * v11 + hn2 * v12 + hn3 * v13) * (hn1 * v21 + hn2 * v22 + hn3 * v23) +
145 anv * (-sint * (v11 * t21 + v12 * t22 + v13 * t23) + omcost * (v11 * an1 + v12 * an2 + v13 * an3) -
146 tmsint *
gamma * (hn1 * v11 + hn2 * v12 + hn3 * v13));
148 theJacobian(1, 2) = cost * (u11 * v21 + u12 * v22) + sint * (hu1 * v21 + hu2 * v22 + hu3 * v23) +
149 omcost * (hn1 * u11 + hn2 * u12) * (hn1 * v21 + hn2 * v22 + hn3 * v23) +
150 anv * (-sint * (u11 * t21 + u12 * t22) + omcost * (u11 * an1 + u12 * an2) -
151 tmsint *
gamma * (hn1 * u11 + hn2 * u12));
156 theJacobian(1, 4) = -
q * anv * (v11 * t21 + v12 * t22 + v13 * t23);
160 theJacobian(2, 0) = -qp * anu * (t21 * dx1 + t22 * dx2 + t23 * dx3) * cosl1;
163 cost * (v11 * u21 + v12 * u22) + sint * (hv1 * u21 + hv2 * u22) +
164 omcost * (hn1 * v11 + hn2 * v12 + hn3 * v13) * (hn1 * u21 + hn2 * u22) +
165 anu * (-sint * (v11 * t21 + v12 * t22 + v13 * t23) + omcost * (v11 * an1 + v12 * an2 + v13 * an3) -
166 tmsint *
gamma * (hn1 * v11 + hn2 * v12 + hn3 * v13));
169 theJacobian(2, 2) = cost * (u11 * u21 + u12 * u22) + sint * (hu1 * u21 + hu2 * u22) +
170 omcost * (hn1 * u11 + hn2 * u12) * (hn1 * u21 + hn2 * u22) +
171 anu * (-sint * (u11 * t21 + u12 * t22) + omcost * (u11 * an1 + u12 * an2) -
172 tmsint *
gamma * (hn1 * u11 + hn2 * u12));
175 theJacobian(2, 3) = -
q * anu * (u11 * t21 + u12 * t22) * cosl1;
177 theJacobian(2, 4) = -
q * anu * (v11 * t21 + v12 * t22 + v13 * t23) * cosl1;
182 double cutCriterion = fabs(
s / globalParameters.
momentum().
mag());
183 const double limit = 5.;
185 if (cutCriterion >
limit) {
186 double pp = 1. / qbp;
188 theJacobian(4, 0) =
pp * (v21 * dx1 + v22 * dx2 + v23 * dx3);
190 double hp11 = hn2 * t13 - hn3 * t12;
191 double hp12 = hn3 * t11 - hn1 * t13;
192 double hp13 = hn1 * t12 - hn2 * t11;
193 double temp1 = hp11 * u21 + hp12 * u22;
195 double secondOrder41 = 0.5 * qp * temp1 *
s2;
196 double ghnmp1 =
gamma * hn1 - t11;
197 double ghnmp2 =
gamma * hn2 - t12;
198 double ghnmp3 =
gamma * hn3 - t13;
199 double temp2 = ghnmp1 * u21 + ghnmp2 * u22;
205 double qbp2 = qbp * qbp;
207 double thirdOrder41 = 1. / 3 * h2 * s3 * qbp * temp2;
209 double fourthOrder41 = 1. / 8 * h3 * s4 * qbp2 * temp1;
210 theJacobian(3, 0) = secondOrder41 + (thirdOrder41 + fourthOrder41);
212 double temp3 = hp11 * v21 + hp12 * v22 + hp13 * v23;
213 double secondOrder51 = 0.5 * qp * temp3 *
s2;
214 double temp4 = ghnmp1 * v21 + ghnmp2 * v22 + ghnmp3 * v23;
215 double thirdOrder51 = 1. / 3 * h2 * s3 * qbp * temp4;
216 double fourthOrder51 = 1. / 8 * h3 * s4 * qbp2 * temp3;
217 theJacobian(4, 0) = secondOrder51 + (thirdOrder51 + fourthOrder51);
220 theJacobian(3, 1) = (sint * (v11 * u21 + v12 * u22) + omcost * (hv1 * u21 + hv2 * u22) +
221 tmsint * (hn1 * u21 + hn2 * u22) * (hn1 * v11 + hn2 * v12 + hn3 * v13)) /
224 theJacobian(3, 2) = (sint * (u11 * u21 + u12 * u22) + omcost * (hu1 * u21 + hu2 * u22) +
225 tmsint * (hn1 * u21 + hn2 * u22) * (hn1 * u11 + hn2 * u12)) *
234 theJacobian(4, 1) = (sint * (v11 * v21 + v12 * v22 + v13 * v23) + omcost * (hv1 * v21 + hv2 * v22 + hv3 * v23) +
235 tmsint * (hn1 * v21 + hn2 * v22 + hn3 * v23) * (hn1 * v11 + hn2 * v12 + hn3 * v13)) /
238 theJacobian(4, 2) = (sint * (u11 * v21 + u12 * v22) + omcost * (hu1 * v21 + hu2 * v22 + hu3 * v23) +
239 tmsint * (hn1 * v21 + hn2 * v22 + hn3 * v23) * (hn1 * u11 + hn2 * u12)) *
244 theJacobian(4, 4) = (v11 * v21 + v12 * v22 + v13 * v23);
272 double sinl = tn.
z();
273 double cosl =
std::sqrt(1. - sinl * sinl);
274 double cosl1 = 1. / cosl;
275 double tgl = sinl * cosl1;
276 double sinp = tn.
y() * cosl1;
277 double cosp = tn.
x() * cosl1;
281 double b0 =
h.x() * cosp +
h.y() * sinp;
282 double b2 = -
h.x() * sinp +
h.y() * cosp;
283 double b3 = -
b0 * sinl +
h.z() * cosl;
317 double cosl0 =
p1.perp();