ARTS 2.5.9 (git: 825fa5f2)
m_linemixing.cc
Go to the documentation of this file.
1/* Copyright (C) 2020
2 * Richard Larsson <ric.larsson@gmail.com>
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2, or (at your option) any
7 * later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
17 * USA. */
18
31#include "arts_conversions.h"
32#include "hitran_species.h"
33#include "linemixing.h"
34#include "linemixing_hitran.h"
35#include "matpack.h"
36#include "propagationmatrix.h"
37
39 HitranRelaxationMatrixData& abs_hitran_relmat_data,
40 ArrayOfArrayOfAbsorptionLines& abs_lines_per_species,
41 const ArrayOfArrayOfSpeciesTag& abs_species,
42 const String& basedir,
43 const Numeric& linemixinglimit,
44 const Numeric& fmin,
45 const Numeric& fmax,
46 const Numeric& stot,
47 const String& mode,
48 const Verbosity&) {
49 const lm_hitran_2017::ModeOfLineMixing intmode =
50 lm_hitran_2017::toModeOfLineMixingOrThrow(mode);
51
52 const SpeciesIsotopologueRatios isotopologue_ratios =
54
55 ARTS_USER_ERROR_IF(abs_species.nelem() not_eq abs_lines_per_species.nelem(),
56 "Bad size of input species+lines");
57
59 lm_hitran_2017::read(abs_hitran_relmat_data,
60 lines,
61 isotopologue_ratios,
62 basedir,
63 linemixinglimit,
64 fmin,
65 fmax,
66 stot,
67 intmode);
68 std::for_each(lines.begin(), lines.end(), [](auto& band) {
69 band.sort_by_frequency();
70 }); // Sort so largest frequency is last
71 ArrayOfIndex used(lines.nelem(), false);
72
73 bool emptied = false;
74 for (Index i = 0; i < abs_species.nelem(); i++) {
75 for (Index j = 0; j < abs_species[i].nelem(); j++) {
76 if (abs_species[i][j].Spec() not_eq Species::fromShortName("CO2"))
77 continue;
78
79 if (not emptied) {
80 abs_lines_per_species[i].resize(0);
81 emptied = true;
82 }
83
84 for (Index k = 0; k < lines.nelem(); k++) {
85 if (used[k]) continue;
86
87 const Numeric lf{abs_species[i][j].lower_freq > 0
88 ? abs_species[i][j].lower_freq
89 : -std::numeric_limits<Numeric>::max()};
90 const Numeric uf{abs_species[i][j].upper_freq > 0
91 ? abs_species[i][j].upper_freq
92 : std::numeric_limits<Numeric>::max()};
93
94 // Select lines with correct Isotopologue and one line center within the range
95 if ((abs_species[i][j].Isotopologue() == lines[k].Isotopologue() or
96 abs_species[i][j].Isotopologue() ==
97 Species::select_joker("CO2")) and
98 (lines[k].lines.front().F0 <= uf and
99 lines[k].lines.back().F0 >= lf)) {
100 used[k] = true; // The lines should not be copied into other places
101 abs_lines_per_species[i].push_back(lines[k]);
102 }
103 }
104 }
105 }
106}
107
109 PropagationMatrix& propmat_clearsky,
110 const HitranRelaxationMatrixData& abs_hitran_relmat_data,
111 const ArrayOfArrayOfAbsorptionLines& abs_lines_per_species,
112 const SpeciesIsotopologueRatios& isotopologue_ratios,
113 const Vector& f_grid,
114 const ArrayOfArrayOfSpeciesTag& abs_species,
115 const ArrayOfSpeciesTag& select_abs_species,
116 const ArrayOfRetrievalQuantity& jacobian_quantities,
117 const Numeric& rtp_pressure,
118 const Numeric& rtp_temperature,
119 const Vector& rtp_vmr,
120 const Verbosity&) {
121 ARTS_USER_ERROR_IF(jacobian_quantities.nelem(),
122 "Cannot support any Jacobian at this time");
123 ARTS_USER_ERROR_IF(abs_species.nelem() not_eq abs_lines_per_species.nelem(),
124 "Bad size of input species+lines");
125 ARTS_USER_ERROR_IF(abs_species.nelem() not_eq rtp_vmr.nelem(),
126 "Bad size of input species+vmrs");
127
128 // vmrs should be [air, water, co2]
129 Vector vmrs(3, 0);
130 for (Index i = 0; i < abs_species.nelem(); i++) {
131 auto& specs = abs_species[i];
132 if (select_abs_species.nelem() and select_abs_species not_eq specs)
133 continue;
134 for (auto& spec : specs) {
135 if (Species::fromShortName("H2O") == spec.Spec()) {
136 vmrs[1] = rtp_vmr[i];
137 } else if (Species::fromShortName("CO2") == spec.Spec()) {
138 vmrs[0] = rtp_vmr[i];
139 }
140 }
141 }
142 vmrs[2] = 1.0 - vmrs[1] - vmrs[0];
143
144 for (Index i = 0; i < abs_species.nelem(); i++) {
145 if (abs_lines_per_species[i].nelem() and
146 (abs_lines_per_species[i].front().population ==
147 Absorption::PopulationType::ByHITRANFullRelmat or
148 abs_lines_per_species[i].front().population ==
149 Absorption::PopulationType::ByHITRANRosenkranzRelmat))
150 propmat_clearsky.Kjj() +=
151 lm_hitran_2017::compute(abs_hitran_relmat_data,
152 abs_lines_per_species[i],
153 isotopologue_ratios,
154 rtp_pressure,
155 rtp_temperature,
156 vmrs,
157 f_grid);
158 }
159}
160
162 ArrayOfArrayOfAbsorptionLines& abs_lines_per_species,
163 const HitranRelaxationMatrixData& abs_hitran_relmat_data,
164 const Vector& t_grid,
165 const Numeric& pressure,
166 const Index& order,
167 const Verbosity&) {
168 for (auto& abs_lines : abs_lines_per_species) {
169 for (auto& band : abs_lines) {
170 if (band.population == Absorption::PopulationType::ByHITRANFullRelmat or
171 band.population ==
172 Absorption::PopulationType::ByHITRANRosenkranzRelmat) {
174 band, t_grid, abs_hitran_relmat_data, pressure, order);
175 }
176 }
177 }
178}
179
181 PropagationMatrix& propmat_clearsky,
182 ArrayOfPropagationMatrix& dpropmat_clearsky_dx,
183 const ArrayOfArrayOfAbsorptionLines& abs_lines_per_species,
184 const MapOfErrorCorrectedSuddenData& ecs_data,
185 const SpeciesIsotopologueRatios& isotopologue_ratios,
186 const Vector& f_grid,
187 const ArrayOfArrayOfSpeciesTag& abs_species,
188 const ArrayOfSpeciesTag& select_abs_species,
189 const ArrayOfRetrievalQuantity& jacobian_quantities,
190 const Numeric& rtp_pressure,
191 const Numeric& rtp_temperature,
192 const Vector& rtp_vmr,
193 const Index& lbl_checked,
194 const Verbosity&) {
195 ARTS_USER_ERROR_IF(abs_species.nelem() not_eq abs_lines_per_species.nelem(),
196 "Bad size of input species+lines");
197 ARTS_USER_ERROR_IF(abs_species.nelem() not_eq rtp_vmr.nelem(),
198 "Bad size of input species+vmrs");
199 ARTS_USER_ERROR_IF(not lbl_checked,
200 "Please set lbl_checked true to use this function");
201
202 for (Index i = 0; i < abs_species.nelem(); i++) {
203 if (select_abs_species.nelem() and select_abs_species not_eq abs_species[i])
204 continue;
205 for (auto& band : abs_lines_per_species[i]) {
206 if (band.OnTheFlyLineMixing() and band.DoLineMixing(rtp_pressure)) {
207 // vmrs should be for the line
208 const Vector line_shape_vmr =
209 band.BroadeningSpeciesVMR(rtp_vmr, abs_species);
210 const Numeric this_vmr =
211 rtp_vmr[i] * isotopologue_ratios[band.Isotopologue()];
212 const auto [abs, dabs, error] = Absorption::LineMixing::ecs_absorption(
213 rtp_temperature,
214 0,
215 rtp_pressure,
216 this_vmr,
217 line_shape_vmr,
218 ecs_data[band.quantumidentity],
219 f_grid,
221 band,
222 jacobian_quantities);
223 propmat_clearsky.Kjj() += abs.real();
224
225 // Sum up the resorted Jacobian
226 for (Index j = 0; j < jacobian_quantities.nelem(); j++) {
227 const auto& deriv = jacobian_quantities[j];
228
229 if (not deriv.propmattype()) continue;
230
231 if (deriv == abs_species[i]) {
232 dpropmat_clearsky_dx[j].Kjj() += abs.real();
233 } else {
234 dpropmat_clearsky_dx[j].Kjj() += dabs[j].real();
235 }
236 }
237 }
238 }
239 }
240}
241
243 PropagationMatrix& propmat_clearsky,
244 ArrayOfPropagationMatrix& dpropmat_clearsky_dx,
245 const ArrayOfArrayOfAbsorptionLines& abs_lines_per_species,
246 const MapOfErrorCorrectedSuddenData& ecs_data,
247 const SpeciesIsotopologueRatios& isotopologue_ratios,
248 const Vector& f_grid,
249 const ArrayOfArrayOfSpeciesTag& abs_species,
250 const ArrayOfSpeciesTag& select_abs_species,
251 const ArrayOfRetrievalQuantity& jacobian_quantities,
252 const Numeric& rtp_pressure,
253 const Numeric& rtp_temperature,
254 const Vector& rtp_vmr,
255 const Vector& rtp_mag,
256 const Vector& rtp_los,
257 const Index& lbl_checked,
258 const Verbosity&) {
259 ARTS_USER_ERROR_IF(propmat_clearsky.StokesDimensions() not_eq 4,
260 "Only for stokes dim 4");
261 ARTS_USER_ERROR_IF(abs_species.nelem() not_eq abs_lines_per_species.nelem(),
262 "Bad size of input species+lines");
263 ARTS_USER_ERROR_IF(abs_species.nelem() not_eq rtp_vmr.nelem(),
264 "Bad size of input species+vmrs");
265 ARTS_USER_ERROR_IF(not lbl_checked,
266 "Please set lbl_checked true to use this function");
267
268 // Polarization
269 const auto Z = Zeeman::FromGrids(rtp_mag[0],
270 rtp_mag[1],
271 rtp_mag[2],
272 Conversion::deg2rad(rtp_los[0]),
273 Conversion::deg2rad(rtp_los[1]));
274 const auto polarization_scale_data = Zeeman::AllPolarization(Z.theta, Z.eta);
275 const auto polarization_scale_dtheta_data =
276 Zeeman::AllPolarization_dtheta(Z.theta, Z.eta);
277 const auto polarization_scale_deta_data =
278 Zeeman::AllPolarization_deta(Z.theta, Z.eta);
279
280 for (Index i = 0; i < abs_species.nelem(); i++) {
281 if (select_abs_species.nelem() and select_abs_species not_eq abs_species[i])
282 continue;
283 for (auto& band : abs_lines_per_species[i]) {
284 if (band.OnTheFlyLineMixing() and band.DoLineMixing(rtp_pressure)) {
285 // vmrs should be for the line
286 const Vector line_shape_vmr =
287 band.BroadeningSpeciesVMR(rtp_vmr, abs_species);
288 const Numeric this_vmr =
289 rtp_vmr[i] * isotopologue_ratios[band.Isotopologue()];
290 for (Zeeman::Polarization polarization :
294 const auto [abs, dabs, error] =
296 rtp_temperature,
297 Z.H,
298 rtp_pressure,
299 this_vmr,
300 line_shape_vmr,
301 ecs_data[band.quantumidentity],
302 f_grid,
303 polarization,
304 band,
305 jacobian_quantities);
306
307 // Sum up the propagation matrix
308 Zeeman::sum(propmat_clearsky,
309 abs,
310 Zeeman::SelectPolarization(polarization_scale_data,
311 polarization));
312
313 // Sum up the resorted Jacobian
314 for (Index j = 0; j < jacobian_quantities.nelem(); j++) {
315 const auto& deriv = jacobian_quantities[j];
316
317 if (not deriv.propmattype()) continue;
318
319 if (deriv == Jacobian::Atm::MagneticU) {
320 Zeeman::dsum(dpropmat_clearsky_dx[j],
321 abs,
322 dabs[j],
323 Zeeman::SelectPolarization(polarization_scale_data,
324 polarization),
326 polarization_scale_dtheta_data, polarization),
328 polarization_scale_deta_data, polarization),
329 Z.dH_du,
330 Z.dtheta_du,
331 Z.deta_du);
332 } else if (deriv == Jacobian::Atm::MagneticV) {
333 Zeeman::dsum(dpropmat_clearsky_dx[j],
334 abs,
335 dabs[j],
336 Zeeman::SelectPolarization(polarization_scale_data,
337 polarization),
339 polarization_scale_dtheta_data, polarization),
341 polarization_scale_deta_data, polarization),
342 Z.dH_dv,
343 Z.dtheta_dv,
344 Z.deta_dv);
345 } else if (deriv == Jacobian::Atm::MagneticW) {
346 Zeeman::dsum(dpropmat_clearsky_dx[j],
347 abs,
348 dabs[j],
349 Zeeman::SelectPolarization(polarization_scale_data,
350 polarization),
352 polarization_scale_dtheta_data, polarization),
354 polarization_scale_deta_data, polarization),
355 Z.dH_dw,
356 Z.dtheta_dw,
357 Z.deta_dw);
358 } else if (deriv == abs_species[i]) {
359 Zeeman::sum(dpropmat_clearsky_dx[j],
360 abs,
361 Zeeman::SelectPolarization(polarization_scale_data,
362 polarization));
363 } else {
364 dpropmat_clearsky_dx[j].Kjj() += dabs[j].real();
365 }
366 }
367 }
368 }
369 }
370 }
371}
372
374 ArrayOfAbsorptionLines& abs_lines,
375 const MapOfErrorCorrectedSuddenData& ecs_data,
376 const Vector& t_grid,
377 const Numeric& pressure,
378 const Index& order,
379 const Index& robust,
380 const Index& rosenkranz_adaptation,
381 const Verbosity& verbosity) {
382 for (auto& band : abs_lines) {
383 if (band.population ==
384 Absorption::PopulationType::ByRovibLinearDipoleLineMixing or
385 band.population == Absorption::PopulationType::ByMakarovFullRelmat) {
387 band,
388 t_grid,
389 ecs_data[band.quantumidentity],
390 pressure,
391 order,
392 robust,
393 rosenkranz_adaptation,
394 verbosity);
395 }
396 }
397}
398
400 ArrayOfArrayOfAbsorptionLines& abs_lines_per_species,
401 const MapOfErrorCorrectedSuddenData& ecs_data,
402 const Vector& t_grid,
403 const Numeric& pressure,
404 const Index& order,
405 const Index& robust,
406 const Index& rosenkranz_adaptation,
407 const Verbosity& verbosity) {
408 for (auto& abs_lines : abs_lines_per_species) {
410 ecs_data,
411 t_grid,
412 pressure,
413 order,
414 robust,
415 rosenkranz_adaptation,
416 verbosity);
417 }
418}
419
421 ecs_data.resize(0);
422}
423
426 const SpeciesIsotopologueRatios& isotopologue_ratios,
427 const QuantumIdentifier& qid,
428 const String& species,
429 const String& scaling_type,
430 const Vector& scaling,
431 const String& beta_type,
432 const Vector& beta,
433 const String& lambda_type,
434 const Vector& lambda,
435 const String& collisional_distance_type,
436 const Vector& collisional_distance,
437 const Verbosity&) {
438 const Species::Species spec = Species::fromShortName(species);
439 ARTS_USER_ERROR_IF(not good_enum(spec), "Invalid species: ", species)
440 auto& data = ecs_data[qid][spec];
441 data.scaling = LineShapeModelParameters(
442 LineShape::toTemperatureModelOrThrow(scaling_type), scaling);
443 data.beta = LineShapeModelParameters(
444 LineShape::toTemperatureModelOrThrow(beta_type), beta);
445 data.lambda = LineShapeModelParameters(
446 LineShape::toTemperatureModelOrThrow(lambda_type), lambda);
447 data.collisional_distance = LineShapeModelParameters(
448 LineShape::toTemperatureModelOrThrow(collisional_distance_type),
449 collisional_distance);
450 data.mass = Species::mean_mass(spec, isotopologue_ratios);
451}
452
454 const Vector& vmrs,
455 const ArrayOfSpeciesTag& specs,
456 const Verbosity&) {
457 ARTS_USER_ERROR_IF(specs.nelem() not_eq vmrs.nelem(),
458 "Bad sizes of specs and vmrs\nspecs: [",
459 specs,
460 "]\nvmrs: [",
461 vmrs,
462 "]")
463
464 static_assert(LineShapeModelParameters::N == 4);
465 const auto scale = [](LineShapeModelParameters& mp, Numeric x) {
466 mp.X0 *= x;
467 mp.X1 *= x;
468 mp.X2 *= x;
469 mp.X3 *= x;
470 };
471 const auto scale_and_add_or_throw = [](LineShapeModelParameters& mp1,
472 const LineShapeModelParameters& mp2,
473 Numeric x) {
474 ARTS_USER_ERROR_IF(mp1.type not_eq mp2.type,
475 "Can only scale and add same type\nmp1: ",
476 mp1,
477 "\nmp2: ",
478 mp2)
479 mp1.X0 += mp2.X0 * x;
480 mp1.X1 += mp2.X1 * x;
481 mp1.X2 += mp2.X2 * x;
482 mp1.X3 += mp2.X3 * x;
483 };
484
485 for (auto& ecs : ecs_data) {
487
488 bool found = false;
489 Numeric sumvmr = 0;
490 for (Index i = 0; i < specs.nelem(); i++) {
491 ARTS_USER_ERROR_IF(not specs[i].Isotopologue().joker(),
492 "Can only have joker species, finds: [",
493 specs,
494 ']')
495
496 auto spec = specs[i].Spec();
497
498 if (spec == Species::Species::Bath) continue;
499
500 auto& data = ecs[spec];
501
502 // This means we never had the data so we should skip
503 if (std::isinf(data.mass)) {
504 continue;
505 }
506
507 const Numeric vmr = vmrs[i];
508 if (not found) {
509 airdata.scaling = data.scaling;
510 airdata.beta = data.beta;
511 airdata.lambda = data.lambda;
512 airdata.collisional_distance = data.collisional_distance;
513 airdata.mass = data.mass * vmr;
514 scale(airdata.scaling, vmr);
515 scale(airdata.beta, vmr);
516 scale(airdata.lambda, vmr);
517 scale(airdata.collisional_distance, vmr);
518
519 found = true;
520 } else {
521 scale_and_add_or_throw(airdata.scaling, data.scaling, vmr);
522 scale_and_add_or_throw(airdata.beta, data.beta, vmr);
523 scale_and_add_or_throw(airdata.lambda, data.lambda, vmr);
524 scale_and_add_or_throw(
525 airdata.collisional_distance, data.collisional_distance, vmr);
526 airdata.mass += data.mass * vmr;
527 }
528
529 sumvmr += vmrs[i];
530 }
531
532 if (sumvmr not_eq 0 and sumvmr not_eq 1) {
533 scale(airdata.scaling, 1.0 / sumvmr);
534 scale(airdata.beta, 1.0 / sumvmr);
535 scale(airdata.lambda, 1.0 / sumvmr);
536 scale(airdata.collisional_distance, 1.0 / sumvmr);
537 airdata.mass /= sumvmr;
538 }
539
540 ecs[Species::Species::Bath] = airdata;
541 }
542}
543
546 const SpeciesIsotopologueRatios& isotopologue_ratios,
547 const Verbosity&) {
548 // The band is ignored
549 auto& ecs = ecs_data[QuantumIdentifier("O2-66")];
550
551 // All species have the same effect, so just copy the values but change the mass (allow new mass for Air)
552
553 ecs[Species::Species::Oxygen].scaling =
554 LineShapeModelParameters(LineShapeTemperatureModel::T0, 1.0, 0, 0, 0);
555 ecs[Species::Species::Oxygen].collisional_distance = LineShapeModelParameters(
556 LineShapeTemperatureModel::T0, Conversion::angstrom2meter(0.61), 0, 0, 0);
557 ecs[Species::Species::Oxygen].lambda =
558 LineShapeModelParameters(LineShapeTemperatureModel::T0, 0.39, 0, 0, 0);
559 ecs[Species::Species::Oxygen].beta =
560 LineShapeModelParameters(LineShapeTemperatureModel::T0, 0.567, 0, 0, 0);
561 ecs[Species::Species::Oxygen].mass =
562 Species::mean_mass(Species::Species::Oxygen, isotopologue_ratios);
563
564 ecs[Species::Species::Nitrogen].scaling =
565 LineShapeModelParameters(LineShapeTemperatureModel::T0, 1.0, 0, 0, 0);
566 ecs[Species::Species::Nitrogen].collisional_distance =
567 LineShapeModelParameters(LineShapeTemperatureModel::T0,
569 0,
570 0,
571 0);
572 ecs[Species::Species::Nitrogen].lambda =
573 LineShapeModelParameters(LineShapeTemperatureModel::T0, 0.39, 0, 0, 0);
574 ecs[Species::Species::Nitrogen].beta =
575 LineShapeModelParameters(LineShapeTemperatureModel::T0, 0.567, 0, 0, 0);
576 ecs[Species::Species::Nitrogen].mass =
577 Species::mean_mass(Species::Species::Nitrogen, isotopologue_ratios);
578}
579
582 const SpeciesIsotopologueRatios& isotopologue_ratios,
583 const Verbosity&) {
584 for (const auto* key : {"CO2-626", "CO2-628", "CO2-636"}) {
585 auto& ecs = ecs_data[QuantumIdentifier(key)];
586
587 ecs[Species::Species::Nitrogen].scaling =
588 LineShapeModelParameters(LineShapeTemperatureModel::T1,
590 0.85,
591 0,
592 0);
593 ecs[Species::Species::Nitrogen].lambda = LineShapeModelParameters(
594 LineShapeTemperatureModel::T1, 0.81, 0.0152, 0, 0);
595 ecs[Species::Species::Nitrogen].beta =
596 LineShapeModelParameters(LineShapeTemperatureModel::T0, 0.008, 0, 0, 0);
597 ecs[Species::Species::Nitrogen].collisional_distance =
598 LineShapeModelParameters(LineShapeTemperatureModel::T0,
600 0,
601 0,
602 0);
603 ecs[Species::Species::Nitrogen].mass =
604 Species::mean_mass(Species::Species::Nitrogen, isotopologue_ratios);
605
606 ecs[Species::Species::Oxygen].scaling =
607 LineShapeModelParameters(LineShapeTemperatureModel::T1,
609 0.5,
610 0,
611 0);
612 ecs[Species::Species::Oxygen].lambda = LineShapeModelParameters(
613 LineShapeTemperatureModel::T1, 0.82, -0.091, 0, 0);
614 ecs[Species::Species::Oxygen].beta =
615 LineShapeModelParameters(LineShapeTemperatureModel::T0, 0.007, 0, 0, 0);
616 ecs[Species::Species::Oxygen].collisional_distance =
617 LineShapeModelParameters(LineShapeTemperatureModel::T0,
619 0,
620 0,
621 0);
622 ecs[Species::Species::Oxygen].mass =
623 Species::mean_mass(Species::Species::Oxygen, isotopologue_ratios);
624 }
625}
626
628 const SpeciesIsotopologueRatios& isotopologue_ratios,
629 const Verbosity&) {
630 auto& ecs = ecs_data[QuantumIdentifier("O2-66")];
631
632 ecs[Species::Species::Oxygen].scaling =
633 LineShapeModelParameters(LineShapeTemperatureModel::T1, Conversion::kaycm_per_atm2hz_per_pa(0.0275), 1.01, 0, 0);
634 ecs[Species::Species::Oxygen].collisional_distance = LineShapeModelParameters(
635 LineShapeTemperatureModel::T0, Conversion::angstrom2meter(1.05), 0, 0, 0);
636 ecs[Species::Species::Oxygen].lambda =
637 LineShapeModelParameters(LineShapeTemperatureModel::T0, 0.935, 0, 0, 0);
638 ecs[Species::Species::Oxygen].beta =
639 LineShapeModelParameters(LineShapeTemperatureModel::T0, 0, 0, 0, 0);
640 ecs[Species::Species::Oxygen].mass =
641 Species::mean_mass(Species::Species::Oxygen, isotopologue_ratios);
642
643 ecs[Species::Species::Nitrogen].scaling =
644 LineShapeModelParameters(LineShapeTemperatureModel::T1, Conversion::kaycm_per_atm2hz_per_pa(0.0285), 1.03, 0, 0);
645 ecs[Species::Species::Nitrogen].collisional_distance = LineShapeModelParameters(
646 LineShapeTemperatureModel::T0, Conversion::angstrom2meter(1.00), 0, 0, 0);
647 ecs[Species::Species::Nitrogen].lambda =
648 LineShapeModelParameters(LineShapeTemperatureModel::T0, 0.95, 0, 0, 0);
649 ecs[Species::Species::Nitrogen].beta =
650 LineShapeModelParameters(LineShapeTemperatureModel::T0, 0, 0, 0, 0);
651 ecs[Species::Species::Nitrogen].mass =
652 Species::mean_mass(Species::Species::Nitrogen, isotopologue_ratios);
653}
654
656 const SpeciesIsotopologueRatios& isotopologue_ratios,
657 const Verbosity&) {
658 for (const auto* key : {"CO2-626", "CO2-628", "CO2-636"}) {
659 auto& ecs = ecs_data[QuantumIdentifier(key)];
660
661 ecs[Species::Species::CarbonDioxide].scaling =
662 LineShapeModelParameters(LineShapeTemperatureModel::T0,
664 0,
665 0,
666 0);
667 ecs[Species::Species::CarbonDioxide].lambda =
668 LineShapeModelParameters(LineShapeTemperatureModel::T0, 0.61, 0, 0, 0);
669 ecs[Species::Species::CarbonDioxide].beta =
670 LineShapeModelParameters(LineShapeTemperatureModel::T0, 0.052, 0, 0, 0);
671 ecs[Species::Species::CarbonDioxide].collisional_distance =
672 LineShapeModelParameters(LineShapeTemperatureModel::T0,
674 0,
675 0,
676 0);
677 ecs[Species::Species::CarbonDioxide].mass = Species::mean_mass(
678 Species::Species::CarbonDioxide, isotopologue_ratios);
679 }
680}
Common ARTS conversions.
This can be used to make arrays out of anything.
Definition: array.h:48
Index nelem() const ARTS_NOEXCEPT
Definition: array.h:92
Index nelem() const noexcept
Returns the number of elements.
Definition: matpackI.h:547
VectorView Kjj(const Index iz=0, const Index ia=0)
Vector view to diagonal elements.
Index StokesDimensions() const
The stokes dimension of the propagation matrix.
The Vector class.
Definition: matpackI.h:910
#define ARTS_USER_ERROR_IF(condition,...)
Definition: debug.h:134
constexpr bool good_enum(EnumType x) noexcept
Checks if the enum number is good.
Definition: enums.h:21
Namespace and functions to deal with HITRAN linemixing.
LineShape::ModelParameters LineShapeModelParameters
void ecs_dataAddTran2006(MapOfErrorCorrectedSuddenData &ecs_data, const SpeciesIsotopologueRatios &isotopologue_ratios, const Verbosity &)
WORKSPACE METHOD: ecs_dataAddTran2006.
void ecs_dataAddTran2011(MapOfErrorCorrectedSuddenData &ecs_data, const SpeciesIsotopologueRatios &isotopologue_ratios, const Verbosity &)
WORKSPACE METHOD: ecs_dataAddTran2011.
void propmat_clearskyAddHitranLineMixingLines(PropagationMatrix &propmat_clearsky, const HitranRelaxationMatrixData &abs_hitran_relmat_data, const ArrayOfArrayOfAbsorptionLines &abs_lines_per_species, const SpeciesIsotopologueRatios &isotopologue_ratios, const Vector &f_grid, const ArrayOfArrayOfSpeciesTag &abs_species, const ArrayOfSpeciesTag &select_abs_species, const ArrayOfRetrievalQuantity &jacobian_quantities, const Numeric &rtp_pressure, const Numeric &rtp_temperature, const Vector &rtp_vmr, const Verbosity &)
WORKSPACE METHOD: propmat_clearskyAddHitranLineMixingLines.
void abs_lines_per_speciesAdaptOnTheFlyLineMixing(ArrayOfArrayOfAbsorptionLines &abs_lines_per_species, const MapOfErrorCorrectedSuddenData &ecs_data, const Vector &t_grid, const Numeric &pressure, const Index &order, const Index &robust, const Index &rosenkranz_adaptation, const Verbosity &verbosity)
WORKSPACE METHOD: abs_lines_per_speciesAdaptOnTheFlyLineMixing.
void ecs_dataAddMakarov2020(MapOfErrorCorrectedSuddenData &ecs_data, const SpeciesIsotopologueRatios &isotopologue_ratios, const Verbosity &)
WORKSPACE METHOD: ecs_dataAddMakarov2020.
void propmat_clearskyAddOnTheFlyLineMixing(PropagationMatrix &propmat_clearsky, ArrayOfPropagationMatrix &dpropmat_clearsky_dx, const ArrayOfArrayOfAbsorptionLines &abs_lines_per_species, const MapOfErrorCorrectedSuddenData &ecs_data, const SpeciesIsotopologueRatios &isotopologue_ratios, const Vector &f_grid, const ArrayOfArrayOfSpeciesTag &abs_species, const ArrayOfSpeciesTag &select_abs_species, const ArrayOfRetrievalQuantity &jacobian_quantities, const Numeric &rtp_pressure, const Numeric &rtp_temperature, const Vector &rtp_vmr, const Index &lbl_checked, const Verbosity &)
WORKSPACE METHOD: propmat_clearskyAddOnTheFlyLineMixing.
void abs_linesAdaptOnTheFlyLineMixing(ArrayOfAbsorptionLines &abs_lines, const MapOfErrorCorrectedSuddenData &ecs_data, const Vector &t_grid, const Numeric &pressure, const Index &order, const Index &robust, const Index &rosenkranz_adaptation, const Verbosity &verbosity)
WORKSPACE METHOD: abs_linesAdaptOnTheFlyLineMixing.
void ecs_dataAddSpeciesData(MapOfErrorCorrectedSuddenData &ecs_data, const SpeciesIsotopologueRatios &isotopologue_ratios, const QuantumIdentifier &qid, const String &species, const String &scaling_type, const Vector &scaling, const String &beta_type, const Vector &beta, const String &lambda_type, const Vector &lambda, const String &collisional_distance_type, const Vector &collisional_distance, const Verbosity &)
WORKSPACE METHOD: ecs_dataAddSpeciesData.
void ecs_dataAddMeanAir(MapOfErrorCorrectedSuddenData &ecs_data, const Vector &vmrs, const ArrayOfSpeciesTag &specs, const Verbosity &)
WORKSPACE METHOD: ecs_dataAddMeanAir.
void abs_lines_per_speciesAdaptHitranLineMixing(ArrayOfArrayOfAbsorptionLines &abs_lines_per_species, const HitranRelaxationMatrixData &abs_hitran_relmat_data, const Vector &t_grid, const Numeric &pressure, const Index &order, const Verbosity &)
WORKSPACE METHOD: abs_lines_per_speciesAdaptHitranLineMixing.
void ecs_dataInit(MapOfErrorCorrectedSuddenData &ecs_data, const Verbosity &)
WORKSPACE METHOD: ecs_dataInit.
void ecs_dataAddRodrigues1997(MapOfErrorCorrectedSuddenData &ecs_data, const SpeciesIsotopologueRatios &isotopologue_ratios, const Verbosity &)
WORKSPACE METHOD: ecs_dataAddRodrigues1997.
void propmat_clearskyAddOnTheFlyLineMixingWithZeeman(PropagationMatrix &propmat_clearsky, ArrayOfPropagationMatrix &dpropmat_clearsky_dx, const ArrayOfArrayOfAbsorptionLines &abs_lines_per_species, const MapOfErrorCorrectedSuddenData &ecs_data, const SpeciesIsotopologueRatios &isotopologue_ratios, const Vector &f_grid, const ArrayOfArrayOfSpeciesTag &abs_species, const ArrayOfSpeciesTag &select_abs_species, const ArrayOfRetrievalQuantity &jacobian_quantities, const Numeric &rtp_pressure, const Numeric &rtp_temperature, const Vector &rtp_vmr, const Vector &rtp_mag, const Vector &rtp_los, const Index &lbl_checked, const Verbosity &)
WORKSPACE METHOD: propmat_clearskyAddOnTheFlyLineMixingWithZeeman.
void abs_hitran_relmat_dataReadHitranRelmatDataAndLines(HitranRelaxationMatrixData &abs_hitran_relmat_data, ArrayOfArrayOfAbsorptionLines &abs_lines_per_species, const ArrayOfArrayOfSpeciesTag &abs_species, const String &basedir, const Numeric &linemixinglimit, const Numeric &fmin, const Numeric &fmax, const Numeric &stot, const String &mode, const Verbosity &)
WORKSPACE METHOD: abs_hitran_relmat_dataReadHitranRelmatDataAndLines.
Definition: m_linemixing.cc:38
void abs(Sparse &A, const Sparse &B)
Absolute value of sparse matrix elements.
Definition: matpackII.cc:394
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:33
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
const Joker joker
void ecs_eigenvalue_adaptation(AbsorptionLines &band, const Vector &temperatures, const ErrorCorrectedSuddenData &ecs_data, const Numeric P0, const Index ord, const bool robust, const bool rosenkranz_adaptation, const Verbosity &verbosity)
Definition: linemixing.cc:1452
EcsReturn ecs_absorption(const Numeric T, const Numeric H, const Numeric P, const Numeric this_vmr, const Vector &vmrs, const ErrorCorrectedSuddenData &ecs_data, const Vector &f_grid, const Zeeman::Polarization zeeman_polarization, const AbsorptionLines &band, const ArrayOfRetrievalQuantity &jacobian_quantities)
Definition: linemixing.cc:763
constexpr auto deg2rad(auto x) noexcept
Converts degrees to radians.
constexpr auto kaycm_per_atm2hz_per_pa(auto x) noexcept
Conversion from cm-1 per atmosphere to Hz per Pascal.
constexpr auto angstrom2meter(auto x) noexcept
Conversion from Å to meter.
SpeciesIsotopologueRatios isotopologue_ratios()
constexpr Numeric mean_mass(Species spec, const IsotopologueRatios &ir) noexcept
constexpr const IsotopeRecord & select_joker(Species spec) noexcept
const PolarizationVector & SelectPolarization(const AllPolarizationVectors &data, Polarization type) noexcept
Selects the polarization vector depending on polarization type.
Definition: zeemandata.cc:418
Derived FromGrids(Numeric u, Numeric v, Numeric w, Numeric z, Numeric a) noexcept
Computes the derived plane from ARTS grids.
Definition: zeemandata.cc:277
AllPolarizationVectors AllPolarization_deta(Numeric theta, Numeric eta) noexcept
The derivative of AllPolarization wrt eta.
Definition: zeemandata.cc:400
AllPolarizationVectors AllPolarization_dtheta(Numeric theta, const Numeric eta) noexcept
The derivative of AllPolarization wrt theta.
Definition: zeemandata.cc:383
Polarization
Zeeman polarization selection.
Definition: zeemandata.h:44
void dsum(PropagationMatrix &pm, const ComplexVectorView &abs, const ComplexVectorView &dabs, const PolarizationVector &polvec, const PolarizationVector &dpolvec_dtheta, const PolarizationVector &dpolvec_deta, const Numeric dH, const Numeric dt, const Numeric de, const bool do_phase) ARTS_NOEXCEPT
Sums the Zeeman components derivatives into a propagation matrix.
Definition: zeemandata.cc:453
void sum(PropagationMatrix &pm, const ComplexVectorView &abs, const PolarizationVector &polvec, const bool do_phase) ARTS_NOEXCEPT
Sums the Zeeman components into a propagation matrix.
Definition: zeemandata.cc:433
AllPolarizationVectors AllPolarization(Numeric theta, Numeric eta) noexcept
Computes the polarization of each polarization type.
Definition: zeemandata.cc:368
void hitran_lm_eigenvalue_adaptation(AbsorptionLines &band, const Vector &temperatures, const HitranRelaxationMatrixData &hitran, const Numeric P0, const Index ord)
void read(HitranRelaxationMatrixData &hitran, ArrayOfAbsorptionLines &bands, const SpeciesIsotopologueRatios &isotopologue_ratio, const String &basedir, const Numeric linemixinglimit, const Numeric fmin, const Numeric fmax, const Numeric stot, const ModeOfLineMixing mode)
Read from HITRAN online line mixing file.
Vector compute(const Numeric p, const Numeric t, const Numeric xco2, const Numeric xh2o, const ConstVectorView &invcm_grid, const Numeric stotmax, const calctype type)
Stuff related to the propagation matrix.
Quantum::Number::GlobalState QuantumIdentifier
Coefficients and temperature model for SingleSpeciesModel.
static constexpr Index N
A logical struct for global quantum numbers with species identifiers.