35 #include <Faddeeva/Faddeeva.hh> 80 throw std::runtime_error(
81 "The no_shape lineshape is only a placeholder, but you tried\n" 82 "to use it like a real lineshape.");
122 Numeric gamma2 = gamma * gamma;
127 ls_attenuation[
i] = fac / ((f_grid[
i] - f0) * (f_grid[
i] - f0) + gamma2);
128 ls_phase[
i] = (f_grid[
i] - f0) / PI /
129 ((f_grid[
i] - f0) * (f_grid[
i] - f0) + gamma2);
133 ls_attenuation[
i] = fac / ((f_grid[
i] - f0) * (f_grid[
i] - f0) + gamma2);
173 Numeric gamma2 = gamma * gamma;
178 ls_attenuation[
i] = fac / ((f_grid[
i] - f0) * (f_grid[
i] - f0) + gamma2) +
179 fac / ((f_grid[
i] + f0) * (f_grid[
i] + f0) + gamma2);
180 ls_phase[
i] = (f_grid[
i] - f0) / PI /
181 ((f_grid[
i] - f0) * (f_grid[
i] - f0) + gamma2) +
182 (f_grid[
i] + f0) / PI /
183 ((f_grid[
i] + f0) * (f_grid[
i] + f0) +
188 ls_attenuation[
i] = fac / ((f_grid[
i] - f0) * (f_grid[
i] - f0) + gamma2) +
189 fac / ((f_grid[
i] + f0) * (f_grid[
i] + f0) + gamma2);
232 Numeric sigma2 = sigma * sigma;
236 ls_attenuation[
i] = fac * exp(-
pow(f_grid[
i] - f0, 2) / sigma2);
270 throw std::runtime_error(
271 "You are running a deprecated lineshape.\n" 272 "The deprecated line shapes are:\n" 273 "\t Voigt_Kuntz3 --- please replace with Voigt_Kuntz6\n" 274 "\t Voigt_Kuntz4 --- please replace with Voigt_Kuntz6\n");
290 }
else if (s >= 5.5f) {
292 }
else if (y >= fabs(x) * .195f - .176f) {
361 Vector& ls_dattenuation_dfrequency_term,
363 Vector& ls_dattenuation_dpressure_term,
376 const bool do_partials)
405 long int bmin = 0, lauf[16] = {0} , bmax;
406 long int imin = 0, imax = 0, stack[80] = {0} ;
407 Numeric a1,
a2, a3, a4, a5, a6, a8, b8, c8, d8, e8, f8, g8, h8, a7, b7, c7,
408 d7, e7, f7, o8, p8, q8, r8, s8, t8, g7, h7, o7, p7, q7, r7, s7, t7, b6,
409 c6, d6, e6, b5, c5, d5, e5, b4, c4, d4, b3, c3, d3,
b1, y2;
410 a1 = a2 = a3 = a4 = a5 = a6 = a8 = b8 = c8 = d8 = e8 = f8 = g8 = h8 = a7 =
411 b7 = c7 = d7 = e7 = f7 = o8 = p8 = q8 = r8 = s8 = t8 = g7 = h7 = o7 = p7 =
412 q7 = r7 = s7 = t7 = b6 = c6 = d6 = e6 = b5 = c5 = d5 = e5 = b4 = c4 =
413 d4 = b3 = c3 = d3 = b1 = y2 = 0;
414 long int i2 = 0, i1 = 0;
416 long int stackp = 0, imitte = 0;
425 bool do_x =
false, do_y =
false;
438 const Numeric df0 = -dx * sigma;
443 do_x = (f0 > (-df0 * 10));
467 const Numeric dgamma = dy * sigma;
472 do_y = (y > (dy * 10));
497 for (i1 = 0; i1 < (int)nf; i1++) {
498 x[i1] = (f_grid[i1] - f0) / sigma;
509 if (y >= 15.0 || x[0] >= 15.0 || x[nf - 1] <= -15.0) {
516 for (i2 = 1; i2 <= 4; ++i2) {
517 for (i1 = 1; i1 <= 4; ++i1) {
518 lauf[i1 + (i2 << 2) - 5] = i2 % 2 * (nf + 1);
523 stack[stackp - 1] = 1;
524 stack[stackp + 19] = nf;
525 stack[stackp + 39] =
bfun6_(y, x[0]);
526 stack[stackp + 59] =
bfun6_(y, x[nf - 1]);
528 imin = stack[stackp - 1];
529 imax = stack[stackp + 19];
530 bmin = stack[stackp + 39];
531 bmax = stack[stackp + 59];
533 if (x[imax - 1] < 0.f) {
535 i__1 = imin, i__2 = lauf[bmin - 1];
536 lauf[bmin - 1] =
min(i__1, i__2);
538 i__1 = imax, i__2 = lauf[bmax + 3];
539 lauf[bmax + 3] =
max(i__1, i__2);
542 }
else if (x[imin - 1] >= 0.f) {
544 i__1 = imin, i__2 = lauf[bmin + 7];
545 lauf[bmin + 7] =
min(i__1, i__2);
547 i__1 = imax, i__2 = lauf[bmax + 11];
548 lauf[bmax + 11] =
max(i__1, i__2);
553 imitte = (imax + imin) / 2;
554 stack[stackp - 1] = imitte + 1;
555 stack[stackp + 19] = imax;
556 stack[stackp + 39] =
bfun6_(y, x[imitte]);
557 stack[stackp + 59] = bmax;
559 stack[stackp - 1] = imin;
560 stack[stackp + 19] = imitte;
561 stack[stackp + 39] = bmin;
562 stack[stackp + 59] =
bfun6_(y, x[imitte - 1]);
569 if (lauf[7] >= lauf[3] || lauf[15] >= lauf[11]) {
570 if ((r__1 = y - yps4, fabs(r__1)) > 1e-8f) {
637 (y2 * (y2 * (y2 * (97.6203f -
652 (y2 * (y2 * (y2 * (y2 * (y2 * (y2 * (y2 * (y2 * (228.563f -
663 e7 = y * (y2 * (y2 * (y2 * (y2 * (y2 * (y2 * (y2 * (y2 * (296.38f -
675 (y2 * (y2 * (y2 * (y2 * (y2 * (y2 * (y2 * (125.591f - y2 * 726.113f) +
683 g7 = y * (y2 * (y2 * (y2 * (y2 * (y2 * (y2 * (-260.198f - y2 * 968.15f) +
692 (y2 * (y2 * (y2 * (y2 * (y2 * (-571.645f - y2 * 968.15f) + 23137.1f) +
697 o7 = y * (y2 * (y2 * (y2 * (y2 * (-575.164f - y2 * 726.113f) + 8073.15f) +
701 p7 = y * (y2 * (y2 * (y2 * (-352.467f - y2 * 403.396f) + 953.655f) +
704 q7 = y * (y2 * (y2 * (-134.792f - y2 * 161.358f) - 271.202f) - 622.056f);
705 r7 = y * (y2 * (-29.7896f - y2 * 44.0068f) - 77.0535f);
706 s7 = y * (-2.92264f - y2 * 7.33447f);
773 (y2 * (y2 * (y2 * (y2 * (y2 * 91 -
788 (y2 * (y2 * (y2 * (y2 * (y2 * (y2 * (y2 * (y2 * (y2 * (y2 * 364 -
800 e8 = y2 * (y2 * (y2 * (y2 * (y2 * (y2 * (y2 * (y2 * (y2 * (y2 * 1001 -
813 (y2 * (y2 * (y2 * (y2 * (y2 * (y2 * (y2 * (y2 * 2002 - 1093.82f) -
822 g8 = y2 * (y2 * (y2 * (y2 * (y2 * (y2 * (y2 * (y2 * 3003 - 486.14f) -
831 y2 * (y2 * (y2 * (y2 * (y2 * (y2 * (y2 * 3432 + 486.14f) - 106663.f) -
837 o8 = y2 * (y2 * (y2 * (y2 * (y2 * (y2 * 3003 + 1093.82f) - 55582.f) -
844 (y2 * (y2 * (y2 * (y2 * 2002 + 1012.79f) - 16493.7f) - 48153.3f) -
847 q8 = y2 * (y2 * (y2 * (y2 * 1001.f + 567.164f) - 1500.17f) - 3058.26f) +
849 r8 = y2 * (y2 * (y2 * 364 + 198.876f) + 533.254f) + 955.194f;
850 s8 = y2 * (y2 * 91.f + 40.5117f) + 126.532f;
851 t8 = y2 * 14.f + 3.68288f;
854 for (i2 = 1; i2 <= 3; i2 += 2) {
855 i__1 = lauf[((i2 + 1) << 2) - 1];
856 for (i1 = lauf[(i2 << 2) - 1]; i1 <= i__1; ++i1) {
857 x2 = x[i1 - 1] * x[i1 - 1];
858 ls_attenuation[i1 - 1] =
860 (exp(y2 - x2) * cos(x[i1 - 1] * ym2) -
922 if (lauf[6] >= lauf[2] || lauf[14] >= lauf[10]) {
923 if ((r__1 = y - yps3, fabs(r__1)) > 1e-8f) {
925 a5 = y * (y * (y * (y * (y * (y * (y * (y * (y * .564224f + 7.55895f) +
934 b5 = y * (y * (y * (y * (y * (y * (y * 2.25689f + 22.6778f) + 100.705f) +
941 y * (y * (y * (y * (y * 3.38534f + 22.6798f) + 52.8454f) + 42.5683f) +
944 d5 = y * (y * (y * 2.25689f + 7.56186f) + 1.66203f) - .128922f;
945 e5 = y * .564224f + 9.71457e-4f;
946 a6 = y * (y * (y * (y * (y * (y * (y * (y * (y * (y + 13.3988f) +
956 b6 = y * (y * (y * (y * (y * (y * (y * (y * 5.f + 53.5952f) + 266.299f) +
963 c6 = y * (y * (y * (y * (y * (y * 10.f + 80.3928f) + 269.292f) +
968 d6 = y * (y * (y * (y * 10.f + 53.5952f) + 92.7568f) + 55.0293f) +
970 e6 = y * (y * 5.f + 13.3988f) + 1.49645f;
972 for (i2 = 1; i2 <= 3; i2 += 2) {
973 i__1 = lauf[((i2 + 1) << 2) - 2];
974 for (i1 = lauf[(i2 << 2) - 2]; i1 <= i__1; ++i1) {
975 x2 = x[i1 - 1] * x[i1 - 1];
976 ls_attenuation[i1 - 1] =
977 fac * (a5 + x2 * (b5 + x2 * (c5 + x2 * (d5 + x2 * e5)))) /
978 (a6 + x2 * (b6 + x2 * (c6 + x2 * (d6 + x2 * (e6 +
x2)))));
985 if (lauf[5] >= lauf[1] || lauf[13] >= lauf[9]) {
986 if ((r__1 = y - yps2, fabs(r__1)) > 1e-8f) {
988 a3 = y * (y2 * (y2 * (y2 * .56419f + 3.10304f) + 4.65456f) + 1.05786f);
989 b3 = y * (y2 * (y2 * 1.69257f + .56419f) + 2.962f);
990 c3 = y * (y2 * 1.69257f - 2.53885f);
992 a4 = y2 * (y2 * (y2 * (y2 + 6.f) + 10.5f) + 4.5f) + .5625f;
993 b4 = y2 * (y2 * (y2 * 4.f + 6.f) + 9.f) - 4.5f;
994 c4 = y2 * (y2 * 6.f - 6.f) + 10.5f;
997 for (i2 = 1; i2 <= 3; i2 += 2) {
998 i__1 = lauf[((i2 + 1) << 2) - 3];
999 for (i1 = lauf[(i2 << 2) - 3]; i1 <= i__1; ++i1) {
1000 x2 = x[i1 - 1] * x[i1 - 1];
1001 ls_attenuation[i1 - 1] = fac * (a3 + x2 * (b3 + x2 * (c3 + x2 * d3))) /
1002 (a4 + x2 * (b4 + x2 * (c4 + x2 * (d4 + x2))));
1010 if (lauf[4] >= lauf[0] || lauf[12] >= lauf[8]) {
1011 if ((r__1 = y - yps1, fabs(r__1)) > 1e-8f) {
1019 for (i2 = 1; i2 <= 3; i2 += 2) {
1020 i__1 = lauf[((i2 + 1) << 2) - 4];
1021 for (i1 = lauf[(i2 << 2) - 4]; i1 <= i__1; ++i1) {
1022 x2 = x[i1 - 1] * x[i1 - 1];
1024 ls_attenuation[i1 - 1] = c1 * (b1 +
x2) / (
b2 *
b2 + a2 * x2);
1033 for (
Index iv = 0; iv < nf; iv++) {
1034 ls_dattenuation_dfrequency_term[iv] -= ls_attenuation[iv];
1035 ls_dattenuation_dfrequency_term[iv] /=
dx;
1036 ls_dattenuation_dpressure_term[iv] -= ls_attenuation[iv];
1037 ls_dattenuation_dpressure_term[iv] /= dy;
1040 for (
Index iv = 0; iv < nf; iv++) {
1041 ls_dattenuation_dfrequency_term[iv] -= ls_attenuation[iv];
1042 ls_dattenuation_dfrequency_term[iv] /=
dx;
1043 ls_dattenuation_dpressure_term[iv] = 0.0;
1046 for (
Index iv = 0; iv < nf; iv++) {
1047 ls_dattenuation_dfrequency_term[iv] = 0.0;
1048 ls_dattenuation_dpressure_term[iv] -= ls_attenuation[iv];
1049 ls_dattenuation_dpressure_term[iv] /= dy;
1052 for (
Index iv = 0; iv < nf; iv++) {
1053 ls_dattenuation_dfrequency_term[iv] = 0.0;
1054 ls_dattenuation_dpressure_term[iv] = 0.0;
1073 if (x2 * .4081676f + y2 > 21.159543f) {
1074 if (x2 * .7019639f + y2 > 1123.14221f) {
1080 if (x2 * .20753051f + y2 > 4.20249292f) {
1082 }
else if (y >= fabs(x) * .08f - .12f) {
1169 Numeric B[22 + 1] = {0., 0., .7093602e-7};
1172 0., 10., 9., 8., 8., 7., 6., 5., 4., 3., 3., 3., 3., 3., 3., 3.};
1174 0., .6, .6, .6, .5, .4, .4, .3, .3, .3, .3, 1., .9, .8, .7, .7};
1175 Numeric D0[25 + 1] = {0}, D1[25 + 1] = {0}, D2[25 + 1] = {0},
1176 D3[25 + 1] = {0}, D4[25 + 1] = {0};
1179 const Numeric XX[3 + 1] = {0., .5246476, 1.65068, .7071068};
1180 const Numeric HH[3 + 1] = {0., .2562121, .2588268e-1, .2820948};
1181 const Numeric NBY2[19 + 1] = {0., 9.5, 9., 8.5, 8., 7.5, 7., 6.5, 6., 5.5,
1182 5., 4.5, 4., 3.5, 3., 2.5, 2., 1.5, 1., .5};
1184 0., .7093602e-7, -.2518434e-6, .856687e-6,
1185 -.2787638e-5, .866074e-5, -.2565551e-4, .7228775e-4,
1186 -.1933631e-3, .4899520e-3, -.1173267e-2, .2648762e-2,
1187 -.5623190e-2, .1119601e-1, -.2084976e-1, .3621573e-1,
1188 -.5851412e-1, .8770816e-1, -.121664, .15584,
1192 int I,
J, K, MAX, MIN,
N, i1;
1202 for (i1 = 0; i1 < (int)nf; i1++) {
1203 x[i1] = fabs((f_grid[i1] - f0)) / sigma;
1209 for (I = 1; I <= 15; I++) RI[I] = -I / 2.;
1210 for (I = 1; I <= 25; I++) {
1211 HN[I] = H * (I - .5);
1212 CO = 4. * HN[I] * HN[I] / 25. - 2.;
1213 for (J = 2; J <= 21; J++) B[J + 1] = CO * B[J] - B[J - 1] + C[J];
1214 D0[I] = HN[I] * (B[22] - B[21]) / 5.;
1215 D1[I] = 1. - 2. * HN[I] * D0[I];
1216 D2[I] = (HN[I] * D1[I] + D0[I]) / RI[2];
1217 D3[I] = (HN[I] * D2[I] + D1[I]) / RI[3];
1218 D4[I] = (HN[I] * D3[I] + D2[I]) / RI[4];
1221 for (K = 0; K < (int)nf; K++) {
1222 if ((x[K] - 5.) < 0.)
1232 if (x[K] > 1.85 * (3.6 - Y))
goto L112;
1234 if (Y < 1.45)
goto L107;
1240 J = (int)(x[K] + x[K] + 1.85);
1241 MAX = (int)(XN[J] * YN[I] + .46);
1242 MIN = (int)((16 < 21 - 2 * MAX) ? 16 : 21 - 2 * MAX);
1246 for (J = MIN; J <= 19; J++) {
1247 U = NBY2[J] / (UU * UU + VV * VV);
1251 ls_attenuation[K] = UU / (UU * UU + VV * VV) / 1.772454 * fac;
1255 if (x[K] + Y >= 5.)
goto L113;
1257 N = (int)(x[K] / H);
1258 DX = x[K] - HN[N + 1];
1259 U = (((D4[N + 1] * DX + D3[N + 1]) * DX + D2[N + 1]) * DX + D1[N + 1]) *
1262 V = 1. - 2. * x[K] * U;
1264 VV = exp(Y2 - x[K] * x[K]) * cos(2. * x[K] * Y) / 1.128379 - Y * V;
1266 MAX = (int)(5. + (12.5 - x[K]) * .8 * Y);
1267 for (I = 2; I <= MAX; I += 2) {
1268 U = (x[K] * V + U) / RI[I];
1269 V = (x[K] * U + V) / RI[I + 1];
1273 ls_attenuation[K] = 1.128379 * VV *
fac;
1277 if (Y < 11. - .6875 * x[K])
goto L113;
1281 ls_attenuation[K] = Y * (HH[3] / (Y2 + U * U) + HH[3] / (Y2 + V * V)) * fac;
1289 ls_attenuation[K] = Y *
1290 (HH[1] / (Y2 + U * U) + HH[1] / (Y2 + V * V) +
1291 HH[2] / (Y2 + UU * UU) + HH[2] / (Y2 + VV * VV)) *
1316 const Numeric df_cm_abs = fabs(df_cm);
1321 if (df_cm_abs <= 5) {
1323 }
else if (df_cm_abs <= 22) {
1324 chi += n2 * 1.968 * exp(-0.1354 * df_cm_abs);
1325 }
else if (df_cm_abs <= 50) {
1326 chi += n2 * 0.160 * exp(-0.0214 * df_cm_abs);
1328 chi += n2 * 0.162 * exp(-0.0216 * df_cm_abs);
1332 if (df_cm_abs <= 5) {
1334 }
else if (df_cm_abs <= 22) {
1335 chi += o2 * 1.968 * exp(-0.1354 * df_cm_abs);
1336 }
else if (df_cm_abs <= 50) {
1337 chi += o2 * 0.160 * exp(-0.0214 * df_cm_abs);
1339 chi += o2 * 0.162 * exp(-0.0216 * df_cm_abs);
1376 const Numeric gamma2 = gamma * gamma;
1388 ls_attenuation[
i] = chi * fac / (df * df + gamma2);
1451 ls_attenuation[
i] *= chi;
1478 Vector& ls_dattenuation_dfrequency_term,
1479 Vector& ls_dphase_dfrequency_term,
1480 Vector& ls_dattenuation_dpressure_term,
1481 Vector& ls_dphase_dpressure_term,
1492 const bool do_phase,
1493 const bool do_partials)
1508 const Numeric y = gamma / (sigma);
1511 for (
Index ii = 0; ii < nf; ii++) {
1512 const Numeric x = (f_grid[ii] - f0) / sigma;
1515 ls_attenuation[ii] = fac * w.real();
1516 if (do_phase || do_partials) ls_phase[ii] = fac * w.imag();
1522 ls_dattenuation_dfrequency_term[ii] =
1523 2. * (y * ls_phase[ii] - x * ls_attenuation[ii]);
1526 ls_dattenuation_dpressure_term[ii] =
1527 2. * (y * ls_attenuation[ii] + x * ls_phase[ii] - fac * sqrt_invPI);
1531 ls_dphase_dfrequency_term[ii] = -ls_dattenuation_dpressure_term[ii];
1534 ls_dphase_dpressure_term[ii] = ls_dattenuation_dfrequency_term[ii];
1571 dx_dT[iv] = (-dPF_dT - dDF_dT - (f[iv] - f0) / sigma * dsigma_dT) / sigma;
1578 dy_dT = (dgamma_dT - gamma / sigma * dsigma_dT) / sigma;
1581 dFu_dT = -1.0 / sigma * dsigma_dT;
1592 dx_dF = 1.0 / sigma;
1602 dx_dF0 = -1.0 / sigma;
1612 dy_dgamma = 1.0 / sigma;
1631 dx_dH = -df0_dH / sigma;
1648 dx_dDF = -1.0 / sigma;
1698 const bool do_phase,
1714 const Numeric y = gamma / (sigma);
1717 for (
Index ii = 0; ii < nf; ii++) {
1718 xvector[ii] = (f_grid[ii] - f0) / sigma;
1722 const Complex z(y, -xvector[ii]);
1725 (((((.5641896 * z + 5.912626) * z + 30.18014) * z + 93.15558) * z +
1732 ((((((z + 10.47986) * z + 53.99291) * z + 170.3540) * z + 348.7039) *
1741 ls_attenuation[ii] = fac * C.real();
1742 if (do_phase) ls_phase[ii] = fac * C.imag();
1773 Vector& ls_dattenuation_dfrequency_term,
1774 Vector& ls_dphase_dfrequency_term,
1775 Vector& ls_dattenuation_dpressure_term,
1776 Vector& ls_dphase_dpressure_term,
1787 const bool do_phase,
1788 const bool do_partials)
1808 gamma_2 == df_2 && gamma_2 == f_VC && gamma_2 == eta && gamma_2 == 0;
1810 if (gamma_0 == df_0 && gamma_0 == gamma_2 && test1) {
1811 throw std::runtime_error(
1812 "Doppler line shape not supported in ARTS using HTP.\n");
1818 ls_dattenuation_dfrequency_term,
1819 ls_dphase_dfrequency_term,
1820 ls_dattenuation_dpressure_term,
1821 ls_dphase_dpressure_term,
1838 throw std::runtime_error(
1839 "It is not yet supported to do partial derivation with\n" 1840 "HTP line shape parameters.");
1848 const Complex c_0(gamma_0, df_0);
1851 const Complex c_2(gamma_2, df_2);
1854 const Complex c_0_tilde = (1. - eta) * (c_0 - 1.5 * c_2) + f_VC;
1857 const Complex c_2_tilde = (1. - eta) * c_2;
1860 const Numeric v_a0 = SPEED_OF_LIGHT * gamma_D / f0;
1866 const Complex c1 = sqrtPI / gamma_D;
1867 const Complex v_a02 = v_a0 * v_a0;
1868 const Complex c4 = f_VC - eta * (c_0 - 1.5 * c_2);
1869 const Complex c5 = eta * c_2 / v_a02;
1872 if (c_2_tilde ==
Complex(0., 0.)) {
1873 for (
Index nf = 0; nf < f_grid.
nelem(); nf++) {
1874 const Complex Z1 =
Complex(0., (f0 - f_grid[nf]) / gamma_D) + c_0_tilde;
1883 const Complex B = c1 * v_a02 * ((1. - Z1 * Z1) * w1 + Z1 / sqrtPI);
1886 const Complex HTP = 1. / PI * A / (1. - c4 * A + c5 * B);
1889 ls_attenuation[nf] = HTP.real();
1890 if (do_phase || do_partials) ls_phase[nf] = HTP.imag();
1896 const Complex sqrtY = gamma_D / (2. * c_2_tilde);
1897 const Complex Y = sqrtY * sqrtY;
1899 const Complex sqrtY_t2 = 2. * sqrtY;
1900 const Complex c2 = v_a02 / c_2_tilde / c_2_tilde;
1901 const Complex c3 = sqrtPI / sqrtY_t2;
1903 for (
Index nf = 0; nf < f_grid.
nelem(); nf++) {
1904 const Numeric df = f0 - f_grid[nf];
1911 const Numeric numerical_test =
abs(X) / absY;
1915 if (numerical_test < 3e-8) {
1931 A = c1 * (w_minus - w_plus);
1934 B = c2 * (-1. + c3 * ((1. - Z_minus * Z_minus) * w_minus -
1935 (1. - Z_plus * Z_plus) * w_plus));
1936 }
else if (numerical_test > 1e15) {
1947 Complex Aconst = (1. / sqrtPI - sqrtX * w1);
1950 A = 2. * c1 * Aconst;
1953 B = c2 * (-1. + 2. * sqrtPI * (1. - X - 2. * Y) * Aconst +
1954 2. * sqrtPI * Z2 * w2);
1961 const Complex Z_minus = Z_plus - sqrtY_t2;
1970 A = c1 * (w_minus - w_plus);
1973 B = c2 * (-1. + c3 * ((1. - Z_minus * Z_minus) * w_minus -
1974 (1. - Z_plus * Z_plus) * w_plus));
1978 const Complex HTP = 1. / PI * A / (1. - c4 * A + c5 * B);
1981 ls_attenuation[nf] = HTP.real();
1982 if (do_phase || do_partials) ls_phase[nf] = HTP.imag();
2027 ls_attenuation[
i] = fac / ((f_grid[
i] - f0) * (f_grid[
i] - f0));
2091 fac[
i] = f_grid[
i] / abs_f0;
2112 fac[
i] = 1.0 / abs_f0;
2127 fac[
i] = f_grid[
i] * dabs_f0;
2152 (PLANCK_CONST * f0) / (2.000e0 * BOLTZMAN_CONST * T) /
2153 sinh((PLANCK_CONST * f0) / (2.000e0 * BOLTZMAN_CONST * T));
2159 fac[
i] = mafac * (f_grid[
i] * f_grid[
i]) / f0_2;
2169 const Numeric sinh_term = sinh((hf0) / (2 * kT));
2170 const Numeric cosh_term = cosh((hf0) / (2.0 * kT));
2171 const Numeric dmafac_dT = -(hf0 * (2.0 * kT * sinh_term - hf0 * cosh_term)) /
2172 (4.0 * T * kT * kT * sinh_term * sinh_term);
2178 fac[
i] = dmafac_dT * (f_grid[
i] * f_grid[
i]) / f0_2;
2188 (PLANCK_CONST * f0) / (2.000e0 * BOLTZMAN_CONST * T) /
2189 sinh((PLANCK_CONST * f0) / (2.000e0 * BOLTZMAN_CONST * T));
2195 fac[
i] = mafac * (2.0 * f_grid[
i]) / f0_2;
2204 const Numeric kT = 2.0 * BOLTZMAN_CONST * T;
2207 const Numeric term1 = sinh((f0 * PLANCK_CONST) / kT);
2211 (kT * term1 + f0 * PLANCK_CONST * cosh((f0 * PLANCK_CONST) / kT))) /
2212 (f0 * f0 * kT * kT * term1 * term1);
2215 fac[
i] = (f_grid[
i] * f_grid[
i]) * ddenom;
2243 const Numeric kT = 2.0 * BOLTZMAN_CONST * T;
2246 const Numeric denom =
abs(f0) * tanh(PLANCK_CONST *
abs(f0) / kT);
2249 fac[
i] = f_grid[
i] * tanh(PLANCK_CONST * f_grid[
i] / kT) / denom;
2262 const Numeric kT = BOLTZMAN_CONST * T;
2263 const Numeric hf0 = PLANCK_CONST * f0;
2264 const Numeric tanh_term2 = tanh((hf0) / (2.0 * kT));
2265 const Numeric tanh_term2_squared = tanh_term2 * tanh_term2;
2268 const Numeric denom1 = 2.0 * T * kT * f0 * tanh_term2,
2269 denom2 = 2.0 * T * kT * tanh_term2_squared;
2272 const Numeric hf = PLANCK_CONST * f_grid[
i],
2273 tanh_term1 = tanh((hf) / (2.0 * kT)),
2274 tanh_term1_squared = tanh_term1 * tanh_term1;
2276 fac[
i] = (f_grid[
i] * hf * (tanh_term1_squared - 1.0)) / denom1 -
2277 (hf * tanh_term1 * (tanh_term2_squared - 1.0)) / denom2;
2290 const Numeric kT = BOLTZMAN_CONST * T, hf0 = PLANCK_CONST * f0,
2291 tanh_term2 = tanh((hf0) / (2.0 * kT)),
2292 denom = (2 * kT * f0 * tanh_term2);
2295 const Numeric hf = PLANCK_CONST * f_grid[
i],
2296 tanh_term1 = tanh((hf) / (2.0 * kT)),
2297 tanh_term1_squared = tanh_term1 * tanh_term1;
2298 fac[
i] = (hf + 2 * kT * tanh_term1 - hf * tanh_term1_squared) / denom;
2311 const Numeric kT = 2.0 * BOLTZMAN_CONST * T,
2312 term1 = tanh((PLANCK_CONST *
abs(f0)) / kT);
2315 const Numeric ddenom = (PLANCK_CONST * f0 /
abs(f0) * (term1 * term1 - 1)) /
2316 (kT *
abs(f0) * term1 * term1) -
2317 f0 /
abs(f0) / (
abs(f0) *
abs(f0) * term1);
2320 fac[
i] = f_grid[
i] * tanh(PLANCK_CONST * f_grid[
i] / kT) * ddenom;
2345 const Numeric denom = f0 * f0;
2348 fac[
i] = f_grid[
i] * f_grid[
i] / denom;
2364 const Numeric denom = f0 * f0;
2367 fac[
i] = 2.0 * f_grid[
i] / denom;
2377 const Numeric ddenom = -0.5 * f0 * f0 * f0;
2380 fac[
i] = f_grid[
i] * f_grid[
i] / ddenom;
2396 const bool PHASE =
true;
2397 const bool NO_PHASE =
false;
2398 const bool PARTIALS =
true;
2399 const bool NO_PARTIALS =
false;
2406 "This lineshape does nothing. It only exists, because formally\n" 2407 "you have to specify a lineshape also for continuum tags.",
2413 "The Lorentz line shape.",
2419 "The mirrored Lorentz line shape.",
2425 "The Doppler line shape.",
2432 "The Voigt line shape. Approximation by Kuntz: Accuracy 2*10-6",
2445 "The Voigt line shape. Approximation by Kuntz: Accuracy 2*10-3",
2452 "The Voigt line shape. Approximation by Kuntz: Accuracy 2*10-4",
2458 LineshapeRecord(
"Voigt_Drayson",
2459 "The Voigt line shape. Approximation by Drayson.",
2466 "Special line shape for CO2 in the infrared, neglecting Doppler\n" 2467 "broadening and details of line mixing. The line shape can be\n" 2469 " chi(f,f0) * Lorentz(f,f0) \n" 2471 "The chi-factor follows Cousin et al. 1985. Broadening by N2 and O2\n" 2472 "is considered, while self-broadening (CO2-CO2) is neglected." 2474 "NOTE: Temperature dependency is not yet included. The chi factor is\n" 2482 "Special line shape for CO2 in the infrared, neglecting details of\n" 2483 "line mixing. The line shape can be expressed as\n" 2484 " chi(f,f0) * Drayson(f,f0) \n" 2486 "The chi-factor follows Cousin et al. 1985. Broadening by N2 and O2\n" 2487 "is considered, while self-broadening (CO2-CO2) is neglected.\n" 2489 "NOTE: Temperature dependency is not yet included. The chi factor is\n" 2496 "Faddeeva_Algorithm_916",
2497 "Voigt and Faraday-Voigt function as per Faddeeva function solution by JPL.\n" 2498 "Line shape is considered from w(z)=exp(-z^2)*erfc(-iz) where z=v'+ia, and \n" 2499 "v' is a Doppler weighted freqeuncy parameter and a is a Doppler weighted \n" 2500 "pressure parameter.",
2513 "Line shape is considered as described by the Hartmann-Tran profile.",
2520 "Classic line shape. Solving the complex error function returns both parts\n" 2521 "of the refractive index.",
2527 LineshapeRecord(
"O2NonResonant",
2528 "Special line shape. Only use for non-resonant O2.",
2547 LineshapeNormRecord(
"no_norm",
2548 "No normalization of the lineshape.",
2555 "Rosenkranz_quadratic",
2556 "Quadratic normalization of the lineshape with (f/f0)^2*h*f0/(2*k*T)/sinh(h*f0/(2*k*T)).",
2564 "Van Vleck Huber normalization of the lineshape with\n" 2565 " (f*tanh(h*f/(2*k*T))) / (f0*tanh(h*f0/(2*k*T))).\n" 2566 " The denominator is a result of catalogue intensities.",
2574 "Van Vleck Weiskopf normalization of the lineshape with (f*f) / (f0*f0).\n",
INDEX Index
The type to use for all integer numbers and indices.
const Numeric PLANCK_CONST
Global constant, the Planck constant [Js].
void lineshape_norm_VVW_dF(Vector &fac, const Numeric f0, ConstVectorView f_grid, const Numeric)
Array< LineshapeNormRecord > lineshape_norm_data
void lineshape_no_shape(Vector &, Vector &, Vector &, Vector &, Vector &, Vector &, Vector &, const Numeric, const Numeric, const Numeric, const Numeric, const Numeric, const Numeric, const Numeric, const Numeric, ConstVectorView, const bool, const bool)
A class implementing complex numbers for ARTS.
void lineshape_CO2_drayson(Vector &ls_attenuation, Vector &, Vector &, Vector &, Vector &, Vector &, Vector &X, const Numeric f0, const Numeric gamma, const Numeric, const Numeric, const Numeric, const Numeric, const Numeric sigma, const Numeric, ConstVectorView f_grid, const bool, const bool)
void faddeeva_algorithm_916(Vector &ls_attenuation, Vector &ls_phase, Vector &ls_dattenuation_dfrequency_term, Vector &ls_dphase_dfrequency_term, Vector &ls_dattenuation_dpressure_term, Vector &ls_dphase_dpressure_term, Vector &, const Numeric f0, const Numeric gamma, const Numeric, const Numeric, const Numeric, const Numeric, const Numeric sigma, const Numeric, ConstVectorView f_grid, const bool do_phase, const bool do_partials)
void lineshape_norm_linear_dF(Vector &fac, const Numeric f0, ConstVectorView f_grid, const Numeric)
void lineshape_o2nonresonant(Vector &ls_attenuation, Vector &, Vector &, Vector &, Vector &, Vector &, Vector &, const Numeric f0, const Numeric gamma, const Numeric, const Numeric, const Numeric, const Numeric, const Numeric, const Numeric, ConstVectorView f_grid, const bool, const bool)
const Numeric BOLTZMAN_CONST
Global constant, the Boltzmann constant [J/K].
void deprecated(Vector &, Vector &, Vector &, Vector &, Vector &, Vector &, Vector &, const Numeric, const Numeric, const Numeric, const Numeric, const Numeric, const Numeric, const Numeric, const Numeric, ConstVectorView, const bool, const bool)
void lineshape_norm_VVW_dT(Vector &fac, const Numeric, ConstVectorView, const Numeric)
void lineshape_norm_quadratic_Rosenkranz(Vector &fac, const Numeric f0, ConstVectorView f_grid, const Numeric T)
Numeric fac(const Index n)
fac
void lineshape_norm_VVH_dF0(Vector &fac, const Numeric f0, ConstVectorView f_grid, const Numeric T)
void lineshape_norm_no_norm_dF(Vector &fac, const Numeric, ConstVectorView, const Numeric)
cmplx FADDEEVA() w(cmplx z, double relerr)
long bfun6_(Numeric y, Numeric x)
void lineshape_norm_VVH(Vector &fac, const Numeric f0, ConstVectorView f_grid, const Numeric T)
void lineshape_norm_VVH_dF(Vector &fac, const Numeric f0, ConstVectorView f_grid, const Numeric T)
Index nelem() const
Returns the number of elements.
void define_lineshape_data()
This file contains the definition of Array.
void w_x_plus_iy_dF(Numeric &dx_dF, const Numeric &sigma)
void lineshape_norm_no_norm(Vector &fac, const Numeric, ConstVectorView, const Numeric)
void lineshape_norm_quadratic_Rosenkranz_dF0(Vector &fac, const Numeric f0, ConstVectorView f_grid, const Numeric T)
The global header file for ARTS.
void hartmann_tran_lineshape(Vector &ls_attenuation, Vector &ls_phase, Vector &ls_dattenuation_dfrequency_term, Vector &ls_dphase_dfrequency_term, Vector &ls_dattenuation_dpressure_term, Vector &ls_dphase_dpressure_term, Vector &xvector, const Numeric f0, const Numeric gamma_0, const Numeric gamma_2, const Numeric eta, const Numeric df_0, const Numeric df_2, const Numeric gamma_D, const Numeric f_VC, ConstVectorView f_grid, const bool do_phase, const bool do_partials)
void lineshape_voigt_drayson(Vector &ls_attenuation, Vector &, Vector &, Vector &, Vector &, Vector &, Vector &x, const Numeric f0, const Numeric gamma, const Numeric, const Numeric, const Numeric, const Numeric, const Numeric sigma, const Numeric, ConstVectorView f_grid, const bool, const bool)
void w_x_plus_iy_dDF(Numeric &dx_dDF, const Numeric &sigma)
std::complex< Numeric > Complex
void lineshape_norm_no_norm_dF0(Vector &fac, const Numeric, ConstVectorView, const Numeric)
void lineshape_doppler(Vector &ls_attenuation, Vector &, Vector &, Vector &, Vector &, Vector &, Vector &, const Numeric f0, const Numeric, const Numeric, const Numeric, const Numeric, const Numeric, const Numeric sigma, const Numeric, ConstVectorView f_grid, const bool, const bool)
const Numeric HZ2CM
Global constant, converts Hz to cm-1.
void lineshape_CO2_lorentz(Vector &ls_attenuation, Vector &, Vector &, Vector &, Vector &, Vector &, Vector &, const Numeric f0, const Numeric gamma, const Numeric, const Numeric, const Numeric, const Numeric, const Numeric, const Numeric, ConstVectorView f_grid, const bool, const bool)
NUMERIC Numeric
The type to use for all floating point numbers.
void w_x_plus_iy_dH(Numeric &dx_dH, const Numeric &sigma, const Numeric &df0_dH)
Declarations required for the calculation of absorption coefficients.
Implementation of Matrix, Vector, and such stuff.
Numeric pow(const Rational base, Numeric exp)
Power of.
void w_x_plus_iy_dgamma(Numeric &dy_dgamma, const Numeric &sigma)
void lineshape_norm_linear_dF0(Vector &fac, const Numeric f0, ConstVectorView f_grid, const Numeric)
This can be used to make arrays out of anything.
void lineshape_lorentz(Vector &ls_attenuation, Vector &ls_phase, Vector &, Vector &, Vector &, Vector &, Vector &, const Numeric f0, const Numeric gamma, const Numeric, const Numeric, const Numeric, const Numeric, const Numeric, const Numeric, ConstVectorView f_grid, const bool do_phase, const bool)
const Numeric PI
Global constant, pi.
void lineshape_norm_no_norm_dT(Vector &fac, const Numeric, ConstVectorView, const Numeric)
Array< LineshapeRecord > lineshape_data
void lineshape_norm_linear_dT(Vector &fac, const Numeric, ConstVectorView, const Numeric)
void lineshape_mirrored_lorentz(Vector &ls_attenuation, Vector &ls_phase, Vector &, Vector &, Vector &, Vector &, Vector &, const Numeric f0, const Numeric gamma, const Numeric, const Numeric, const Numeric, const Numeric, const Numeric, const Numeric, ConstVectorView f_grid, const bool do_phase, const bool)
A constant view of a Vector.
void lineshape_norm_VVH_dT(Vector &fac, const Numeric f0, ConstVectorView f_grid, const Numeric T)
void define_lineshape_norm_data()
void w_x_plus_iy_dT(Vector &dx_dT, Numeric &dy_dT, Numeric &dFu_dT, ConstVectorView f, const Numeric &f0, const Numeric &sigma, const Numeric &dPF_dT, const Numeric &dDF_dT, const Numeric &dsigma_dT, const Numeric &gamma, const Numeric &dgamma_dT)
void lineshape_norm_quadratic_Rosenkranz_dF(Vector &fac, const Numeric f0, ConstVectorView f_grid, const Numeric T)
void lineshape_norm_quadratic_Rosenkranz_dT(Vector &fac, const Numeric f0, ConstVectorView f_grid, const Numeric T)
void lineshape_norm_VVW(Vector &fac, const Numeric f0, ConstVectorView f_grid, const Numeric)
void hui_etal_1978_lineshape(Vector &ls_attenuation, Vector &ls_phase, Vector &, Vector &, Vector &, Vector &, Vector &xvector, const Numeric f0, const Numeric gamma, const Numeric, const Numeric, const Numeric, const Numeric, const Numeric sigma, const Numeric, ConstVectorView f_grid, const bool do_phase, const bool)
long int bfun3_(Numeric y, Numeric x)
void lineshape_norm_VVW_dF0(Vector &fac, const Numeric f0, ConstVectorView f_grid, const Numeric)
const Numeric SPEED_OF_LIGHT
void lineshape_norm_linear(Vector &fac, const Numeric f0, ConstVectorView f_grid, const Numeric)
void chi_cousin(Numeric &chi, const Numeric &df)
void lineshape_voigt_kuntz6(Vector &ls_attenuation, Vector &, Vector &ls_dattenuation_dfrequency_term, Vector &, Vector &ls_dattenuation_dpressure_term, Vector &, Vector &x, const Numeric f0, const Numeric gamma, const Numeric, const Numeric, const Numeric, const Numeric, const Numeric sigma, const Numeric, ConstVectorView f_grid, const bool, const bool do_partials)
void w_x_plus_iy_dF0(Numeric &dx_dF0, const Numeric &sigma)
Numeric sqrt(const Rational r)
Square root.