67 fs = exp(-kI * s) * (I * cosh(kQ * s) + Q * sinh(kQ * s));
162 fa =
ext_I(I, Q, KI, KQ, sa);
164 fb =
ext_I(I, Q, KI, KQ, sb);
172 macheps = DBL_EPSILON;
175 if (abs(fc) < abs(fb)) {
184 tol = 2.0 * macheps * abs(sb) + t;
187 if (abs(m) <= tol || fb == 0.0) {
191 if (abs(e) < tol || abs(fa) <= abs(fb)) {
203 p = s * (2.0 * m * q * (q - r) - (sb - sa) * (r - 1.0));
204 q = (q - 1.0) * (r - 1.0) * (s - 1.0);
216 if (2.0 * p < 3.0 * m * q - abs(tol * q) && p < abs(0.5 * s * q)) {
228 }
else if (0.0 < m) {
234 fb =
ext_I(I, Q, KI, KQ, sb);
237 if ((0.0 < fb && 0.0 < fc) || (fb <= 0.0 && fc <= 0.0)) {
247 MatrixView ext_mat_mono,
248 VectorView abs_vec_mono,
249 Numeric& temperature,
250 const Agenda& propmat_clearsky_agenda,
251 const Numeric& f_mono,
255 ConstVectorView p_grid,
256 ConstTensor3View t_field,
257 ConstTensor4View vmr_field) {
258 const Index ns = vmr_field.nbooks();
263 Matrix vmr_mat(ns, 1), itw_field;
266 StokesVector local_abs_vec;
267 StokesVector local_nlte_source_dummy;
268 PropagationMatrix local_ext_mat;
269 PropagationMatrix local_propmat_clearsky;
270 ArrayOfPropagationMatrix
272 ArrayOfStokesVector local_dnlte_source_dx_dummy;
274 ao_gp_lat[0] = gp_lat;
275 ao_gp_lon[0] = gp_lon;
279 itw2p(p_vec, p_grid, ao_gp_p, itw_p);
286 t_vec, 3, t_field, ao_gp_p, ao_gp_lat, ao_gp_lon, itw_field);
288 for (Index is = 0; is < ns; is++) {
291 vmr_field(is, joker, joker, joker),
298 temperature = t_vec[0];
300 const Vector rtp_mag_dummy(3, 0);
301 const Vector ppath_los_dummy;
306 local_propmat_clearsky,
307 local_nlte_source_dummy,
309 local_dnlte_source_dx_dummy,
318 Vector{vmr_mat(joker, 0)},
319 propmat_clearsky_agenda);
322 local_ext_mat, local_abs_vec, local_propmat_clearsky);
324 local_ext_mat.MatrixAtPosition(ext_mat_mono);
325 abs_vec_mono = local_abs_vec.VectorAtPosition();
329 MatrixView ext_mat_mono,
330 VectorView abs_vec_mono,
332 Numeric& temperature,
333 const Agenda& propmat_clearsky_agenda,
334 const Index stokes_dim,
336 const Vector& f_grid,
340 ConstVectorView p_grid_cloud,
341 ConstTensor3View t_field_cloud,
342 ConstTensor4View vmr_field_cloud,
343 const Tensor4& pnd_field,
346 const Vector& rte_los)
349 const Index ns = vmr_field_cloud.nbooks();
350 const Index N_se = pnd_field.nbooks();
351 Matrix pnd_ppath(N_se, 1);
357 Matrix vmr_ppath(ns, 1), itw_field;
360 ArrayOfPropagationMatrix
362 ArrayOfStokesVector local_dnlte_source_dx_dummy;
363 PropagationMatrix local_propmat_clearsky;
364 StokesVector local_nlte_source_dummy;
365 StokesVector local_abs_vec;
366 PropagationMatrix local_ext_mat;
369 ao_gp_lat[0] = gp_lat;
370 ao_gp_lon[0] = gp_lon;
384 pnd_vec = pnd_ppath(joker, 0);
385 temperature = t_ppath[0];
387 const Vector rtp_mag_dummy(3, 0);
388 const Vector ppath_los_dummy;
392 local_propmat_clearsky,
393 local_nlte_source_dummy,
395 local_dnlte_source_dx_dummy,
398 Vector{f_grid[Range(f_index, 1)]},
404 Vector{vmr_ppath(joker, 0)},
405 propmat_clearsky_agenda);
408 local_ext_mat, local_abs_vec, local_propmat_clearsky);
410 local_ext_mat.MatrixAtPosition(ext_mat_mono);
411 abs_vec_mono = local_abs_vec.VectorAtPosition();
413 ArrayOfArrayOfTensor5 ext_mat_Nse;
414 ArrayOfArrayOfTensor4 abs_vec_Nse;
417 ArrayOfTensor5 ext_mat_ssbulk;
418 ArrayOfTensor4 abs_vec_ssbulk;
420 Tensor5 ext_mat_bulk;
421 Tensor4 abs_vec_bulk;
426 Matrix dir_array(1, 2, 0.);
427 dir_array(0, joker) = sca_dir;
454 ext_mat_mono += ext_mat_bulk(0, 0, 0, joker, joker);
455 abs_vec_mono += abs_vec_bulk(0, 0, 0, joker);
459 VectorView temperature,
466 ConstVectorView p_grid_cloud,
467 ConstTensor3View t_field_cloud,
468 ConstTensor4View vmr_field_cloud,
469 ConstTensor4View pnd_field) {
470 Index np = gp_p.
nelem();
472 Index ns = vmr_field_cloud.nbooks();
473 Index N_se = pnd_field.nbooks();
477 Index atmosphere_dim = 3;
479 for (Index i = 0; i < np; i++) {
481 gp_p_cloud[i].idx -= cloudbox_limits[0];
482 gp_lat_cloud[i].idx -= cloudbox_limits[2];
483 gp_lon_cloud[i].idx -= cloudbox_limits[4];
486 const Index n1 = cloudbox_limits[1] - cloudbox_limits[0];
487 const Index n2 = cloudbox_limits[3] - cloudbox_limits[2];
488 const Index n3 = cloudbox_limits[5] - cloudbox_limits[4];
501 itw2p(pressure, p_grid_cloud, gp_p_cloud, itw_p);
508 itw_field, atmosphere_dim, gp_p_cloud, gp_lat_cloud, gp_lon_cloud);
518 for (Index is = 0; is < ns; is++) {
521 vmr_field_cloud(is, joker, joker, joker),
530 for (Index i_se = 0; i_se < N_se; i_se++) {
535 pnd_field(i_se, joker, joker, joker),
544 ConstMatrixView ext_mat,
545 const Index stokes_dim) {
550 if (stokes_dim == 1) {
559 if (ext_mat(1, 0) != 0) {
563 if (stokes_dim >= 3) {
568 if (ext_mat(2, 0) != 0 || ext_mat(2, 1) != 0) {
572 if (stokes_dim > 3) {
580 if (ext_mat(3, 0) != 0 || ext_mat(3, 1) != 0) {
582 }
else if (ext_mat(3, 2) != 0) {
619 ConstMatrixView ext_mat,
620 const Numeric& lstep) {
621 const Index stokes_dim = ext_mat.ncols();
624 ARTS_ASSERT(trans_mat.nrows() == stokes_dim && trans_mat.ncols() == stokes_dim);
641 trans_mat(0, 0) = exp(-ext_mat(0, 0) * lstep);
642 for (Index i = 1; i < stokes_dim; i++) {
643 trans_mat(i, i) = trans_mat(0, 0);
647 else if (icase == 2 && stokes_dim < 3) {
650 const Numeric tI = exp(-ext_mat(0, 0) * lstep);
651 const Numeric HQ = ext_mat(0, 1) * lstep;
652 trans_mat(0, 0) = tI * cosh(HQ);
653 trans_mat(1, 1) = trans_mat(0, 0);
654 trans_mat(1, 0) = -tI * sinh(HQ);
655 trans_mat(0, 1) = trans_mat(1, 0);
678 Matrix ext_mat_ds{ext_mat};
679 ext_mat_ds *= -lstep;
681 constexpr Index q = 10;
682 matrix_exp(trans_mat, ext_mat_ds, q);
687 MatrixView trans_mat,
689 const Agenda& propmat_clearsky_agenda,
690 const Index stokes_dim,
692 const Vector& f_grid,
693 const Vector& p_grid,
694 const Tensor3& t_field,
695 const Tensor4& vmr_field,
697 const Tensor4& pnd_field,
701 const Index np = ppath.
np;
702 ArrayOfMatrix ext_matArray(2);
703 ArrayOfMatrix trans_matArray(2);
704 Index N_se = pnd_field.nbooks();
705 Vector pnd_vec(N_se);
706 Vector abs_vec_mono(stokes_dim);
707 Matrix ext_mat(stokes_dim, stokes_dim);
708 Matrix ext_mat_mono(stokes_dim, stokes_dim);
709 Matrix incT(stokes_dim, stokes_dim, 0.0);
719 Range p_range(cloudbox_limits[0],
720 cloudbox_limits[1] - cloudbox_limits[0] + 1);
721 Range lat_range(cloudbox_limits[2],
722 cloudbox_limits[3] - cloudbox_limits[2] + 1);
723 Range lon_range(cloudbox_limits[4],
724 cloudbox_limits[5] - cloudbox_limits[4] + 1);
738 propmat_clearsky_agenda,
746 t_field(p_range, lat_range, lon_range),
747 vmr_field(joker, p_range, lat_range, lon_range),
751 Vector{ppath.
los(np - 1, joker)});
757 propmat_clearsky_agenda,
768 trans_matArray[1] = trans_mat;
769 ext_matArray[1] = ext_mat_mono;
772 for (Index ip = np - 2; ip >= 0; ip--) {
773 dl = ppath.
lstep[ip];
775 ext_matArray[0] = ext_matArray[1];
776 trans_matArray[0] = trans_matArray[1];
790 propmat_clearsky_agenda,
798 t_field(p_range, lat_range, lon_range),
799 vmr_field(joker, p_range, lat_range, lon_range),
803 Vector{ppath.
los(ip, joker)});
809 propmat_clearsky_agenda,
820 ext_matArray[1] = ext_mat_mono;
821 ext_mat = ext_matArray[0];
822 ext_mat += ext_matArray[1];
825 Index extmat_case = 0;
826 ext2trans(incT, extmat_case, ext_mat, dl / 2);
829 mult(trans_mat, incT, trans_matArray[1]);
830 trans_matArray[1] = trans_mat;
855 Vector& abs_vec_mono,
856 Numeric& temperature,
857 MatrixView ext_mat_mono,
864 Index& termination_flag,
866 const Agenda& ppath_step_agenda,
867 const Numeric& ppath_lmax,
868 const Numeric& ppath_lraytrace,
869 const Numeric& taustep_limit,
870 const Agenda& propmat_clearsky_agenda,
871 const Index stokes_dim,
873 const Vector& f_grid,
874 const Vector& p_grid,
875 const Vector& lat_grid,
876 const Vector& lon_grid,
877 const Tensor3& z_field,
878 const Vector& refellipsoid,
879 const Matrix& z_surface,
880 const Tensor3& t_field,
881 const Tensor4& vmr_field,
883 const Tensor4& pnd_field,
886 ArrayOfMatrix evol_opArray(2);
887 ArrayOfMatrix ext_matArray(2);
888 ArrayOfVector abs_vecArray(2);
889 ArrayOfVector pnd_vecArray(2);
890 Matrix ext_mat(stokes_dim, stokes_dim);
891 Matrix incT(stokes_dim, stokes_dim, 0.0);
893 Matrix T(stokes_dim, stokes_dim);
895 Numeric ds, dl = -999;
897 Matrix old_evol_op(stokes_dim, stokes_dim);
903 evol_opArray[1] = evol_op;
906 Range p_range(cloudbox_limits[0],
907 cloudbox_limits[1] - cloudbox_limits[0] + 1);
908 Range lat_range(cloudbox_limits[2],
909 cloudbox_limits[3] - cloudbox_limits[2] + 1);
910 Range lon_range(cloudbox_limits[4],
911 cloudbox_limits[5] - cloudbox_limits[4] + 1);
954 propmat_clearsky_agenda,
962 t_field(p_range, lat_range, lon_range),
963 vmr_field(joker, p_range, lat_range, lon_range),
967 Vector{ppath_step.
los(0, joker)});
973 propmat_clearsky_agenda,
985 ext_matArray[1] = ext_mat_mono;
986 abs_vecArray[1] = abs_vec_mono;
987 tArray[1] = temperature;
988 pnd_vecArray[1] = pnd_vec;
991 Numeric r = rng.
get(0.0, 1.0)();
993 termination_flag = 0;
995 while ((evol_op(0, 0) > r) && (!termination_flag)) {
999 "100000 path points have been reached. "
1000 "Is this an infinite loop?");
1002 evol_opArray[0] = evol_opArray[1];
1003 ext_matArray[0] = ext_matArray[1];
1004 abs_vecArray[0] = abs_vecArray[1];
1005 tArray[0] = tArray[1];
1006 pnd_vecArray[0] = pnd_vecArray[1];
1019 bool oktaustep =
false;
1020 Index ppath_try = 1;
1021 const Index lmax_limit = 10;
1023 while (!oktaustep) {
1025 if (ip == ppath_step.
np - 1) {
1026 Numeric lmax = taustep_limit / ext_mat_mono(0, 0);
1027 if (ppath_lmax > 0) {
1028 lmax =
min(ppath_lmax, lmax);
1030 if (lmax < lmax_limit) {
1040 Vector{f_grid[Range(f_index, 1)]},
1060 propmat_clearsky_agenda,
1064 ppath_step.
gp_p[ip],
1068 t_field(p_range, lat_range, lon_range),
1069 vmr_field(joker, p_range, lat_range, lon_range),
1073 Vector{ppath_step.
los(ip, joker)});
1079 propmat_clearsky_agenda,
1081 ppath_step.
gp_p[ip],
1090 dl = ppath_step.
lstep[ip - 1];
1096 if (ppath_try > 1 || ext_mat_mono(0, 0) <= ext_matArray[0](0, 0) ||
1097 (ext_mat_mono(0, 0) + ext_matArray[0](0, 0)) * dl / 2 <=
1111 ext_matArray[1] = ext_mat_mono;
1112 abs_vecArray[1] = abs_vec_mono;
1113 tArray[1] = temperature;
1114 pnd_vecArray[1] = pnd_vec;
1115 ext_mat = ext_matArray[1];
1116 ext_mat += ext_matArray[0];
1119 Index extmat_case = 0;
1120 ext2trans(incT, extmat_case, ext_mat, dl / 2);
1123 mult(evol_op, evol_opArray[0], incT);
1124 evol_opArray[1] = evol_op;
1126 if (evol_op(0, 0) > r) {
1131 if (ip == ppath_step.
np - 1) {
1133 termination_flag = 2;
1136 (Numeric)(p_grid.nelem() - 1) - 1e-3) {
1137 termination_flag = 1;
1143 if (termination_flag) {
1144 rte_pos = ppath_step.
pos(ip, joker);
1145 rte_los = ppath_step.
los(ip, joker);
1155 k = ext_mat(0, 0) / 2;
1156 ds = log(evol_opArray[0](0, 0) / r) / k;
1164 gridpos(gp, x, ConstVectorView{ds});
1167 interp(ext_mat_mono, itw, ext_matArray, gp[0]);
1168 ext_mat = ext_mat_mono;
1169 ext_mat += ext_matArray[gp[0].idx];
1172 Index extmat_case = 0;
1173 ext2trans(incT, extmat_case, ext_mat, ds / 2);
1176 mult(evol_op, evol_opArray[gp[0].idx], incT);
1177 interp(abs_vec_mono, itw, abs_vecArray, gp[0]);
1178 temperature =
interp(itw, tArray, gp[0]);
1179 interp(pnd_vec, itw, pnd_vecArray, gp[0]);
1180 for (Index i = 0; i < 2; i++) {
1181 rte_pos[i] =
interp(itw, ppath_step.
pos(Range(ip - 1, 2), i), gp[0]);
1182 rte_los[i] =
interp(itw, ppath_step.
los(Range(ip - 1, 2), i), gp[0]);
1184 rte_pos[2] =
interp(itw, ppath_step.
pos(Range(ip - 1, 2), 2), gp[0]);
1190 const Index np = ip + 1;
1196 Vector& abs_vec_mono,
1197 Numeric& temperature,
1198 MatrixView ext_mat_mono,
1206 Index& termination_flag,
1208 const Agenda& ppath_step_agenda,
1209 const Numeric& ppath_lmax,
1210 const Numeric& ppath_lraytrace,
1211 const Agenda& propmat_clearsky_agenda,
1212 const bool& anyptype_nonTotRan,
1213 const Index stokes_dim,
1214 const Index f_index,
1215 const Vector& f_grid,
1216 const Vector& Iprop,
1217 const Vector& p_grid,
1218 const Vector& lat_grid,
1219 const Vector& lon_grid,
1220 const Tensor3& z_field,
1221 const Vector& refellipsoid,
1222 const Matrix& z_surface,
1223 const Tensor3& t_field,
1224 const Tensor4& vmr_field,
1226 const Tensor4& pnd_field,
1229 ArrayOfMatrix evol_opArray(2);
1230 ArrayOfMatrix ext_matArray(2);
1231 ArrayOfVector abs_vecArray(2);
1232 ArrayOfVector pnd_vecArray(2);
1233 Matrix ext_mat(stokes_dim, stokes_dim);
1234 Matrix incT(stokes_dim, stokes_dim, 0.0);
1236 Matrix T(stokes_dim, stokes_dim);
1238 Numeric ds, dt = -999, dl = -999;
1240 Matrix old_evol_op(stokes_dim, stokes_dim);
1241 Vector local_rte_los(2);
1251 evol_opArray[1] = evol_op;
1254 Range p_range(cloudbox_limits[0],
1255 cloudbox_limits[1] - cloudbox_limits[0] + 1);
1256 Range lat_range(cloudbox_limits[2],
1257 cloudbox_limits[3] - cloudbox_limits[2] + 1);
1258 Range lon_range(cloudbox_limits[4],
1259 cloudbox_limits[5] - cloudbox_limits[4] + 1);
1277 if (ppath_step.
np == 0) {
1278 termination_flag = 1;
1295 local_rte_los[0] = 180 - ppath_step.
los(0, 0);
1296 local_rte_los[1] = ppath_step.
los(0, 1) - 180;
1302 propmat_clearsky_agenda,
1310 t_field(p_range, lat_range, lon_range),
1311 vmr_field(joker, p_range, lat_range, lon_range),
1321 propmat_clearsky_agenda,
1333 ext_matArray[1] = ext_mat_mono;
1334 abs_vecArray[1] = abs_vec_mono;
1335 tArray[1] = temperature;
1336 pnd_vecArray[1] = pnd_vec;
1339 Numeric r = rng.
get(0.0, 1.0)();
1341 termination_flag = 0;
1347 while ((evop0 > r) && (!termination_flag)) {
1351 "25000 path points have been reached. "
1352 "Is this an infinite loop?");
1354 evol_opArray[0] = evol_opArray[1];
1355 ext_matArray[0] = ext_matArray[1];
1356 abs_vecArray[0] = abs_vecArray[1];
1357 tArray[0] = tArray[1];
1358 pnd_vecArray[0] = pnd_vecArray[1];
1361 if (ip >= ppath_step.
np - 1) {
1367 Vector{f_grid[Range(f_index, 1)]},
1370 if (ppath_step.
np <= 1) {
1371 termination_flag = 1;
1384 dl = ppath_step.
lstep[ip - 1];
1385 dt = dl * 0.5 * (ppath_step.
ngroup[ip - 1] + ppath_step.
ngroup[ip]) /
1390 local_rte_los[0] = 180 - ppath_step.
los(ip, 0);
1391 local_rte_los[1] = ppath_step.
los(ip, 1) - 180;
1397 propmat_clearsky_agenda,
1401 ppath_step.
gp_p[ip],
1405 t_field(p_range, lat_range, lon_range),
1406 vmr_field(joker, p_range, lat_range, lon_range),
1416 propmat_clearsky_agenda,
1418 ppath_step.
gp_p[ip],
1427 ext_matArray[1] = ext_mat_mono;
1428 abs_vecArray[1] = abs_vec_mono;
1429 tArray[1] = temperature;
1430 pnd_vecArray[1] = pnd_vec;
1431 ext_mat = ext_matArray[1];
1432 ext_mat += ext_matArray[0];
1435 Index extmat_case = 0;
1436 ext2trans(incT, extmat_case, ext_mat, dl / 2);
1440 mult(evol_op, incT, evol_opArray[0]);
1441 evol_opArray[1] = evol_op;
1442 evop0 = evol_op(0, 0);
1445 if (stokes_dim > 1 && anyptype_nonTotRan) {
1446 const Numeric Q1 = evol_op(0, 1) * Iprop[1] / Iprop[0];
1454 if (ip >= ppath_step.
np - 1) {
1456 termination_flag = 2;
1459 (Numeric)(p_grid.nelem() - 1) - 1e-3) {
1460 termination_flag = 1;
1466 if (termination_flag != 0) {
1467 if (ip < ppath_step.
np) {
1471 rte_pos = ppath_step.
pos(ip, joker);
1472 rte_los = ppath_step.
los(ip, joker);
1477 const Numeric tol = 0.1;
1480 kI = ext_mat(0, 0) / 2;
1481 kQ = ext_mat(0, 1) / 2;
1482 if (anyptype_nonTotRan) {
1483 const Numeric I1 = evol_opArray[0](0, 0);
1484 const Numeric Q1 = evol_opArray[0](0, 1) * Iprop[1] / Iprop[0];
1488 ds, (Numeric)0.0, ppath_step.
lstep[ip - 1], tol, r, I1, Q1, kI, kQ);
1491 ds = log(evol_opArray[0](0, 0) / r) / kI;
1494 ttot += ds * dt / dl;
1501 gridpos(gp, x, ConstVectorView{ds});
1504 interp(ext_mat_mono, itw, ext_matArray, gp[0]);
1505 ext_mat = ext_mat_mono;
1506 ext_mat += ext_matArray[gp[0].idx];
1509 Index extmat_case = 0;
1510 ext2trans(incT, extmat_case, ext_mat, ds / 2);
1513 mult(evol_op, incT, evol_opArray[gp[0].idx]);
1514 interp(abs_vec_mono, itw, abs_vecArray, gp[0]);
1515 temperature =
interp(itw, tArray, gp[0]);
1516 interp(pnd_vec, itw, pnd_vecArray, gp[0]);
1517 for (Index i = 0; i < 2; i++) {
1518 rte_pos[i] =
interp(itw, ppath_step.
pos(Range(ip - 1, 2), i), gp[0]);
1519 rte_los[i] =
interp(itw, ppath_step.
los(Range(ip - 1, 2), i), gp[0]);
1521 rte_pos[2] =
interp(itw, ppath_step.
pos(Range(ip - 1, 2), 2), gp[0]);
1525 const Index np = ip + 1;
1530 Numeric& g_los_csc_theta,
1533 ConstVectorView rte_los,
1535 const Index f_index,
1536 const Index stokes_dim,
1537 ConstVectorView pnd_vec,
1538 ConstVectorView Z11maxvector,
1540 const Numeric rtp_temperature,
1541 const Index t_interp_order) {
1543 bool tryagain =
true;
1549 Index np = pnd_vec.nelem();
1551 for (Index i = 0; i < np; i++) {
1552 Z11max += Z11maxvector[i] * pnd_vec[i];
1560 ArrayOfArrayOfTensor6 pha_mat_Nse;
1563 ArrayOfTensor6 pha_mat_ssbulk;
1565 Tensor6 pha_mat_bulk;
1567 Matrix pdir(1, 2), idir(1, 2);
1568 Vector t(1, rtp_temperature);
1570 pnds(joker, 0) = pnd_vec;
1574 new_rte_los[1] = rng.
get(-180.0, 180.0)();
1584 pdir(0, joker) = sca_dir;
1585 idir(0, joker) = inc_dir;
1597 pha_mat_ssbulk, ptype_ssbulk, pha_mat_Nse, ptypes_Nse, pnds, t_ok);
1598 pha_mat_Bulk(pha_mat_bulk, ptype_bulk, pha_mat_ssbulk, ptype_ssbulk);
1599 Z = pha_mat_bulk(0, 0, 0, 0, joker, joker);
1601 if (rng.
get(0.0, 1.0)() <= Z(0, 0) / Z11max)
1606 g_los_csc_theta = Z(0, 0) / Csca;
1610 new_rte_los[1] = rng.
get<>(-180., 180.)();
Index TotalNumberOfElements(const Array< Array< base > > &aa)
Determine total number of elements in an ArrayOfArray.
base min(const Array< base > &x)
Min function.
Constants of physical expressions as constexpr.
void ppath_step_agendaExecute(Workspace &ws, Ppath &ppath_step, const Numeric ppath_lmax, const Numeric ppath_lraytrace, const Vector &f_grid, const Agenda &input_agenda)
void propmat_clearsky_agendaExecute(Workspace &ws, PropagationMatrix &propmat_clearsky, StokesVector &nlte_source, ArrayOfPropagationMatrix &dpropmat_clearsky_dx, ArrayOfStokesVector &dnlte_source_dx, const ArrayOfRetrievalQuantity &jacobian_quantities, const ArrayOfSpeciesTag &select_abs_species, const Vector &f_grid, const Vector &rtp_mag, const Vector &rtp_los, const Numeric rtp_pressure, const Numeric rtp_temperature, const EnergyLevelMap &rtp_nlte, const Vector &rtp_vmr, const Agenda &input_agenda)
Index nelem() const ARTS_NOEXCEPT
A C++ standards dependent random number generator class.
auto get(Ts &&...x) const
Returns a random number generator of some random distribution.
bool is_gp_inside_cloudbox(const GridPos &gp_p, const GridPos &gp_lat, const GridPos &gp_lon, const ArrayOfIndex &cloudbox_limits, const bool &include_boundaries, const Index &atmosphere_dim)
void mult(MatrixView C, ConstMatrixView A, const Block &B)
#define ARTS_ASSERT(condition,...)
#define ARTS_USER_ERROR_IF(condition,...)
void gridpos(ArrayOfGridPos &gp, ConstVectorView old_grid, ConstVectorView new_grid, const Numeric &extpolfac)
Set up a grid position Array.
void gridpos_upperend_check(GridPos &gp, const Index &ie)
gridpos_upperend_check
void interpweights(VectorView itw, const GridPos &tc)
Red 1D interpolation weights.
Numeric interp(ConstVectorView itw, ConstVectorView a, const GridPos &tc)
Red 1D Interpolate.
Numeric fractional_gp(const GridPos &gp)
fractional_gp
Array< RetrievalQuantity > ArrayOfRetrievalQuantity
Interpolation classes and functions created for use within Monte Carlo scattering simulations.
void mcPathTraceRadar(Workspace &ws, MatrixView evol_op, Vector &abs_vec_mono, Numeric &temperature, MatrixView ext_mat_mono, RandomNumberGenerator<> &rng, Vector &rte_pos, Vector &rte_los, Vector &pnd_vec, Numeric &stot, Numeric &ttot, Ppath &ppath_step, Index &termination_flag, bool &inside_cloud, const Agenda &ppath_step_agenda, const Numeric &ppath_lmax, const Numeric &ppath_lraytrace, const Agenda &propmat_clearsky_agenda, const bool &anyptype_nonTotRan, const Index stokes_dim, const Index f_index, const Vector &f_grid, const Vector &Iprop, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Tensor3 &z_field, const Vector &refellipsoid, const Matrix &z_surface, const Tensor3 &t_field, const Tensor4 &vmr_field, const ArrayOfIndex &cloudbox_limits, const Tensor4 &pnd_field, const ArrayOfArrayOfSingleScatteringData &scat_data, const Verbosity &verbosity)
mcPathTraceRadar.
bool is_anyptype_nonTotRan(const ArrayOfArrayOfSingleScatteringData &scat_data)
is_anyptype_nonTotRan.
void ext_mat_case(Index &icase, ConstMatrixView ext_mat, const Index stokes_dim)
void clear_rt_vars_at_gp(Workspace &ws, MatrixView ext_mat_mono, VectorView abs_vec_mono, Numeric &temperature, const Agenda &propmat_clearsky_agenda, const Numeric &f_mono, const GridPos &gp_p, const GridPos &gp_lat, const GridPos &gp_lon, ConstVectorView p_grid, ConstTensor3View t_field, ConstTensor4View vmr_field)
clear_rt_vars_at_gp.
constexpr Numeric SPEED_OF_LIGHT
void Sample_los(VectorView new_rte_los, Numeric &g_los_csc_theta, MatrixView Z, RandomNumberGenerator<> &rng, ConstVectorView rte_los, const ArrayOfArrayOfSingleScatteringData &scat_data, const Index f_index, const Index stokes_dim, ConstVectorView pnd_vec, ConstVectorView Z11maxvector, const Numeric Csca, const Numeric rtp_temperature, const Index t_interp_order)
Sample_los.
void Sample_los_uniform(VectorView new_rte_los, RandomNumberGenerator<> &rng)
Sample_los_uniform.
void cloud_atm_vars_by_gp(VectorView pressure, VectorView temperature, MatrixView vmr, MatrixView pnd, const ArrayOfGridPos &gp_p, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon, const ArrayOfIndex &cloudbox_limits, ConstVectorView p_grid_cloud, ConstTensor3View t_field_cloud, ConstTensor4View vmr_field_cloud, ConstTensor4View pnd_field)
cloud_atm_vars_by_gp.
void ext2trans(MatrixView trans_mat, Index &icase, ConstMatrixView ext_mat, const Numeric &lstep)
Converts an extinction matrix to a transmission matrix.
void brent_zero(Numeric &sb, const Numeric &a, const Numeric &b, const Numeric &t, const Numeric &rn, const Numeric &I, const Numeric &Q, const Numeric &KI, const Numeric &KQ)
brent_zero.
void mcPathTraceGeneral(Workspace &ws, MatrixView evol_op, Vector &abs_vec_mono, Numeric &temperature, MatrixView ext_mat_mono, RandomNumberGenerator<> &rng, Vector &rte_pos, Vector &rte_los, Vector &pnd_vec, Numeric &g, Ppath &ppath_step, Index &termination_flag, bool &inside_cloud, const Agenda &ppath_step_agenda, const Numeric &ppath_lmax, const Numeric &ppath_lraytrace, const Numeric &taustep_limit, const Agenda &propmat_clearsky_agenda, const Index stokes_dim, const Index f_index, const Vector &f_grid, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Tensor3 &z_field, const Vector &refellipsoid, const Matrix &z_surface, const Tensor3 &t_field, const Tensor4 &vmr_field, const ArrayOfIndex &cloudbox_limits, const Tensor4 &pnd_field, const ArrayOfArrayOfSingleScatteringData &scat_data, const Verbosity &verbosity)
mcPathTraceGeneral.
Numeric ext_I(const Numeric &I, const Numeric &Q, const Numeric &kI, const Numeric &kQ, const Numeric &s)
ext_I.
void get_ppath_transmat(Workspace &ws, MatrixView trans_mat, const Ppath &ppath, const Agenda &propmat_clearsky_agenda, const Index stokes_dim, const Index f_index, const Vector &f_grid, const Vector &p_grid, const Tensor3 &t_field, const Tensor4 &vmr_field, const ArrayOfIndex &cloudbox_limits, const Tensor4 &pnd_field, const ArrayOfArrayOfSingleScatteringData &scat_data, const Verbosity &verbosity)
get_ppath_transmat.
void cloudy_rt_vars_at_gp(Workspace &ws, MatrixView ext_mat_mono, VectorView abs_vec_mono, VectorView pnd_vec, Numeric &temperature, const Agenda &propmat_clearsky_agenda, const Index stokes_dim, const Index f_index, const Vector &f_grid, const GridPos &gp_p, const GridPos &gp_lat, const GridPos &gp_lon, ConstVectorView p_grid_cloud, ConstTensor3View t_field_cloud, ConstTensor4View vmr_field_cloud, const Tensor4 &pnd_field, const ArrayOfArrayOfSingleScatteringData &scat_data, const ArrayOfIndex &cloudbox_limits, const Vector &rte_los)
cloudy_rt_vars_at_gp.
constexpr Numeric speed_of_light
Speed of light [m/s] From: https://en.wikipedia.org/wiki/2019_redefinition_of_SI_base_units Date: 201...
auto acosd(auto x) noexcept
Returns rad2deg of the arc-cosine of the input.
void opt_prop_ScatSpecBulk(ArrayOfTensor5 &ext_mat, ArrayOfTensor4 &abs_vec, ArrayOfIndex &ptype, const ArrayOfArrayOfTensor5 &ext_mat_se, const ArrayOfArrayOfTensor4 &abs_vec_se, const ArrayOfArrayOfIndex &ptypes_se, ConstMatrixView pnds, ConstMatrixView t_ok)
Scattering species bulk extinction and absorption.
void opt_prop_sum_propmat_clearsky(PropagationMatrix &ext_mat, StokesVector &abs_vec, const PropagationMatrix &propmat_clearsky)
Get optical properties from propmat_clearsky.
void pha_mat_ScatSpecBulk(ArrayOfTensor6 &pha_mat, ArrayOfIndex &ptype, const ArrayOfArrayOfTensor6 &pha_mat_se, const ArrayOfArrayOfIndex &ptypes_se, ConstMatrixView pnds, ConstMatrixView t_ok)
Scattering species bulk phase matrices.
void pha_mat_Bulk(Tensor6 &pha_mat, Index &ptype, const ArrayOfTensor6 &pha_mat_ss, const ArrayOfIndex &ptypes_ss)
Scattering species bulk phase matrix.
void opt_prop_Bulk(Tensor5 &ext_mat, Tensor4 &abs_vec, Index &ptype, const ArrayOfTensor5 &ext_mat_ss, const ArrayOfTensor4 &abs_vec_ss, const ArrayOfIndex &ptypes_ss)
one-line descript
void opt_prop_NScatElems(ArrayOfArrayOfTensor5 &ext_mat, ArrayOfArrayOfTensor4 &abs_vec, ArrayOfArrayOfIndex &ptypes, Matrix &t_ok, const ArrayOfArrayOfSingleScatteringData &scat_data, const Index &stokes_dim, const Vector &T_array, const Matrix &dir_array, const Index &f_index, const Index &t_interp_order)
Extinction and absorption from all scattering elements.
void pha_mat_NScatElems(ArrayOfArrayOfTensor6 &pha_mat, ArrayOfArrayOfIndex &ptypes, Matrix &t_ok, const ArrayOfArrayOfSingleScatteringData &scat_data, const Index &stokes_dim, const Vector &T_array, const Matrix &pdir_array, const Matrix &idir_array, const Index &f_index, const Index &t_interp_order)
Phase matrices from all scattering elements.
Index ppath_what_background(const Ppath &ppath)
Returns the case number for the radiative background.
void ppath_set_background(Ppath &ppath, const Index &case_nr)
Sets the background field of a Ppath structure.
void ppath_start_stepping(Ppath &ppath, const Index &atmosphere_dim, ConstVectorView p_grid, ConstVectorView lat_grid, ConstVectorView lon_grid, ConstTensor3View z_field, ConstVectorView refellipsoid, ConstMatrixView z_surface, const Index &cloudbox_on, const ArrayOfIndex &cloudbox_limits, const bool &ppath_inside_cloudbox_do, ConstVectorView rte_pos, ConstVectorView rte_los, const Verbosity &verbosity)
Initiates a Ppath structure for calculation of a path with ppath_step.
void mirror_los(Vector &los_mirrored, const ConstVectorView &los, const Index &atmosphere_dim)
Determines the backward direction for a given line-of-sight.
void interp_atmfield_gp2itw(Matrix &itw, const Index &atmosphere_dim, const ArrayOfGridPos &gp_p, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon)
Converts atmospheric grid positions to weights for interpolation of an atmospheric field.
void itw2p(VectorView p_values, ConstVectorView p_grid, const ArrayOfGridPos &gp, ConstMatrixView itw)
Converts interpolation weights to pressures.
void interp_atmfield_by_itw(VectorView x, const Index &atmosphere_dim, ConstTensor3View x_field, const ArrayOfGridPos &gp_p, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon, ConstMatrixView itw)
Interpolates an atmospheric field with pre-calculated weights by interp_atmfield_gp2itw.
Structure to store a grid position.
The structure to describe a propagation path and releated quantities.
Matrix los
Line-of-sight at each ppath point.
ArrayOfGridPos gp_lon
Index position with respect to the longitude grid.
Index np
Number of points describing the ppath.
Matrix pos
The distance between start pos and the last position in pos.
ArrayOfGridPos gp_lat
Index position with respect to the latitude grid.
Numeric end_lstep
The distance between end pos and the first position in pos.
Vector lstep
The length between ppath points.
ArrayOfGridPos gp_p
Index position with respect to the pressure grid.
Vector ngroup
The group index of refraction.