ARTS 2.5.9 (git: 825fa5f2)
lineshape.h
Go to the documentation of this file.
1#ifndef lineshapes_h
2#define lineshapes_h
3
4#include <variant>
5
6#include "arts_conversions.h"
7#include "energylevelmap.h"
8#include "linescaling.h"
9#include "nonstd.h"
10
11namespace LineShape {
12struct Noshape {
13 static constexpr Complex F = Complex(0, 0);
14
15 static constexpr Complex dFdT(const Output &, Numeric) noexcept { return 0; }
16 static constexpr Complex dFdf() noexcept { return 0; }
17 static constexpr Complex dFdF0() noexcept { return 0; }
18 static constexpr Complex dFdH(Numeric) noexcept { return 0; }
19 static constexpr Complex dFdFVC(Numeric) noexcept { return 0; }
20 static constexpr Complex dFdETA(Numeric) noexcept { return 0; }
21 static constexpr Complex dFdVMR(const Output &) noexcept { return 0; }
22 static constexpr Complex dFdDV(Numeric) noexcept { return 0; }
23 static constexpr Complex dFdD0(Numeric) noexcept { return 0; }
24 static constexpr Complex dFdG0(Numeric) noexcept { return 0; }
25 static constexpr Complex dFdD2(Numeric) noexcept { return 0; }
26 static constexpr Complex dFdG2(Numeric) noexcept { return 0; }
27
28 constexpr Complex operator()(Numeric) const noexcept { return F; }
29}; // Noshape
30
31struct Doppler {
34
37
38 constexpr Doppler(Numeric F0_noshift, Numeric DC, Numeric dZ) noexcept
39 : F(), x(), mF0(F0_noshift + dZ), invGD(1.0 / nonstd::abs(DC * mF0)) {}
40
41 [[nodiscard]] constexpr Complex dFdT(const Output &,
42 Numeric T) const noexcept {
43 return F * (2 * Math::pow2(x) - 1) / (2 * T);
44 }
45 [[nodiscard]] constexpr Complex dFdf() const noexcept {
46 return -2 * invGD * F * x;
47 }
48 [[nodiscard]] constexpr Complex dFdF0() const noexcept {
49 return F * (2 * x * (invGD * mF0 + x) - 1) / mF0;
50 }
51 [[nodiscard]] constexpr Complex dFdH(Numeric dZ) const noexcept {
52 return dZ * (F * (2 * x * (invGD * mF0 + x) - 1) / mF0);
53 }
54 static constexpr Complex dFdFVC(Numeric) noexcept { return 0; }
55 static constexpr Complex dFdETA(Numeric) noexcept { return 0; }
56 static constexpr Complex dFdVMR(const Output &) noexcept { return 0; }
57 static constexpr Complex dFdDV(Numeric) noexcept { return 0; }
58 static constexpr Complex dFdD0(Numeric) noexcept { return 0; }
59 static constexpr Complex dFdG0(Numeric) noexcept { return 0; }
60 static constexpr Complex dFdD2(Numeric) noexcept { return 0; }
61 static constexpr Complex dFdG2(Numeric) noexcept { return 0; }
62
63 Complex operator()(Numeric f) noexcept;
64}; // Doppler
65
66struct Lorentz {
69
72
73 constexpr Lorentz(Numeric F0_noshift, const Output &ls) noexcept
74 : mF0(F0_noshift + ls.D0 + ls.DV), G0(ls.G0) {}
75
76 [[nodiscard]] constexpr Complex dFdVMR(const Output &d) const noexcept {
77 return Complex(d.G0, d.D0 + d.DV) * dF;
78 }
79 [[nodiscard]] constexpr Complex dFdT(const Output &d,
80 Numeric) const noexcept {
81 return dFdVMR(d);
82 }
83 [[nodiscard]] [[nodiscard]] constexpr Complex dFdf() const noexcept {
84 return Complex(0, -1) * dF;
85 }
86 [[nodiscard]] constexpr Complex dFdF0() const noexcept {
87 return Complex(0, 1) * dF;
88 }
89 [[nodiscard]] constexpr Complex dFdDV(Numeric d) const noexcept {
90 return d * dFdF0();
91 }
92 [[nodiscard]] constexpr Complex dFdD0(Numeric d) const noexcept {
93 return d * dFdF0();
94 }
95 static constexpr Complex dFdH(Numeric) noexcept { return 0; }
96 [[nodiscard]] constexpr Complex dFdG0(Numeric d) const noexcept {
97 return d * dF;
98 }
99 static constexpr Complex dFdD2(Numeric) noexcept { return 0; }
100 static constexpr Complex dFdG2(Numeric) { return 0; }
101 static constexpr Complex dFdETA(Numeric) noexcept { return 0; }
102 static constexpr Complex dFdFVC(Numeric) noexcept { return 0; }
103
104 constexpr Complex operator()(Numeric f) noexcept {
105 F = Constant::inv_pi / Complex(G0, mF0 - f);
107 return F;
108 }
109}; // Lorentz
110
111struct Voigt {
114
118
119 constexpr Voigt(Numeric F0_noshift,
120 const Output &ls,
121 Numeric DC,
122 Numeric dZ) noexcept
123 : F(),
124 dF(),
125 mF0(F0_noshift + dZ + ls.D0 + ls.DV),
126 invGD(1.0 / nonstd::abs(DC * mF0)),
127 z(invGD * Complex(-mF0, ls.G0)) {}
128
129 [[nodiscard]] constexpr Complex dFdf() const noexcept { return dF; }
130 [[nodiscard]] constexpr Complex dFdF0() const noexcept { return -dF; }
131 [[nodiscard]] constexpr Complex dFdDV(Numeric d) const noexcept {
132 return -d * dF;
133 }
134 [[nodiscard]] constexpr Complex dFdD0(Numeric d) const noexcept {
135 return -d * dF;
136 }
137 [[nodiscard]] constexpr Complex dFdG0(Numeric d) const noexcept {
138 return Complex(0, d) * dF;
139 }
140 [[nodiscard]] constexpr Complex dFdH(Numeric dZ) const noexcept {
141 return -dZ * dF;
142 }
143 [[nodiscard]] constexpr Complex dFdVMR(const Output &d) const noexcept {
144 return Complex(-d.D0 - d.DV, d.G0) * dF;
145 }
146 [[nodiscard]] constexpr Complex dFdT(const Output &d,
147 Numeric T) const noexcept {
148 return -(F * invGD + dF * z) * (2 * T * (d.D0 + d.DV) + mF0) /
149 (2 * T * invGD * mF0) +
150 Complex(-d.D0 - d.DV, d.G0) * dF;
151 }
152 static constexpr Complex dFdETA(Numeric) noexcept { return 0; }
153 static constexpr Complex dFdFVC(Numeric) noexcept { return 0; }
154 static constexpr Complex dFdD2(Numeric) noexcept { return 0; }
155 static constexpr Complex dFdG2(Numeric) { return 0; }
156
157 Complex operator()(Numeric f) noexcept;
158
159 [[nodiscard]] bool OK() const noexcept { return invGD > 0; }
160}; // Voigt
161
163 enum struct CalcType : char {
164 Voigt,
168 Full
169 };
170
172
185
186 SpeedDependentVoigt(Numeric F0_noshift,
187 const Output &ls,
188 Numeric GD_div_F0,
189 Numeric dZ) noexcept;
190
191 [[nodiscard]] Complex dFdf() const noexcept;
192 [[nodiscard]] Complex dFdF0() const noexcept;
193 [[nodiscard]] Complex dFdD0(Numeric dD0dD0) const noexcept;
194 [[nodiscard]] Complex dFdG0(Numeric dG0dG0) const noexcept;
195 [[nodiscard]] Complex dFdD2(Numeric dD2dD2) const noexcept;
196 [[nodiscard]] Complex dFdG2(Numeric dG2dG2) const noexcept;
197 [[nodiscard]] Complex dFdH(Numeric dZ) const noexcept;
198 [[nodiscard]] Complex dFdVMR(const Output &d) const noexcept;
199 [[nodiscard]] Complex dFdT(const Output &d, Numeric T) const noexcept;
200 static constexpr Complex dFdETA(Numeric) noexcept { return 0; }
201 static constexpr Complex dFdFVC(Numeric) noexcept { return 0; }
202 static constexpr Complex dFdDV(Numeric) noexcept { return 0; }
203
204 Complex operator()(Numeric f) noexcept;
205
206 [[nodiscard]] CalcType init(const Complex c2) const noexcept;
207 void update_calcs() noexcept;
208 void calc() noexcept;
209}; // SpeedDependentVoigt
210
212 enum struct CalcType : char {
213 Noc2tLowZ,
214 Noc2tHighZ,
218 Full
219 };
220
222
233
235
248
249 HartmannTran(Numeric F0_noshift,
250 const Output &ls,
251 Numeric GD_div_F0,
252 Numeric dZ) noexcept;
253
254 [[nodiscard]] Complex dFdf() const noexcept;
255 [[nodiscard]] Complex dFdF0() const noexcept;
256 [[nodiscard]] Complex dFdD0(Numeric dD0) const noexcept;
257 [[nodiscard]] Complex dFdG0(Numeric dG0) const noexcept;
258 [[nodiscard]] Complex dFdD2(Numeric dD2) const noexcept;
259 [[nodiscard]] Complex dFdG2(Numeric dG2) const noexcept;
260 [[nodiscard]] Complex dFdFVC(Numeric dFVC) const noexcept;
261 [[nodiscard]] Complex dFdETA(Numeric dETA) const noexcept;
262 [[nodiscard]] Complex dFdH(Numeric dZ) const noexcept;
263 [[nodiscard]] Complex dFdVMR(const Output &d) const noexcept;
264 [[nodiscard]] Complex dFdT(const Output &d, Numeric T) const noexcept;
265 static constexpr Complex dFdDV(Numeric) noexcept { return 0; }
266
267 Complex operator()(Numeric f) noexcept;
268
269 [[nodiscard]] CalcType init(const Complex c2t) const noexcept;
270 void update_calcs() noexcept;
271 void calc() noexcept;
272}; // HartmannTran
273
274struct Nonorm {
275 static constexpr Numeric N = 1.0;
276
277 constexpr Nonorm() noexcept = default;
278
279 static constexpr Numeric dNdT(Numeric, Numeric) noexcept { return 0; }
280 static constexpr Numeric dNdf(Numeric) noexcept { return 0; }
281 [[nodiscard]] constexpr Numeric dNdF0() const noexcept { return 0; }
282
283 constexpr Numeric operator()(Numeric) noexcept { return N; }
284}; // Nonorm
285
288
293
294 VanVleckHuber(Numeric F0, Numeric T) noexcept;
295
296 [[nodiscard]] Numeric dNdT(Numeric T, Numeric f) const noexcept;
297 [[nodiscard]] Numeric dNdf(Numeric f) const noexcept;
298 [[nodiscard]] Numeric dNdF0() const noexcept;
299
300 Numeric operator()(Numeric f) noexcept;
301}; // VanVleckHuber
302
305
307
308 constexpr VanVleckWeisskopf(Numeric F0) noexcept : N(1), invF0(1.0 / F0) {}
309
310 static constexpr Numeric dNdT(Numeric, Numeric) noexcept { return 0; }
311 [[nodiscard]] constexpr Numeric dNdf(Numeric f) const noexcept {
312 return 2.0 * f * Math::pow2(invF0);
313 }
314 [[nodiscard]] constexpr Numeric dNdF0() const noexcept {
315 return -2.0 * N * invF0;
316 }
317
318 constexpr Numeric operator()(Numeric f) noexcept {
319 N = Math::pow2(f * invF0);
320 return N;
321 }
322}; // VanVleckWeisskopf
323
326
330
331 RosenkranzQuadratic(Numeric F0, Numeric T) noexcept;
332
333 [[nodiscard]] Numeric dNdT(Numeric, Numeric f) const noexcept;
334 [[nodiscard]] Numeric dNdf(Numeric f) const noexcept;
335 [[nodiscard]] Numeric dNdF0() const noexcept;
336
337 Numeric operator()(Numeric f) noexcept;
338}; // RosenkranzQuadratic
339
342
347
349 Numeric expm1,
350 Numeric F0_,
351 Numeric T_)
352 : N(1.0), T(T_), F0(F0_), expF0(exp), expm1F0(expm1) {}
353
356 std::exp(-(Constant::h * F0_) / (Constant::k * T_)),
357 std::expm1(-(Constant::h * F0_) / (Constant::k * T_)),
358 F0_,
359 T_) {}
360
361 [[nodiscard]] Numeric dNdT(Numeric t_ [[maybe_unused]],
362 Numeric f) const ARTS_NOEXCEPT;
363 [[nodiscard]] Numeric dNdf(Numeric f) const noexcept;
364 [[nodiscard]] constexpr Numeric dNdF0() const noexcept {
365 return -N / F0 + N * Constant::h * expF0 / (Constant::k * T * expm1F0);
366 }
367
368 Numeric operator()(Numeric f) noexcept;
369}; // SimpleFrequencyScaling
370
372 static constexpr Numeric S = 1.0;
373 static constexpr Numeric N = 0.0;
374
375 static constexpr Numeric dSdT() noexcept { return 0; }
376 static constexpr Numeric dSdI0() noexcept { return 0; }
377 static constexpr Numeric dSdF0() noexcept { return 0; }
378 static constexpr Numeric dSdNLTEu() noexcept { return 0; }
379 static constexpr Numeric dSdNLTEl() noexcept { return 0; }
380 static constexpr Numeric dSdSELFVMR() noexcept { return 0; }
381
382 static constexpr Numeric dNdT() noexcept { return 0; }
383 static constexpr Numeric dNdI0() noexcept { return 0; }
384 static constexpr Numeric dNdF0() noexcept { return 0; }
385 static constexpr Numeric dNdNLTEu() noexcept { return 0; }
386 static constexpr Numeric dNdNLTEl() noexcept { return 0; }
387 static constexpr Numeric dNdSELFVMR() noexcept { return 0; }
388
389 static constexpr bool do_nlte() noexcept { return false; }
390}; // Nostrength
391
394 static constexpr Numeric N = 0.0;
395
400
402 Numeric r,
403 Numeric drdSELFVMR,
404 Numeric drdT,
405 Numeric QT0,
406 Numeric QT,
407 Numeric dQTdT,
408 Numeric br,
409 Numeric dbr_dT_rat,
410 Numeric stim,
411 Numeric dstim_dT,
412 Numeric dstim_dF0) noexcept
413 : S(),
414 dSdI0val(r * br * stim * QT0 / QT),
415 dSdTval(I0 * (r * br * dstim_dT * QT0 / QT +
416 dSdI0val * (dbr_dT_rat - dQTdT / QT) +
417 drdT * br * stim * QT0 / QT)),
418 dSdF0val(r * I0 * br * dstim_dF0 * QT0 / QT),
419 dSdSELFVMRval(drdSELFVMR * I0 * br * stim * QT0 / QT) {
420 S = I0 * dSdI0val;
421 }
422
424 Numeric T0,
425 Numeric T,
426 Numeric F0,
427 Numeric E0,
428 Numeric QT,
429 Numeric QT0,
430 Numeric dQTdT,
431 Numeric r,
432 Numeric drdSELFVMR,
433 Numeric drdT) noexcept;
434
435 [[nodiscard]] constexpr Numeric dSdT() const noexcept { return dSdTval; }
436 [[nodiscard]] constexpr Numeric dSdI0() const noexcept { return dSdI0val; }
437 [[nodiscard]] constexpr Numeric dSdF0() const noexcept { return dSdF0val; }
438 static constexpr Numeric dSdNLTEu() noexcept { return 0; }
439 static constexpr Numeric dSdNLTEl() noexcept { return 0; }
440 [[nodiscard]] constexpr Numeric dSdSELFVMR() const noexcept {
441 return dSdSELFVMRval;
442 }
443
444 static constexpr Numeric dNdT() noexcept { return 0; }
445 static constexpr Numeric dNdI0() noexcept { return 0; }
446 static constexpr Numeric dNdF0() noexcept { return 0; }
447 static constexpr Numeric dNdNLTEu() noexcept { return 0; }
448 static constexpr Numeric dNdNLTEl() noexcept { return 0; }
449 static constexpr Numeric dNdSELFVMR() noexcept { return 0; }
450
451 static constexpr bool do_nlte() noexcept { return false; }
452}; // LocalThermodynamicEquilibrium
453
457
458 static constexpr Numeric c0 = 2.0 * Constant::h / Math::pow2(Constant::c);
459 static constexpr Numeric c1 = Constant::h / (4 * Constant::pi);
460
463
466
470
473
475 Numeric drdSELFVMR,
476 Numeric drdt,
477 Numeric k,
478 Numeric dkdF0,
479 Numeric dkdr1,
480 Numeric dkdr2,
481 Numeric e,
482 Numeric dedF0,
483 Numeric dedr2,
484 Numeric B,
485 Numeric dBdT,
486 Numeric dBdF0) noexcept
487 : S(),
488 N(),
489 dSdTval(drdt * k),
490 dNdTval(drdt * (e - k * B) - r * k * dBdT),
491 dSdF0val(r * dkdF0),
492 dNdF0val(r * (dedF0 - dkdF0 * B - k * dBdF0)),
493 dSdr1(r * dkdr1),
494 dSdr2(r * dkdr2),
495 dNdr2(r * (dedr2 - dkdr2 * B)),
496 dSdSELFVMRval(drdSELFVMR * k),
497 dNdSELFVMRval(drdSELFVMR * (e - k * B)) {
498 S = r * k;
499 N = r * (e - k * B);
500 }
501
503 Numeric A21,
504 Numeric T,
505 Numeric g1,
506 Numeric g2,
507 Numeric r1,
508 Numeric r2,
509 Numeric r,
510 Numeric drdSELFVMR,
511 Numeric drdT) noexcept;
512
513 [[nodiscard]] constexpr Numeric dSdT() const noexcept { return 0; }
514 static constexpr Numeric dSdI0() noexcept { return 0; }
515 [[nodiscard]] constexpr Numeric dSdF0() const noexcept { return dSdF0val; }
516 [[nodiscard]] constexpr Numeric dSdNLTEu() const noexcept { return dSdr1; }
517 [[nodiscard]] constexpr Numeric dSdNLTEl() const noexcept { return dSdr2; }
518 [[nodiscard]] constexpr Numeric dSdSELFVMR() const noexcept {
519 return dSdSELFVMRval;
520 }
521
522 [[nodiscard]] constexpr Numeric dNdT() const noexcept { return dNdTval; }
523 static constexpr Numeric dNdI0() noexcept { return 0; }
524 [[nodiscard]] constexpr Numeric dNdF0() const noexcept { return dNdF0val; }
525 [[nodiscard]] constexpr Numeric dNdNLTEu() const noexcept { return -dSdr1; }
526 [[nodiscard]] constexpr Numeric dNdNLTEl() const noexcept { return dNdr2; }
527 [[nodiscard]] constexpr Numeric dNdSELFVMR() const noexcept {
528 return dNdSELFVMRval;
529 }
530
531 static constexpr bool do_nlte() noexcept { return true; }
532}; // FullNonLocalThermodynamicEquilibrium
533
537
540
543
546
550
553
555 Numeric I0,
556 Numeric QT0,
557 Numeric QT,
558 Numeric dQTdT,
559 Numeric r,
560 Numeric drdSELFVMR,
561 Numeric drdT,
562 Numeric K1,
563 Numeric dK1dT,
564 Numeric K2,
565 Numeric dK2dT,
566 Numeric dK2dF0,
567 Numeric K3,
568 Numeric dK3dT,
569 Numeric dK3dF0,
570 Numeric dK3dTl,
571 Numeric dK3dTu,
572 Numeric K4,
573 Numeric dK4dT,
574 Numeric dK4dTu,
575 Numeric B,
576 Numeric dBdT,
577 Numeric dBdF0) noexcept
578 : S(),
579 N(),
580 dSdI0val(r * QT0 / QT * K1 * K2 * K3),
581 dNdI0val(B * r * QT0 / QT * K1 * K2 * (K4 - K3)),
582 dSdTval(I0 * (drdT * QT0 / QT * K1 * K2 * K3 -
583 r * dQTdT * QT0 / Math::pow2(QT) * K1 * K2 * K3 +
584 r * QT0 / QT * dK1dT * K2 * K3 +
585 r * QT0 / QT * K1 * dK2dT * K3 +
586 r * QT0 / QT * K1 * K2 * dK3dT)),
587 dNdTval(I0 * (dBdT * r * QT0 / QT * K1 * K2 * (K4 - K3) +
588 B * drdT * QT0 / QT * K1 * K2 * (K4 - K3) -
589 B * r * dQTdT * QT0 / Math::pow2(QT) * K1 * K2 *
590 (K4 - K3) +
591 B * r * QT0 / QT * dK1dT * K2 * (K4 - K3) +
592 B * r * QT0 / QT * K1 * dK2dT * (K4 - K3) +
593 B * r * QT0 / QT * K1 * K2 * (dK4dT - dK3dT))),
594 dSdF0val(I0 * (r * QT0 / QT * K1 * dK2dF0 * K3 +
595 r * QT0 / QT * K1 * K2 * dK3dF0)),
596 dNdF0val(I0 * (dBdF0 * r * QT0 / QT * K1 * K2 * (K4 - K3) +
597 B * r * QT0 / QT * K1 * dK2dF0 * (K4 - K3) -
598 B * r * QT0 / QT * K1 * K2 * dK3dF0)),
599 dSdTl(I0 * r * QT0 / QT * K1 * K2 * dK3dTl),
600 dSdTu(I0 * r * QT0 / QT * K1 * K2 * dK3dTu),
601 dNdTu(B * r * QT0 / QT * K1 * K2 * (dK4dTu - dK3dTu)),
602 dSdSELFVMRval(I0 * drdSELFVMR * QT0 / QT * K1 * K2 * K3),
603 dNdSELFVMRval(I0 * B * drdSELFVMR * QT0 / QT * K1 * K2 * (K4 - K3)) {
604 S = I0 * dSdI0val;
605 N = I0 * dNdI0val;
606 }
607
609 Numeric I0,
610 Numeric T0,
611 Numeric T,
612 Numeric Tl,
613 Numeric Tu,
614 Numeric F0,
615 Numeric E0,
616 Numeric Evl,
617 Numeric Evu,
618 Numeric QT,
619 Numeric QT0,
620 Numeric dQTdT,
621 Numeric r,
622 Numeric drdSELFVMR,
623 Numeric drdT) noexcept;
624
625 [[nodiscard]] constexpr Numeric dSdT() const noexcept { return dSdTval; }
626 [[nodiscard]] constexpr Numeric dSdI0() const noexcept { return dSdI0val; }
627 [[nodiscard]] constexpr Numeric dSdF0() const noexcept { return dSdF0val; }
628 [[nodiscard]] constexpr Numeric dSdNLTEu() const noexcept { return dSdTl; }
629 [[nodiscard]] constexpr Numeric dSdNLTEl() const noexcept { return dSdTu; }
630 [[nodiscard]] constexpr Numeric dSdSELFVMR() const noexcept {
631 return dSdSELFVMRval;
632 }
633
634 [[nodiscard]] constexpr Numeric dNdT() const noexcept { return dNdTval; }
635 [[nodiscard]] constexpr Numeric dNdI0() const noexcept { return dNdI0val; }
636 [[nodiscard]] constexpr Numeric dNdF0() const noexcept { return dNdF0val; }
637 [[nodiscard]] constexpr Numeric dNdNLTEu() const noexcept { return -dSdTl; }
638 [[nodiscard]] constexpr Numeric dNdNLTEl() const noexcept { return dNdTu; }
639 [[nodiscard]] constexpr Numeric dNdSELFVMR() const noexcept {
640 return dNdSELFVMRval;
641 }
642
643 static constexpr bool do_nlte() noexcept { return true; }
644}; // VibrationalTemperaturesNonLocalThermodynamicEquilibrium
645
648 using Variant = std::variant<Noshape,
649 Doppler,
650 Lorentz,
651 Voigt,
655
656 public:
657 [[nodiscard]] Complex dFdT(const Output &dXdT, Numeric T) const noexcept;
658
659 [[nodiscard]] Complex dFdf() const noexcept;
660
661 [[nodiscard]] Complex dFdF0() const noexcept;
662
663 [[nodiscard]] Complex dFdH(Numeric dfdH) const noexcept;
664
665 [[nodiscard]] Complex dFdVMR(const Output &dXdVMR) const noexcept;
666
667 [[nodiscard]] Complex dFdFVC(Numeric d) const noexcept;
668
669 [[nodiscard]] Complex dFdETA(Numeric d) const noexcept;
670
671 [[nodiscard]] Complex dFdDV(Numeric d) const noexcept;
672
673 [[nodiscard]] Complex dFdD0(Numeric d) const noexcept;
674
675 [[nodiscard]] Complex dFdG0(Numeric d) const noexcept;
676
677 [[nodiscard]] Complex dFdD2(Numeric d) const noexcept;
678
679 [[nodiscard]] Complex dFdG2(Numeric d) const noexcept;
680
681 [[nodiscard]] Complex F() const noexcept;
682
684 Complex operator()(Numeric f) noexcept;
685
686 Calculator(const Type type,
687 const Numeric F0,
688 const Output &X,
689 const Numeric DC,
690 const Numeric DZ,
691 bool manually_mirrored) noexcept;
692
693 Calculator(const Absorption::MirroringType mirror,
694 const Type type,
695 const Numeric F0,
696 const Output &X,
697 const Numeric DC,
698 const Numeric DZ);
699}; // Calculator
700
702 using Variant = std::variant<Nonorm,
708
709 public:
710 [[nodiscard]] Numeric dNdT(Numeric T, Numeric f) const noexcept;
711
712 [[nodiscard]] Numeric dNdf(Numeric f) const noexcept;
713
714 [[nodiscard]] Numeric dNdF0() const noexcept;
715
716 [[nodiscard]] Numeric operator()(Numeric f) noexcept;
717
718 Normalizer(const Absorption::NormalizationType type,
719 const Numeric F0,
720 const Numeric T) noexcept;
721}; // Normalizer
722
725 using Variant =
726 std::variant<Nostrength,
731
732 public:
734 [[nodiscard]] Numeric S() const noexcept;
735
737 [[nodiscard]] Numeric dSdT() const noexcept;
738
740 [[nodiscard]] Numeric dSdI0() const noexcept;
741
743 [[nodiscard]] Numeric dSdF0() const noexcept;
744
746 [[nodiscard]] Numeric dSdNLTEu() const noexcept;
747
749 [[nodiscard]] Numeric dSdNLTEl() const noexcept;
750
752 [[nodiscard]] Numeric dSdSELFVMR() const noexcept;
753
755 [[nodiscard]] Numeric N() const noexcept;
756
758 [[nodiscard]] Numeric dNdT() const noexcept;
759
761 [[nodiscard]] Numeric dNdI0() const noexcept;
762
764 [[nodiscard]] Numeric dNdF0() const noexcept;
765
767 [[nodiscard]] Numeric dNdNLTEu() const noexcept;
768
770 [[nodiscard]] Numeric dNdNLTEl() const noexcept;
771
773 [[nodiscard]] Numeric dNdSELFVMR() const noexcept;
774
776 [[nodiscard]] constexpr bool do_nlte() const noexcept {
777 return std::visit([](auto &&S) { return S.do_nlte(); }, ls_str);
778 }
779
781 const Numeric QT,
782 const Numeric QT0,
783 const Numeric dQTdT,
784 const Numeric r,
785 const Numeric drdSELFVMR,
786 const Numeric drdT,
787 const EnergyLevelMap &nlte,
788 const Absorption::Lines &band,
789 const Index line_index) noexcept;
790}; // IntensityCalculator
791
797 const bool do_nlte;
798
800 const ArrayOfRetrievalQuantity &jacobian_quantities,
801 const bool nlte) noexcept
802 : F(f.nelem(), 0),
803 N(nlte ? f.nelem() : 0, 0),
804 dF(f.nelem(), jacobian_quantities.nelem(), 0),
805 dN(nlte ? f.nelem() : 0, nlte ? jacobian_quantities.nelem() : 0, 0),
806 f_grid(f),
807 do_nlte(nlte) {}
808
809 void reset() noexcept {
810 F = 0;
811 N = 0;
812 dF = 0;
813 dN = 0;
814 }
815
820 void interp_add_even(const ComputeData &sparse) ARTS_NOEXCEPT;
821
826 void interp_add_triplequad(const ComputeData &sparse) ARTS_NOEXCEPT;
827
830 const Index nf = f_grid.nelem();
831 for (Index i = 0; i < nf; i++) {
832 if (F[i].real() < 0) {
833 F[i] = 0;
834 dF(i, joker) = 0;
835 if (do_nlte) {
836 N[i] = 0;
837 dN(i, joker) = 0;
838 }
839 }
840 }
841 }
842
845 F += other.F;
846 N += other.N;
847 dF += other.dF;
848 dN += other.dN;
849 return *this;
850 }
851};
852
892void compute(ComputeData &com,
893 ComputeData &sparse_com,
894 const AbsorptionLines &band,
895 const ArrayOfRetrievalQuantity &jacobian_quantities,
896 const EnergyLevelMap &rtp_nlte,
897 const Vector &vmrs,
898 const ArrayOfSpeciesTag &self_tag,
899 const Numeric &self_vmr,
900 const Numeric &isot_ratio,
901 const Numeric &rtp_pressure,
902 const Numeric &rtp_temperature,
903 const Numeric &H,
904 const Numeric &sparse_lim,
905 const Zeeman::Polarization zeeman_polarization,
906 const Options::LblSpeedup speedup_type,
907 const bool robust) ARTS_NOEXCEPT;
908
909Vector linear_sparse_f_grid(const Vector &f_grid,
910 const Numeric &sparse_df) ARTS_NOEXCEPT;
911
912bool good_linear_sparse_f_grid(const Vector &f_grid_dense,
913 const Vector &f_grid_sparse) noexcept;
914
915Vector triple_sparse_f_grid(const Vector &f_grid,
916 const Numeric &sparse_df) noexcept;
917
918} // namespace LineShape
919
920#endif // lineshapes_h
Common ARTS conversions.
This can be used to make arrays out of anything.
Definition: array.h:48
The ComplexMatrix class.
The ComplexVector class.
Index nelem() const noexcept
Returns the number of elements.
Definition: matpackI.h:547
Line shape calculator.
Definition: lineshape.h:647
std::variant< Noshape, Doppler, Lorentz, Voigt, SpeedDependentVoigt, HartmannTran > Variant
Definition: lineshape.h:653
Class encapsulating all supported types of intensity calculations of individual absorption lines.
Definition: lineshape.h:724
std::variant< Nostrength, LocalThermodynamicEquilibrium, FullNonLocalThermodynamicEquilibrium, VibrationalTemperaturesNonLocalThermodynamicEquilibrium > Variant
Definition: lineshape.h:729
std::variant< Nonorm, VanVleckHuber, VanVleckWeisskopf, RosenkranzQuadratic, SimpleFrequencyScaling > Variant
Definition: lineshape.h:706
The Vector class.
Definition: matpackI.h:910
#define ARTS_NOEXCEPT
Definition: debug.h:79
Class to map energy levels.
Constains various line scaling functions.
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
std::complex< Numeric > Complex
constexpr Numeric real(Complex c) noexcept
real
Namespace to contain things required for absorption calculations.
constexpr Numeric pi
The following mathematical constants are generated in python Decimal package by the code:
constexpr Numeric k
Boltzmann constant convenience name [J/K].
constexpr Numeric c
Speed of light convenience name [m/s].
constexpr Numeric inv_pi
Inverse of pi.
constexpr Numeric h
Planck constant convenience name [J s].
Computations of line shape derived parameters.
Definition: lineshape.cc:23
constexpr auto pow2(auto x) noexcept
power of two
Polarization
Zeeman polarization selection.
Definition: zeemandata.h:44
constexpr T abs(T x) noexcept
Definition: nonstd.h:13
#define N
Definition: rng.cc:164
Main computational data for the line shape and strength calculations.
Definition: lineshape.h:793
const Vector & f_grid
Definition: lineshape.h:796
ComputeData & operator+=(const ComputeData &other)
Adds two identical compute data fields, the size must be identical.
Definition: lineshape.h:844
ComputeData(const Vector &f, const ArrayOfRetrievalQuantity &jacobian_quantities, const bool nlte) noexcept
Definition: lineshape.h:799
ComplexVector N
Definition: lineshape.h:794
ComplexVector F
Definition: lineshape.h:794
void reset() noexcept
Definition: lineshape.h:809
ComplexMatrix dF
Definition: lineshape.h:795
void enforce_positive_absorption() noexcept
All four fields are set to zero at i if F[i].real() < 0.
Definition: lineshape.h:829
ComplexMatrix dN
Definition: lineshape.h:795
constexpr Doppler(Numeric F0_noshift, Numeric DC, Numeric dZ) noexcept
Definition: lineshape.h:38
Complex operator()(Numeric f) noexcept
Definition: lineshape.cc:24
constexpr Complex dFdT(const Output &, Numeric T) const noexcept
Definition: lineshape.h:41
static constexpr Complex dFdD0(Numeric) noexcept
Definition: lineshape.h:58
static constexpr Complex dFdVMR(const Output &) noexcept
Definition: lineshape.h:56
constexpr Complex dFdH(Numeric dZ) const noexcept
Definition: lineshape.h:51
static constexpr Complex dFdFVC(Numeric) noexcept
Definition: lineshape.h:54
static constexpr Complex dFdDV(Numeric) noexcept
Definition: lineshape.h:57
static constexpr Complex dFdETA(Numeric) noexcept
Definition: lineshape.h:55
constexpr Complex dFdf() const noexcept
Definition: lineshape.h:45
static constexpr Complex dFdD2(Numeric) noexcept
Definition: lineshape.h:60
static constexpr Complex dFdG0(Numeric) noexcept
Definition: lineshape.h:59
static constexpr Complex dFdG2(Numeric) noexcept
Definition: lineshape.h:61
constexpr Complex dFdF0() const noexcept
Definition: lineshape.h:48
static constexpr Numeric dNdI0() noexcept
Definition: lineshape.h:523
constexpr Numeric dSdF0() const noexcept
Definition: lineshape.h:515
constexpr Numeric dNdNLTEl() const noexcept
Definition: lineshape.h:526
constexpr Numeric dSdNLTEl() const noexcept
Definition: lineshape.h:517
constexpr FullNonLocalThermodynamicEquilibrium(Numeric r, Numeric drdSELFVMR, Numeric drdt, Numeric k, Numeric dkdF0, Numeric dkdr1, Numeric dkdr2, Numeric e, Numeric dedF0, Numeric dedr2, Numeric B, Numeric dBdT, Numeric dBdF0) noexcept
Definition: lineshape.h:474
static constexpr bool do_nlte() noexcept
Definition: lineshape.h:531
static constexpr Numeric dSdI0() noexcept
Definition: lineshape.h:514
constexpr Numeric dNdNLTEu() const noexcept
Definition: lineshape.h:525
constexpr Numeric dSdT() const noexcept
Definition: lineshape.h:513
constexpr Numeric dSdSELFVMR() const noexcept
Definition: lineshape.h:518
constexpr Numeric dNdT() const noexcept
Definition: lineshape.h:522
constexpr Numeric dNdSELFVMR() const noexcept
Definition: lineshape.h:527
constexpr Numeric dNdF0() const noexcept
Definition: lineshape.h:524
constexpr Numeric dSdNLTEu() const noexcept
Definition: lineshape.h:516
constexpr LocalThermodynamicEquilibrium(Numeric I0, Numeric r, Numeric drdSELFVMR, Numeric drdT, Numeric QT0, Numeric QT, Numeric dQTdT, Numeric br, Numeric dbr_dT_rat, Numeric stim, Numeric dstim_dT, Numeric dstim_dF0) noexcept
Definition: lineshape.h:401
constexpr Numeric dSdF0() const noexcept
Definition: lineshape.h:437
static constexpr Numeric dNdSELFVMR() noexcept
Definition: lineshape.h:449
static constexpr Numeric dSdNLTEl() noexcept
Definition: lineshape.h:439
static constexpr Numeric dNdT() noexcept
Definition: lineshape.h:444
constexpr Numeric dSdSELFVMR() const noexcept
Definition: lineshape.h:440
static constexpr Numeric dNdNLTEl() noexcept
Definition: lineshape.h:448
static constexpr Numeric dSdNLTEu() noexcept
Definition: lineshape.h:438
constexpr Numeric dSdT() const noexcept
Definition: lineshape.h:435
static constexpr Numeric dNdI0() noexcept
Definition: lineshape.h:445
constexpr Numeric dSdI0() const noexcept
Definition: lineshape.h:436
static constexpr bool do_nlte() noexcept
Definition: lineshape.h:451
static constexpr Numeric dNdNLTEu() noexcept
Definition: lineshape.h:447
static constexpr Numeric dNdF0() noexcept
Definition: lineshape.h:446
constexpr Complex dFdVMR(const Output &d) const noexcept
Definition: lineshape.h:76
constexpr Complex dFdD0(Numeric d) const noexcept
Definition: lineshape.h:92
static constexpr Complex dFdD2(Numeric) noexcept
Definition: lineshape.h:99
constexpr Complex dFdDV(Numeric d) const noexcept
Definition: lineshape.h:89
constexpr Complex dFdF0() const noexcept
Definition: lineshape.h:86
static constexpr Complex dFdG2(Numeric)
Definition: lineshape.h:100
constexpr Complex dFdG0(Numeric d) const noexcept
Definition: lineshape.h:96
constexpr Complex dFdT(const Output &d, Numeric) const noexcept
Definition: lineshape.h:79
static constexpr Complex dFdETA(Numeric) noexcept
Definition: lineshape.h:101
constexpr Complex dFdf() const noexcept
Definition: lineshape.h:83
static constexpr Complex dFdFVC(Numeric) noexcept
Definition: lineshape.h:102
constexpr Lorentz(Numeric F0_noshift, const Output &ls) noexcept
Definition: lineshape.h:73
static constexpr Complex dFdH(Numeric) noexcept
Definition: lineshape.h:95
constexpr Complex operator()(Numeric f) noexcept
Definition: lineshape.h:104
static constexpr Numeric dNdf(Numeric) noexcept
Definition: lineshape.h:280
constexpr Numeric operator()(Numeric) noexcept
Definition: lineshape.h:283
constexpr Nonorm() noexcept=default
constexpr Numeric dNdF0() const noexcept
Definition: lineshape.h:281
static constexpr Complex dFdETA(Numeric) noexcept
Definition: lineshape.h:20
static constexpr Complex dFdH(Numeric) noexcept
Definition: lineshape.h:18
static constexpr Complex dFdG2(Numeric) noexcept
Definition: lineshape.h:26
static constexpr Complex dFdVMR(const Output &) noexcept
Definition: lineshape.h:21
static constexpr Complex dFdT(const Output &, Numeric) noexcept
Definition: lineshape.h:15
static constexpr Complex F
Definition: lineshape.h:13
static constexpr Complex dFdD2(Numeric) noexcept
Definition: lineshape.h:25
static constexpr Complex dFdf() noexcept
Definition: lineshape.h:16
static constexpr Complex dFdG0(Numeric) noexcept
Definition: lineshape.h:24
static constexpr Complex dFdDV(Numeric) noexcept
Definition: lineshape.h:22
static constexpr Complex dFdD0(Numeric) noexcept
Definition: lineshape.h:23
static constexpr Complex dFdF0() noexcept
Definition: lineshape.h:17
static constexpr Complex dFdFVC(Numeric) noexcept
Definition: lineshape.h:19
constexpr Complex operator()(Numeric) const noexcept
Definition: lineshape.h:28
static constexpr Numeric dNdT() noexcept
Definition: lineshape.h:382
static constexpr Numeric dNdNLTEu() noexcept
Definition: lineshape.h:385
static constexpr Numeric dSdNLTEu() noexcept
Definition: lineshape.h:378
static constexpr Numeric dSdI0() noexcept
Definition: lineshape.h:376
static constexpr Numeric dNdF0() noexcept
Definition: lineshape.h:384
static constexpr Numeric dNdI0() noexcept
Definition: lineshape.h:383
static constexpr Numeric dNdSELFVMR() noexcept
Definition: lineshape.h:387
static constexpr Numeric dNdNLTEl() noexcept
Definition: lineshape.h:386
static constexpr Numeric dSdT() noexcept
Definition: lineshape.h:375
static constexpr Numeric dSdNLTEl() noexcept
Definition: lineshape.h:379
static constexpr Numeric dSdSELFVMR() noexcept
Definition: lineshape.h:380
static constexpr bool do_nlte() noexcept
Definition: lineshape.h:389
static constexpr Numeric dSdF0() noexcept
Definition: lineshape.h:377
constexpr Numeric dNdF0() const noexcept
Definition: lineshape.h:364
SimpleFrequencyScaling(Numeric F0_, Numeric T_) noexcept
Definition: lineshape.h:354
constexpr SimpleFrequencyScaling(Numeric exp, Numeric expm1, Numeric F0_, Numeric T_)
Definition: lineshape.h:348
Complex dFdD2(Numeric dD2dD2) const noexcept
Definition: lineshape.cc:141
static constexpr Complex dFdETA(Numeric) noexcept
Definition: lineshape.h:200
Complex dFdD0(Numeric dD0dD0) const noexcept
Definition: lineshape.cc:92
Complex dFdH(Numeric dZ) const noexcept
Definition: lineshape.cc:217
void update_calcs() noexcept
Definition: lineshape.cc:429
Complex dFdG2(Numeric dG2dG2) const noexcept
Definition: lineshape.cc:186
Complex dFdT(const Output &d, Numeric T) const noexcept
Definition: lineshape.cc:307
Complex dFdf() const noexcept
Definition: lineshape.cc:47
Complex dFdF0() const noexcept
Definition: lineshape.cc:64
CalcType init(const Complex c2) const noexcept
Definition: lineshape.cc:416
Complex dFdG0(Numeric dG0dG0) const noexcept
Definition: lineshape.cc:123
Complex dFdVMR(const Output &d) const noexcept
Definition: lineshape.cc:248
static constexpr Complex dFdFVC(Numeric) noexcept
Definition: lineshape.h:201
static constexpr Complex dFdDV(Numeric) noexcept
Definition: lineshape.h:202
Complex operator()(Numeric f) noexcept
Definition: lineshape.cc:403
constexpr Numeric dNdf(Numeric f) const noexcept
Definition: lineshape.h:311
static constexpr Numeric dNdT(Numeric, Numeric) noexcept
Definition: lineshape.h:310
constexpr VanVleckWeisskopf(Numeric F0) noexcept
Definition: lineshape.h:308
constexpr Numeric operator()(Numeric f) noexcept
Definition: lineshape.h:318
constexpr Numeric dNdF0() const noexcept
Definition: lineshape.h:314
constexpr VibrationalTemperaturesNonLocalThermodynamicEquilibrium(Numeric I0, Numeric QT0, Numeric QT, Numeric dQTdT, Numeric r, Numeric drdSELFVMR, Numeric drdT, Numeric K1, Numeric dK1dT, Numeric K2, Numeric dK2dT, Numeric dK2dF0, Numeric K3, Numeric dK3dT, Numeric dK3dF0, Numeric dK3dTl, Numeric dK3dTu, Numeric K4, Numeric dK4dT, Numeric dK4dTu, Numeric B, Numeric dBdT, Numeric dBdF0) noexcept
Definition: lineshape.h:554
static constexpr Complex dFdD2(Numeric) noexcept
Definition: lineshape.h:154
constexpr Voigt(Numeric F0_noshift, const Output &ls, Numeric DC, Numeric dZ) noexcept
Definition: lineshape.h:119
constexpr Complex dFdD0(Numeric d) const noexcept
Definition: lineshape.h:134
constexpr Complex dFdF0() const noexcept
Definition: lineshape.h:130
constexpr Complex dFdH(Numeric dZ) const noexcept
Definition: lineshape.h:140
constexpr Complex dFdT(const Output &d, Numeric T) const noexcept
Definition: lineshape.h:146
constexpr Complex dFdf() const noexcept
Definition: lineshape.h:129
bool OK() const noexcept
Definition: lineshape.h:159
static constexpr Complex dFdG2(Numeric)
Definition: lineshape.h:155
constexpr Complex dFdVMR(const Output &d) const noexcept
Definition: lineshape.h:143
static constexpr Complex dFdFVC(Numeric) noexcept
Definition: lineshape.h:153
constexpr Complex dFdG0(Numeric d) const noexcept
Definition: lineshape.h:137
constexpr Complex dFdDV(Numeric d) const noexcept
Definition: lineshape.h:131
static constexpr Complex dFdETA(Numeric) noexcept
Definition: lineshape.h:152
Complex operator()(Numeric f) noexcept
Definition: lineshape.cc:30
#define d