98 abs_t = rtp_temperature;
113 abs_lines_per_species.resize(abs_species.
nelem());
117 for (
auto& lines : abs_lines_per_species) lines.resize(0);
119#pragma omp parallel for schedule(dynamic) if (!arts_omp_in_parallel())
120 for (
Index ilines = 0; ilines < abs_lines.
nelem(); ilines++) {
124 if (lines.
NumLines() == 0)
continue;
128 for (
auto& this_tag : abs_species[i]) {
130 if (not same_or_joker(this_tag.Isotopologue(), lines.
Isotopologue()))
134 if (this_tag.lower_freq >= 0 or this_tag.upper_freq >= 0) {
135 const Numeric low = (this_tag.lower_freq >= 0)
136 ? this_tag.lower_freq
137 : std::numeric_limits<Numeric>::lowest();
138 const Numeric upp = (this_tag.upper_freq >= 0)
139 ? this_tag.upper_freq
140 : std::numeric_limits<Numeric>::max();
144 these_lines.
lines.resize(0);
146 if (low <= lines.
lines[k].F0 and upp >= lines.
lines[k].F0)
153 abs_lines_per_species[i].push_back(these_lines);
157 if (lines.
NumLines() == 0)
goto leave_inner_loop;
160 abs_lines_per_species[i].push_back(lines);
161 goto leave_inner_loop;
165 leave_inner_loop : {}
168 abs_lines_per_species.shrink_to_fit();
169 for (
auto& spec_band : abs_lines_per_species)
170 std::sort(spec_band.begin(), spec_band.end(), [](
auto&
a,
auto&
b) {
171 return a.lines.size() and b.lines.size() and
172 a.lines.front().F0 < b.lines.front().F0;
179 Index& propmat_clearsky_agenda_checked,
186 propmat_clearsky_agenda_checked =
false;
193 for (
Index i = 0; i <
Index(Species::Species::FINAL); ++i) {
194 const String specname = Species::toShortName(Species::Species(i));
196 String filename = basename;
197 if (basename.length() && basename[basename.length() - 1] !=
'/')
199 filename += specname;
204 included.push_back(specname);
208 }
catch (
const std::runtime_error& e) {
210 excluded.push_back(specname);
215 out2 <<
" Included Species (" << included.
nelem() <<
"):\n";
216 for (
Index i = 0; i < included.nelem(); ++i)
217 out2 <<
" " << included[i] <<
"\n";
219 out2 <<
" Excluded Species (" << excluded.
nelem() <<
"):\n";
221 out2 <<
" " << excluded[i] <<
"\n";
227 Index& propmat_clearsky_agenda_checked,
234 for (
Index i = 0; i <
Index(Species::Species::FINAL); ++i) {
235 if (Species::Species(i) not_eq Species::Species::Bath) {
236 specs.emplace_back(Species::toShortName(Species::Species(i)));
242 propmat_clearsky_agenda_checked,
253 const Index& atmosphere_dim,
260 "Atmospheric dimension must be 1D, but atmosphere_dim is ",
265 abs_t = t_field(
joker, 0, 0);
282 const Numeric& rtp_temperature,
289 Index n_species = src_coef_per_species.
nelem();
293 Index n_f = src_coef_per_species[0].nrows();
297 "Must have exactly one pressure.")
301 "Frequency dimension of nlte_source does not\n"
302 "match abs_coef_per_species.")
307 for (
Index si = 0; si < n_species; ++si) {
308 sv.
Kjj() = src_coef_per_species[si](
joker, 0);
310 nlte_source.
Kjj() += sv.Kjj();
314 for (
Index ii = 0; ii < jacobian_quantities.
nelem(); ii++) {
315 const auto& deriv = jacobian_quantities[ii];
317 if (not deriv.propmattype())
continue;
319 if (deriv == Jacobian::Atm::Temperature) {
322 for (
Index si = 0; si < n_species; ++si) {
323 sv.
Kjj() = src_coef_per_species[si](
joker, 0);
325 dnlte_source_dx[ii].Kjj() += sv.Kjj();
328 sv.
Kjj() = dsrc_coef_dx[ii](
joker, 0);
330 dnlte_source_dx[ii].Kjj() += sv.Kjj();
334 for (
Index si = 0; si < n_species; ++si) {
335 sv.
Kjj() = src_coef_per_species[si](
joker, 0);
337 dnlte_source_dx[ii].Kjj() += sv.Kjj();
340 sv.
Kjj() = dsrc_coef_dx[ii](
joker, 0);
342 dnlte_source_dx[ii].Kjj() += sv.Kjj();
344 sv.
Kjj() = dsrc_coef_dx[ii](
joker, 0);
346 dnlte_source_dx[ii].Kjj() += sv.Kjj();
360 const Index& stokes_dim,
361 const Index& propmat_clearsky_agenda_checked,
367 !propmat_clearsky_agenda_checked,
368 "You must call *propmat_clearsky_agenda_checkedCalc* before calling this method.")
373 "stokes_dim not in [1, 2, 3, 4]");
384 if (dpropmat_clearsky_dx.
nelem() not_eq nq) {
385 dpropmat_clearsky_dx =
388 for (
auto& pm : dpropmat_clearsky_dx) {
389 if (pm.StokesDimensions() == stokes_dim and
390 pm.NumberOfFrequencies() == nf) {
407 if (dnlte_source_dx.
nelem() not_eq nq) {
410 for (
auto& pm : dnlte_source_dx) {
411 if (pm.StokesDimensions() == stokes_dim and
412 pm.NumberOfFrequencies() == nf) {
425 const Index& stokes_dim,
426 const Index& atmosphere_dim,
436 for (
Index sp = 0; sp < abs_species.
nelem() && ife < 0; sp++) {
437 if (abs_species[sp].FreeElectrons()) {
443 "Free electrons not found in *abs_species* and "
444 "Faraday rotation can not be calculated.");
447 if (select_abs_species.
nelem() and select_abs_species not_eq abs_species[ife])
return;
461 "To include Faraday rotation, stokes_dim >= 3 is required.")
463 atmosphere_dim == 1 && rtp_los.
nelem() < 1,
464 "For applying propmat_clearskyAddFaraday, los needs to be specified\n"
465 "(at least zenith angle component for atmosphere_dim==1),\n"
468 atmosphere_dim > 1 && rtp_los.
nelem() < 2,
469 "For applying propmat_clearskyAddFaraday, los needs to be specified\n"
470 "(both zenith and azimuth angle components for atmosphere_dim>1),\n"
473 const Numeric ne = rtp_vmr[ife];
475 if (ne != 0 && (rtp_mag[0] != 0 || rtp_mag[1] != 0 || rtp_mag[2] != 0)) {
480 rtp_los, rtp_mag[0], rtp_mag[1], rtp_mag[2], atmosphere_dim);
482 Numeric dc1_u = 0.0, dc1_v = 0.0, dc1_w = 0.0;
484 dc1_u = (2 * FRconst *
492 dc1_v = (2 * FRconst *
500 dc1_w = (2 * FRconst *
510 for (
Index iv = 0; iv < f_grid.
nelem(); iv++) {
511 const Numeric f2 = f_grid[iv] * f_grid[iv];
512 const Numeric r = ne * c1 / f2;
516 for (
Index iq = 0; iq < jacobian_quantities.
nelem(); iq++) {
518 dpropmat_clearsky_dx[iq].AddFaraday(-2.0 * ne * r / f_grid[iv], iv);
519 else if (jacobian_quantities[iq] == Jacobian::Atm::MagneticU)
520 dpropmat_clearsky_dx[iq].AddFaraday(ne * dc1_u / f2, iv);
521 else if (jacobian_quantities[iq] == Jacobian::Atm::MagneticV)
522 dpropmat_clearsky_dx[iq].AddFaraday(ne * dc1_v / f2, iv);
523 else if (jacobian_quantities[iq] == Jacobian::Atm::MagneticW)
524 dpropmat_clearsky_dx[iq].AddFaraday(ne * dc1_w / f2, iv);
525 else if (jacobian_quantities[iq] == Jacobian::Atm::Electrons)
526 dpropmat_clearsky_dx[iq].AddFaraday(r, iv);
527 else if (jacobian_quantities[iq] == abs_species[ife])
528 dpropmat_clearsky_dx[iq].AddFaraday(r, iv);
540 const Index& stokes_dim,
541 const Index& atmosphere_dim,
548 const Numeric& rtp_temperature,
550 const Index& scat_data_checked,
551 const Index& use_abs_as_ext,
557 We do not yet support select_abs_species for lookup table calculations
568 "The scat_data must be flagged to have "
569 "passed a consistency check (scat_data_checked=1).")
573 for (
Index sp = 0; sp < abs_species.
nelem(); sp++) {
574 if (abs_species[sp].Particles()) {
581 "For applying propmat_clearskyAddParticles, *abs_species* needs to"
582 "contain species 'particles', but it does not.\n")
586 "Number of 'particles' entries in abs_species and of elements in\n"
587 "*scat_data* needs to be identical. But you have ",
589 " 'particles' entries\n"
592 " *scat_data* elements.\n")
595 atmosphere_dim == 1 && rtp_los.
nelem() < 1,
596 "For applying *propmat_clearskyAddParticles*, *rtp_los* needs to be specified\n"
597 "(at least zenith angle component for atmosphere_dim==1),\n"
600 atmosphere_dim > 1 && rtp_los.
nelem() < 2,
601 "For applying *propmat_clearskyAddParticles*, *rtp_los* needs to be specified\n"
602 "(both zenith and azimuth angle components for atmosphere_dim>1),\n"
615 mirror_los(rtp_los_back, rtp_los, atmosphere_dim);
621 if (do_jac_frequencies) {
623 <<
"Frequency perturbation not available for absorbing particles.\n";
634 if (do_jac_temperature) {
636 T_array = rtp_temperature;
640 T_array = rtp_temperature;
643 dir_array(0,
joker) = rtp_los_back;
656 const Index nf = abs_vec_Nse[0][0].nbooks();
657 Tensor3 tmp(nf, stokes_dim, stokes_dim);
667 for (
Index i_ss = 0; i_ss < scat_data.
nelem(); i_ss++) {
668 for (
Index i_se = 0; i_se < scat_data[i_ss].
nelem(); i_se++) {
670 while (sp < na && not abs_species[sp].Particles()) sp++;
678 "Negative absorbing particle 'vmr' (aka number density)"
684 " (vmr_field entry #",
688 if (rtp_vmr[sp] > 0.) {
690 "Temperature interpolation error:\n"
696 if (use_abs_as_ext) {
700 abs_vec_Nse[i_ss][i_se](iv, 0, 0,
joker), iv);
704 abs_vec_Nse[i_ss][i_se](0, 0, 0,
joker), iv);
709 ext_mat_Nse[i_ss][i_se](iv, 0, 0,
joker,
joker), iv);
713 ext_mat_Nse[i_ss][i_se](0, 0, 0,
joker,
joker), iv);
715 propmat_clearsky += rtp_vmr[sp] * internal_propmat;
719 if (do_jac_temperature) {
721 t_ok(i_se_flat, 1) < 0.,
722 "Temperature interpolation error (in perturbation):\n"
731 if (jacobian_quantities.
nelem()) rtp_vmr_sum += rtp_vmr[sp];
733 for (
Index iq = 0; iq < jacobian_quantities.
nelem(); iq++) {
734 const auto& deriv = jacobian_quantities[iq];
736 if (not deriv.propmattype())
continue;
738 if (deriv == Jacobian::Atm::Temperature) {
739 if (use_abs_as_ext) {
753 dpropmat_clearsky_dx[iq].AddAbsorptionVectorAtPosition(
754 tmp(iv,
joker, 0), iv);
756 dpropmat_clearsky_dx[iq].AddAtPosition(tmp(iv,
joker,
joker),
761 dpropmat_clearsky_dx[iq].AddAbsorptionVectorAtPosition(
762 tmp(0,
joker, 0), iv);
764 dpropmat_clearsky_dx[iq].AddAtPosition(tmp(0,
joker,
joker),
768 else if (deriv == Jacobian::Atm::Particulates) {
770 dpropmat_clearsky_dx[iq].AddAtPosition(internal_propmat, iv);
773 else if (deriv == abs_species[sp]) {
774 dpropmat_clearsky_dx[iq] += internal_propmat;
786 ARTS_ASSERT(abs_species[sp][0].Type() != Species::TagType::Particles);
790 if (rtp_vmr_sum != 0.0) {
791 for (
Index iq = 0; iq < jacobian_quantities.
nelem(); iq++) {
792 const auto& deriv = jacobian_quantities[iq];
794 if (not deriv.propmattype())
continue;
796 if (deriv == Jacobian::Atm::Particulates) {
797 dpropmat_clearsky_dx[iq] /= rtp_vmr_sum;
806 const String& speedup_option,
810 if (not f_grid.
nelem()) {
815 switch (Options::toLblSpeedupOrThrow(speedup_option)) {
816 case Options::LblSpeedup::LinearIndependent:
820 case Options::LblSpeedup::QuadraticIndependent:
823 case Options::LblSpeedup::None:
826 case Options::LblSpeedup::FINAL: {
833 const String& speedup_option,
838 sparse_f_grid, f_grid, sparse_df, speedup_option, verbosity);
839 return sparse_f_grid;
857 const Numeric& rtp_temperature,
860 const Index& nlte_do,
861 const Index& lbl_checked,
865 const String& speedup_option,
878 "*rtp_vmr* must match *abs_species*")
880 "*f_grid* must match *propmat_clearsky*")
882 "*f_grid* must match *nlte_source*")
884 not nq and (nq not_eq dpropmat_clearsky_dx.
nelem()),
885 "*dpropmat_clearsky_dx* must match derived form of *jacobian_quantities*")
887 not nq and
bad_propmat(dpropmat_clearsky_dx, f_grid),
888 "*dpropmat_clearsky_dx* must have frequency dim same as *f_grid*")
890 nlte_do and (nq not_eq dnlte_source_dx.
nelem()),
891 "*dnlte_source_dx* must match derived form of *jacobian_quantities* when non-LTE is on")
894 "*dnlte_source_dx* must have frequency dim same as *f_grid* when non-LTE is on")
896 "Negative frequency (at least one value).")
898 "Must be sorted and increasing if any cutoff or speedup is used.")
900 "Negative VMR (at least one value).")
902 "Negative NLTE (at least one value).")
906 sparse_lim > 0 and sparse_df > sparse_lim,
907 "If sparse grids are to be used, the limit must be larger than the grid-spacing.\n"
910 " Hz and the grid_spacing is ",
918 f_grid, sparse_df, speedup_option, verbosity);
919 const Options::LblSpeedup speedup_type =
920 f_grid_sparse.
nelem() ? Options::toLblSpeedupOrThrow(speedup_option)
921 : Options::LblSpeedup::None;
923 sparse_lim <= 0 and speedup_type not_eq Options::LblSpeedup::None,
924 "Must have a sparse limit if you set speedup_option")
929 f_grid_sparse, jacobian_quantities, nlte_do);
932 for (
Index ispecies = 0; ispecies < ns; ispecies++) {
933 if (select_abs_species.
nelem() and
934 select_abs_species not_eq abs_species[ispecies])
938 if (not abs_species[ispecies].nelem() or abs_species[ispecies].
Zeeman() or
939 not abs_lines_per_species[ispecies].nelem())
942 for (
auto& band : abs_lines_per_species[ispecies]) {
948 band.BroadeningSpeciesVMR(rtp_vmr, abs_species),
949 abs_species[ispecies],
951 isotopologue_ratios[band.Isotopologue()],
962 const Index nbands = [](
auto& lines) {
964 for (
auto& abs_lines : lines) n += abs_lines.nelem();
966 }(abs_lines_per_species);
968 std::vector<LineShape::ComputeData> vcom(
971 f_grid, jacobian_quantities,
static_cast<bool>(nlte_do)});
972 std::vector<LineShape::ComputeData> vsparse_com(
975 f_grid_sparse, jacobian_quantities,
static_cast<bool>(nlte_do)});
977#pragma omp parallel for schedule(dynamic)
978 for (
Index i = 0; i < nbands; i++) {
979 const auto [ispecies, iband] =
980 flat_index(i, abs_species, abs_lines_per_species);
982 if (select_abs_species.
nelem() and
983 select_abs_species not_eq abs_species[ispecies])
987 if (not abs_species[ispecies].nelem() or abs_species[ispecies].
Zeeman() or
988 not abs_lines_per_species[ispecies].nelem())
991 auto& band = abs_lines_per_species[ispecies][iband];
997 band.BroadeningSpeciesVMR(rtp_vmr, abs_species),
998 abs_species[ispecies],
1000 isotopologue_ratios[band.Isotopologue()],
1010 for (
auto& pcom: vcom) com += pcom;
1011 for (
auto& pcom: vsparse_com) sparse_com += pcom;
1014 switch (speedup_type) {
1015 case Options::LblSpeedup::LinearIndependent:
1018 case Options::LblSpeedup::QuadraticIndependent:
1021 case Options::LblSpeedup::None:
1023 case Options::LblSpeedup::FINAL: {
1028 propmat_clearsky.
Kjj() += com.
F.
real();
1031 for (
Index j = 0; j < nq; j++) {
1032 if (not jacobian_quantities[j].propmattype())
continue;
1033 dpropmat_clearsky_dx[j].Kjj() += com.
dF.
real()(
joker, j);
1041 for (
Index j = 0; j < nq; j++) {
1042 if (not jacobian_quantities[j].propmattype())
continue;
1043 dnlte_source_dx[j].Kjj() += com.
dN.
real()(
joker, j);
1051 const Index& stokes_dim,
1060 if (propmat_clearsky.
Kjj()[i] < 0.0) propmat_clearsky.
SetAtPosition(0.0, i);
1081 const Tensor7& propmat_clearsky_field,
1082 const Index& atmosphere_dim,
1087 int nlev_dimid, nlyr_dimid, nwvl_dimid, stokes_dimid, none_dimid;
1089 int wvlmin_varid, wvlmax_varid, z_varid, wvl_varid, tau_varid;
1092 "WriteMolTau can only be used for atmosphere_dim=1")
1093#pragma omp critical(netcdf__critical_region)
1096 if ((retval = nc_create(filename.c_str(), NC_CLOBBER, &ncid)))
1100 if ((retval = nc_def_dim(ncid,
"nlev", (
int)z_field.
npages(), &nlev_dimid)))
1104 nc_def_dim(ncid,
"nlyr", (
int)z_field.
npages() - 1, &nlyr_dimid)))
1107 if ((retval = nc_def_dim(ncid,
"nwvl", (
int)f_grid.
nelem(), &nwvl_dimid)))
1110 if ((retval = nc_def_dim(ncid,
"none", 1, &none_dimid)))
1113 if ((retval = nc_def_dim(ncid,
1115 (
int)propmat_clearsky_field.
nbooks(),
1120 if ((retval = nc_def_var(
1121 ncid,
"wvlmin", NC_DOUBLE, 1, &none_dimid, &wvlmin_varid)))
1124 if ((retval = nc_def_var(
1125 ncid,
"wvlmax", NC_DOUBLE, 1, &none_dimid, &wvlmax_varid)))
1128 if ((retval = nc_def_var(ncid,
"z", NC_DOUBLE, 1, &nlev_dimid, &z_varid)))
1132 nc_def_var(ncid,
"wvl", NC_DOUBLE, 1, &nwvl_dimid, &wvl_varid)))
1135 dimids[0] = nlyr_dimid;
1136 dimids[1] = nwvl_dimid;
1137 dimids[2] = stokes_dimid;
1138 dimids[3] = stokes_dimid;
1141 nc_def_var(ncid,
"tau", NC_DOUBLE, 4, &dimids[0], &tau_varid)))
1145 if ((retval = nc_put_att_text(ncid, wvlmin_varid,
"units", 2,
"nm")))
1148 if ((retval = nc_put_att_text(ncid, wvlmax_varid,
"units", 2,
"nm")))
1151 if ((retval = nc_put_att_text(ncid, z_varid,
"units", 2,
"km")))
1154 if ((retval = nc_put_att_text(ncid, wvl_varid,
"units", 2,
"nm")))
1157 if ((retval = nc_put_att_text(ncid, tau_varid,
"units", 1,
"-")))
1162 if ((retval = nc_enddef(ncid)))
nca_error(retval,
"nc_enddef");
1167 if ((retval = nc_put_var_double(ncid, wvlmin_varid, &wvlmin[0])))
1172 if ((retval = nc_put_var_double(ncid, wvlmax_varid, &wvlmax[0])))
1175 double z[z_field.
npages()];
1176 for (
int iz = 0; iz < z_field.
npages(); iz++)
1177 z[iz] = z_field(z_field.
npages() - 1 - iz, 0, 0) * 1e-3;
1179 if ((retval = nc_put_var_double(ncid, z_varid, &z[0])))
1182 double wvl[f_grid.
nelem()];
1183 for (
int iv = 0; iv < f_grid.
nelem(); iv++)
1186 if ((retval = nc_put_var_double(ncid, wvl_varid, &wvl[0])))
1191 const Index amfnb = propmat_clearsky_field.
nbooks();
1193 Tensor4 tau(zfnp, fgne, amfnb, amfnb, 0.);
1196 for (
int is = 0; is < propmat_clearsky_field.
nlibraries(); is++)
1197 for (
int iz = 0; iz < zfnp; iz++)
1198 for (
int iv = 0; iv < fgne; iv++)
1199 for (
int is1 = 0; is1 < amfnb; is1++)
1200 for (
int is2 = 0; is2 < amfnb; is2++)
1202 tau(iz, iv, is1, is2) +=
1204 (propmat_clearsky_field(is,
1205 f_grid.
nelem() - 1 - iv,
1208 z_field.
npages() - 1 - iz,
1211 propmat_clearsky_field(is,
1212 f_grid.
nelem() - 1 - iv,
1215 z_field.
npages() - 2 - iz,
1218 (z_field(z_field.
npages() - 1 - iz, 0, 0) -
1219 z_field(z_field.
npages() - 2 - iz, 0, 0));
1221 if ((retval = nc_put_var_double(ncid, tau_varid, tau.
get_c_array())))
1225 if ((retval = nc_close(ncid)))
nca_error(retval,
"nc_close");
1240 "The workspace method WriteMolTau is not available"
1241 "because ARTS was compiled without NetCDF support.");
1249 Agenda& propmat_clearsky_agenda,
1250 Index& propmat_clearsky_agenda_checked,
1261 const Index& ignore_errors,
1262 const Numeric& lines_sparse_df,
1263 const Numeric& lines_sparse_lim,
1264 const String& lines_speedup_option,
1265 const Index& manual_mag_field,
1266 const Index& no_negatives,
1268 const Index& use_abs_as_ext,
1269 const Index& use_abs_lookup_ind,
1274 propmat_clearsky_agenda_checked = 0;
1279 const bool use_abs_lookup =
static_cast<bool>(use_abs_lookup_ind);
1285 agenda.
add(
"propmat_clearskyInit");
1288 if (use_abs_lookup) {
1289 agenda.
add(
"propmat_clearskyAddFromLookup",
1290 SetWsv{
"extpolfac", extpolfac},
1291 SetWsv{
"no_negatives", no_negatives});
1295 if (not use_abs_lookup and any_species.
Plain and
1298 agenda.
add(
"propmat_clearskyAddLines",
1299 SetWsv{
"lines_sparse_df", lines_sparse_df},
1300 SetWsv{
"lines_sparse_lim", lines_sparse_lim},
1301 SetWsv{
"lines_speedup_option", lines_speedup_option},
1302 SetWsv{
"no_negatives", no_negatives});
1306 if (any_species.
Zeeman and
1309 agenda.
add(
"propmat_clearskyAddZeeman",
1310 SetWsv{
"manual_mag_field", manual_mag_field},
1317 if (not use_abs_lookup and any_species.
XsecFit) {
1318 agenda.
add(
"propmat_clearskyAddXsecFit",
1319 SetWsv{
"force_p", force_p},
1320 SetWsv{
"force_t", force_t});
1324 if (not use_abs_lookup and any_species.
Plain and
1327 agenda.
add(
"propmat_clearskyAddOnTheFlyLineMixing");
1331 if (any_species.
Zeeman and
1334 agenda.
add(
"propmat_clearskyAddOnTheFlyLineMixingWithZeeman");
1338 if (not use_abs_lookup and any_species.
Cia) {
1339 agenda.
add(
"propmat_clearskyAddCIA",
1340 SetWsv{
"T_extrapolfac", T_extrapolfac},
1341 SetWsv{
"ignore_errors", ignore_errors});
1345 if (not use_abs_lookup and any_species.
Predefined) {
1346 agenda.
add(
"propmat_clearskyAddPredefined");
1351 agenda.
add(
"propmat_clearskyAddParticles",
1352 SetWsv{
"use_abs_as_ext", use_abs_as_ext});
1357 agenda.
add(
"propmat_clearskyAddFaraday");
1361 if (not use_abs_lookup and any_species.
Plain and
1364 agenda.
add(
"propmat_clearskyAddHitranLineMixingLines");
1368 propmat_clearsky_agenda = agenda.
finalize();
1369 propmat_clearsky_agenda_checked = 1;
1372 if (out3.sufficient_priority()) {
1373 out3 <<
"propmat_clearsky_agendaAuto sets propmat_clearsky_agenda to:\n\n"
1374 << propmat_clearsky_agenda <<
'\n';
Declarations required for the calculation of absorption coefficients.
AbsorptionSpeciesBandIndex flat_index(Index i, const ArrayOfArrayOfSpeciesTag &abs_species, const ArrayOfArrayOfAbsorptionLines &abs_lines_per_species)
Get a flat index pair for species and band.
Contains the absorption namespace.
Declarations for agendas.
This file contains the definition of Array.
Index TotalNumberOfElements(const Array< Array< base > > &aa)
Determine total number of elements in an ArrayOfArray.
The global header file for ARTS.
Constants of physical expressions as constexpr.
int arts_omp_get_max_threads()
Wrapper for omp_get_max_threads.
int arts_omp_get_thread_num()
Wrapper for omp_get_thread_num.
bool arts_omp_in_parallel()
Wrapper for omp_in_parallel.
Header file for helper functions for OpenMP.
Stuff related to time in ARTS.
This can be used to make arrays out of anything.
Index nelem() const ARTS_NOEXCEPT
MatrixView real()
Get a view of the real part of the matrix.
VectorView real()
Get a view of the real part of the vector.
Index npages() const
Returns the number of pages.
Index nlibraries() const noexcept
Index nbooks() const noexcept
Index nelem() const noexcept
Returns the number of elements.
void resize(Index r, Index c)
Resize function.
void AddAbsorptionVectorAtPosition(const ConstVectorView &x, const Index iv=0, const Index iz=0, const Index ia=0)
Adds as a Stokes vector at position.
Index NumberOfFrequencies() const
The number of frequencies of the propagation matrix.
VectorView Kjj(const Index iz=0, const Index ia=0)
Vector view to diagonal elements.
void SetZero()
Sets all data to zero.
Index StokesDimensions() const
The stokes dimension of the propagation matrix.
void AddFaraday(const Numeric &rot, const Index iv=0, const Index iz=0, const Index ia=0)
Adds the Faraday rotation to the PropagationMatrix at required position.
void SetAtPosition(const PropagationMatrix &x, const Index iv=0, const Index iz=0, const Index ia=0)
Set the At Position object.
Stokes vector is as Propagation matrix but only has 4 possible values.
const Numeric * get_c_array() const ARTS_NOEXCEPT
Conversion to plain C-array.
void resize(Index n)
Resize function.
Helper macros for debugging.
#define ARTS_ASSERT(condition,...)
#define ARTS_USER_ERROR_IF(condition,...)
void find_xml_file(String &filename, const Verbosity &verbosity)
Find an xml file.
This file contains basic functions to handle ASCII files.
bool do_frequency_jacobian(const ArrayOfRetrievalQuantity &js) noexcept
Returns if the array wants a frequency derivative.
bool do_magnetic_jacobian(const ArrayOfRetrievalQuantity &js) noexcept
Returns if the array wants a magnetic derivative.
bool do_temperature_jacobian(const ArrayOfRetrievalQuantity &js) noexcept
Returns if the array wants the temperature derivative.
Numeric magnetic_field_perturbation(const ArrayOfRetrievalQuantity &js) noexcept
Returns the magnetic field perturbation if it exists.
bool is_frequency_parameter(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a frequency parameter in propagation matrix calculations.
Numeric temperature_perturbation(const ArrayOfRetrievalQuantity &js) noexcept
Returns the temperature perturbation if it exists.
Routines for setting up the jacobian.
bool is_increasing(ConstVectorView x)
Checks if a vector is sorted and strictly increasing.
void sparse_f_gridFromFrequencyGrid(Vector &sparse_f_grid, const Vector &f_grid, const Numeric &sparse_df, const String &speedup_option, const Verbosity &)
WORKSPACE METHOD: sparse_f_gridFromFrequencyGrid.
constexpr Numeric ELECTRON_MASS
void isotopologue_ratiosInitFromHitran(SpeciesIsotopologueRatios &isotopologue_ratios, const Verbosity &)
WORKSPACE METHOD: isotopologue_ratiosInitFromHitran.
constexpr Numeric SPEED_OF_LIGHT
Vector create_sparse_f_grid_internal(const Vector &f_grid, const Numeric &sparse_df, const String &speedup_option, const Verbosity &verbosity)
void propmat_clearskyInit(PropagationMatrix &propmat_clearsky, StokesVector &nlte_source, ArrayOfPropagationMatrix &dpropmat_clearsky_dx, ArrayOfStokesVector &dnlte_source_dx, const ArrayOfRetrievalQuantity &jacobian_quantities, const Vector &f_grid, const Index &stokes_dim, const Index &propmat_clearsky_agenda_checked, const Verbosity &)
WORKSPACE METHOD: propmat_clearskyInit.
void nlte_sourceFromTemperatureAndSrcCoefPerSpecies(StokesVector &nlte_source, ArrayOfStokesVector &dnlte_source_dx, const ArrayOfMatrix &src_coef_per_species, const ArrayOfMatrix &dsrc_coef_dx, const ArrayOfRetrievalQuantity &jacobian_quantities, const Vector &f_grid, const Numeric &rtp_temperature, const Verbosity &)
void abs_speciesDefineAllInScenario(ArrayOfArrayOfSpeciesTag &tgs, Index &propmat_clearsky_agenda_checked, const String &basename, const Verbosity &verbosity)
WORKSPACE METHOD: abs_speciesDefineAllInScenario.
constexpr Numeric VACUUM_PERMITTIVITY
void abs_speciesDefineAll(ArrayOfArrayOfSpeciesTag &abs_species, Index &propmat_clearsky_agenda_checked, const Verbosity &verbosity)
WORKSPACE METHOD: abs_speciesDefineAll.
void AbsInputFromRteScalars(Vector &abs_p, Vector &abs_t, Matrix &abs_vmrs, const Numeric &rtp_pressure, const Numeric &rtp_temperature, const Vector &rtp_vmr, const Verbosity &)
void propmat_clearskyForceNegativeToZero(PropagationMatrix &propmat_clearsky, const Verbosity &)
WORKSPACE METHOD: propmat_clearskyForceNegativeToZero.
void propmat_clearskyAddLines(PropagationMatrix &propmat_clearsky, StokesVector &nlte_source, ArrayOfPropagationMatrix &dpropmat_clearsky_dx, ArrayOfStokesVector &dnlte_source_dx, const Vector &f_grid, const ArrayOfArrayOfSpeciesTag &abs_species, const ArrayOfSpeciesTag &select_abs_species, const ArrayOfRetrievalQuantity &jacobian_quantities, const ArrayOfArrayOfAbsorptionLines &abs_lines_per_species, const SpeciesIsotopologueRatios &isotopologue_ratios, const Numeric &rtp_pressure, const Numeric &rtp_temperature, const EnergyLevelMap &rtp_nlte, const Vector &rtp_vmr, const Index &nlte_do, const Index &lbl_checked, const Numeric &sparse_df, const Numeric &sparse_lim, const String &speedup_option, const Index &robust, const Verbosity &verbosity)
WORKSPACE METHOD: propmat_clearskyAddLines.
void propmat_clearskyZero(PropagationMatrix &propmat_clearsky, const Vector &f_grid, const Index &stokes_dim, const Verbosity &)
WORKSPACE METHOD: propmat_clearskyZero.
void propmat_clearskyAddParticles(PropagationMatrix &propmat_clearsky, ArrayOfPropagationMatrix &dpropmat_clearsky_dx, const Index &stokes_dim, const Index &atmosphere_dim, const Vector &f_grid, const ArrayOfArrayOfSpeciesTag &abs_species, const ArrayOfSpeciesTag &select_abs_species, const ArrayOfRetrievalQuantity &jacobian_quantities, const Vector &rtp_vmr, const Vector &rtp_los, const Numeric &rtp_temperature, const ArrayOfArrayOfSingleScatteringData &scat_data, const Index &scat_data_checked, const Index &use_abs_as_ext, const Verbosity &verbosity)
WORKSPACE METHOD: propmat_clearskyAddParticles.
void propmat_clearskyAddFaraday(PropagationMatrix &propmat_clearsky, ArrayOfPropagationMatrix &dpropmat_clearsky_dx, const Index &stokes_dim, const Index &atmosphere_dim, const Vector &f_grid, const ArrayOfArrayOfSpeciesTag &abs_species, const ArrayOfSpeciesTag &select_abs_species, const ArrayOfRetrievalQuantity &jacobian_quantities, const Vector &rtp_vmr, const Vector &rtp_los, const Vector &rtp_mag, const Verbosity &)
WORKSPACE METHOD: propmat_clearskyAddFaraday.
void WriteMolTau(const Vector &f_grid, const Tensor3 &z_field, const Tensor7 &propmat_clearsky_field, const Index &atmosphere_dim, const String &filename, const Verbosity &)
WORKSPACE METHOD: WriteMolTau.
void AbsInputFromAtmFields(Vector &abs_p, Vector &abs_t, Matrix &abs_vmrs, const Index &atmosphere_dim, const Vector &p_grid, const Tensor3 &t_field, const Tensor4 &vmr_field, const Verbosity &)
WORKSPACE METHOD: AbsInputFromAtmFields.
void abs_lines_per_speciesCreateFromLines(ArrayOfArrayOfAbsorptionLines &abs_lines_per_species, const ArrayOfAbsorptionLines &abs_lines, const ArrayOfArrayOfSpeciesTag &abs_species, const Verbosity &)
WORKSPACE METHOD: abs_lines_per_speciesCreateFromLines.
void isotopologue_ratiosInitFromBuiltin(SpeciesIsotopologueRatios &isotopologue_ratios, const Verbosity &)
WORKSPACE METHOD: isotopologue_ratiosInitFromBuiltin.
constexpr Numeric ELECTRON_CHARGE
void propmat_clearsky_agendaAuto(Workspace &ws, Agenda &propmat_clearsky_agenda, Index &propmat_clearsky_agenda_checked, const ArrayOfArrayOfSpeciesTag &abs_species, const ArrayOfArrayOfAbsorptionLines &abs_lines_per_species, const Numeric &H, const Numeric &T_extrapolfac, const Numeric &eta, const Numeric &extpolfac, const Numeric &force_p, const Numeric &force_t, const Index &ignore_errors, const Numeric &lines_sparse_df, const Numeric &lines_sparse_lim, const String &lines_speedup_option, const Index &manual_mag_field, const Index &no_negatives, const Numeric &theta, const Index &use_abs_as_ext, const Index &use_abs_lookup_ind, const Verbosity &verbosity)
WORKSPACE METHOD: propmat_clearsky_agendaAuto.
void abs_speciesSet(ArrayOfArrayOfSpeciesTag &abs_species, Index &propmat_clearsky_agenda_checked, const ArrayOfString &names, const Verbosity &verbosity)
WORKSPACE METHOD: abs_speciesSet.
Workspace methods and template functions for supergeneric XML IO.
constexpr bool any_negative(const MatpackType &var) noexcept
Checks for negative values.
void abs(Sparse &A, const Sparse &B)
Absolute value of sparse matrix elements.
Implementation of Matrix, Vector, and such stuff.
NUMERIC Numeric
The type to use for all floating point numbers.
INDEX Index
The type to use for all integer numbers and indices.
Declarations having to do with the four output streams.
Declaration of the class MdRecord.
constexpr Numeric pi
The following mathematical constants are generated in python Decimal package by the code:
constexpr Numeric vacuum_permittivity
Vacuum permittivity [F/m].
constexpr Numeric electron_mass
Mass of resting electron [kg].
constexpr Numeric speed_of_light
Speed of light [m/s] From: https://en.wikipedia.org/wiki/2019_redefinition_of_SI_base_units Date: 201...
constexpr Numeric elementary_charge
Elementary charge [C] From: https://en.wikipedia.org/wiki/2019_redefinition_of_SI_base_units Date: 20...
SpeciesIsotopologueRatios isotopologue_ratios()
void compute(ComputeData &com, ComputeData &sparse_com, const AbsorptionLines &band, const ArrayOfRetrievalQuantity &jacobian_quantities, const EnergyLevelMap &nlte, const Vector &vmrs, const ArrayOfSpeciesTag &self_tag, const Numeric &self_vmr, const Numeric &isot_ratio, const Numeric &P, const Numeric &T, const Numeric &H, const Numeric &sparse_lim, const Zeeman::Polarization zeeman_polarization, const Options::LblSpeedup speedup_type, const bool robust) ARTS_NOEXCEPT
Compute the absorption of an absorption band.
bool good_linear_sparse_f_grid(const Vector &f_grid_dense, const Vector &f_grid_sparse) noexcept
Vector triple_sparse_f_grid(const Vector &f_grid, const Numeric &sparse_df) noexcept
Vector linear_sparse_f_grid(const Vector &f_grid, const Numeric &sparse_df) ARTS_NOEXCEPT
constexpr IsotopologueRatios isotopologue_ratiosInitFromBuiltin()
Implements Zeeman modeling.
void nca_error(const int e, const std::string_view s)
Throws a runtime error for the given NetCDF error code.
This file contains basic functions to handle NetCDF data files.
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.
Scattering database structure and functions.
This file contains header information for the dealing with command line parameters.
Numeric dplanck_df(const Numeric &f, const Numeric &t)
dplanck_df
Numeric planck(const Numeric &f, const Numeric &t)
planck
Numeric dplanck_dt(const Numeric &f, const Numeric &t)
dplanck_dt
This file contains declerations of functions of physical character.
Array< StokesVector > ArrayOfStokesVector
Array< PropagationMatrix > ArrayOfPropagationMatrix
bool bad_propmat(const Array< T > &main, const Vector &f_grid, const Index sd=1) noexcept
Checks if a Propagation Matrix or something similar has good grids.
Numeric dotprod_with_los(const ConstVectorView &los, const Numeric &u, const Numeric &v, const Numeric &w, const Index &atmosphere_dim)
Calculates the dot product between a field and a LOS.
void mirror_los(Vector &los_mirrored, const ConstVectorView &los, const Index &atmosphere_dim)
Determines the backward direction for a given line-of-sight.
Declaration of functions in rte.cc.
bool ByHITRANRosenkranzRelmat
bool ByRovibLinearDipoleLineMixing
AbsorptionPopulationTagTypeStatus population
SingleLine PopLine(Index) noexcept
Pops a single line.
Array< SingleLine > lines
A list of individual lines.
Index NumLines() const noexcept
Number of lines.
Species::IsotopeRecord Isotopologue() const noexcept
Isotopologue Index.
void ReverseLines() noexcept
Reverses the order of the internal lines.
void AppendSingleLine(SingleLine &&sl)
Appends a single line to the absorption lines.
Helper class to create an agenda.
void add(const std::string_view method, Input &&... input)
Add a method with as many inputs as you want. These inputs must be of type Wsv.
Agenda finalize()
Check the agenda and return a copy of it (ignoring/touching all agenda input/output not dealt with)
Main computational data for the line shape and strength calculations.
void interp_add_even(const ComputeData &sparse) ARTS_NOEXCEPT
Add a sparse grid to this grid via linear interpolation.
void interp_add_triplequad(const ComputeData &sparse) ARTS_NOEXCEPT
Add a sparse grid to this grid via square interpolation.
Struct to test of an ArrayOfArrayOfSpeciesTag contains a tagtype.
This file contains basic functions to handle XML data files.