ARTS  2.3.1285(git:92a29ea9-dirty)
pressurebroadeningdata.cc
Go to the documentation of this file.
1 /* Copyright (C) 2014
2  R *ichard 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 
25 #include "pressurebroadeningdata.h"
26 #include "linerecord.h"
27 
28 
29 inline Numeric test_pressure_shift(const Numeric& T, const Numeric& T0, const Numeric& A, const Numeric& d, const Numeric& m)
30 {
31  return d * pow(T0/T, m) * (1 + A * log(T/T0));
32 }
33 
34 
35 inline Numeric test_pressure_broadening(const Numeric& T, const Numeric& T0, const Numeric& g, const Numeric& n)
36 {
37  return g * pow(T0/T, n);
38 }
39 
40 
41 inline Numeric test_pressure_broadening_speed_term(const Numeric& T, const Numeric& T0, const Numeric& g, const Numeric& n)
42 {
43  return g + n * (T - T0);
44 }
45 
46 inline void voigt_test_params(Numeric& G0, Numeric& D0,
47  const Numeric& aP, const Numeric& sP, const Numeric& T, const Numeric& T0,
48  const Numeric& sA, const Numeric& sg0, const Numeric& sn,
49  const Numeric& sd0, const Numeric& sm,
50  const Numeric& aA, const Numeric& ag0, const Numeric& an,
51  const Numeric& ad0, const Numeric& am)
52 {
53  G0 = sP * test_pressure_broadening(T, T0, sg0, sn) + aP * test_pressure_broadening(T, T0, ag0, an);
54  D0 = sP * test_pressure_shift(T, T0, sA, sd0, sm) + aP *test_pressure_shift(T, T0, aA, ad0, am);
55 }
56 
57 inline void speed_dependent_test_params(Numeric& G0, Numeric& D0, Numeric& G2, Numeric& D2,
58  const Numeric& aP, const Numeric& sP, const Numeric& T, const Numeric& T0,
59  const Numeric& sA, const Numeric& sg0, const Numeric& sn0,
60  const Numeric& sg2, const Numeric& sn2, const Numeric& sd0,
61  const Numeric& sm, const Numeric& sd2,
62  const Numeric& aA, const Numeric& ag0, const Numeric& an0,
63  const Numeric& ag2, const Numeric& an2, const Numeric& ad0,
64  const Numeric& am, const Numeric& ad2)
65 {
66  G0 = sP * test_pressure_broadening(T, T0, sg0, sn0) + aP * test_pressure_broadening(T, T0, ag0, an0);
67  G2 = sP * test_pressure_broadening_speed_term(T, T0, sg2, sn2) + aP * test_pressure_broadening_speed_term(T, T0, ag2, an2);
68  D0 = sP * test_pressure_shift(T, T0, sA, sd0, sm) + aP * test_pressure_shift(T, T0, aA, ad0, am);
69  D2 = sP * sd2 + aP * ad2; // test_pressure_shift(T, T0, 0, d2, 0);
70 }
71 
73 // Broadening calculations below here
75 
76 // Get broadening parameters
78  Numeric& gamma_2,
79  Numeric& eta,
80  Numeric& df_0,
81  Numeric& df_2,
82  Numeric& f_VC,
83  const Numeric& temperature,
84  const Numeric& ref_temperature,
85  const Numeric& pressure,
86  const Numeric& self_pressure,
87  const Index this_species,
88  const Index h2o_species,
89  const ArrayOfIndex& broad_spec_locations,
90  ConstVectorView vmrs) const
91 {
92  gamma_0=gamma_2=eta=df_0=df_2=f_VC=0;
93  switch(mtype) {
94  case PB_NONE:
95  // Note that this is oftentimes not wanted, but a valid case at low pressures
96  break;
97  case PB_AIR_BROADENING:
98  GetAirBroadening(gamma_0, df_0, ref_temperature / temperature, pressure, self_pressure);
99  break;
101  GetAirAndWaterBroadening(gamma_0, df_0, ref_temperature / temperature, pressure, self_pressure,
102  this_species, h2o_species, vmrs);
103  break;
105  GetPlanetaryBroadening(gamma_0, df_0, ref_temperature / temperature, pressure, self_pressure, broad_spec_locations, vmrs);
106  break;
107  case PB_SD_AIR_VOLUME:
108  GetSDAirBroadening(gamma_0,gamma_2,df_0,df_2,ref_temperature / temperature,pressure);
109  break;
111  GetTestBroadening(gamma_0, gamma_2, df_0, vmrs, ref_temperature / temperature, pressure, h2o_species);
112  break;
113  case PB_HTP_AIR_VOLUME:
114  throw std::runtime_error("Not implemented");
115  break;
116  case PB_VOIGT_TEST_WATER:
117  voigt_test_params(gamma_0, df_0,
118  pressure-self_pressure, self_pressure, temperature, ref_temperature,
124  mdata[0][Index(TestParams::am)]);
125  break;
126  case PB_SD_TEST_WATER:
127  speed_dependent_test_params(gamma_0, df_0, gamma_2, df_2,
128  pressure-self_pressure, self_pressure, temperature, ref_temperature,
137  break;
138  }
139 }
140 
141 // Get temperature derivative of the broadening
143  Numeric& dgamma_2_dT,
144  Numeric& deta_dT,
145  Numeric& ddf_0_dT,
146  Numeric& ddf_2_dT,
147  Numeric& df_VC_dT,
148  const Numeric& T,
149  const Numeric& T0,
150  const Numeric& pressure,
151  const Numeric& self_pressure,
152  const Index this_species,
153  const Index h2o_species,
154  const ArrayOfIndex& broad_spec_locations,
155  ConstVectorView vmrs) const
156 {
157  dgamma_0_dT=dgamma_2_dT=deta_dT=ddf_0_dT=ddf_2_dT=df_VC_dT=0;
158  switch(mtype)
159  {
160  case PB_NONE:
161  // Note that this is oftentimes not wanted, but a valid case at low pressures
162  break;
163  case PB_AIR_BROADENING:
164  GetAirBroadening_dT(dgamma_0_dT, ddf_0_dT, T, T0, pressure, self_pressure);
165  break;
167  GetAirAndWaterBroadening_dT(dgamma_0_dT, ddf_0_dT, T, T0, pressure, self_pressure, this_species, h2o_species, vmrs);
168  break;
170  GetPlanetaryBroadening_dT(dgamma_0_dT, ddf_0_dT, T, T0, pressure, self_pressure, broad_spec_locations, vmrs);
171  break;
172  case PB_SD_AIR_VOLUME:
173  GetSDAirBroadening_dT(dgamma_0_dT, dgamma_2_dT, ddf_0_dT, ddf_2_dT, T, T0, pressure);
174  break;
175  case PB_HTP_AIR_VOLUME:
176  GetHTPAirBroadening_dT(dgamma_0_dT, dgamma_2_dT, ddf_0_dT, ddf_2_dT, df_VC_dT, deta_dT, T, T0, pressure);
177  break;
178  default:
179  throw std::runtime_error("You have defined an unknown broadening mechanism.\n");
180  }
181 }
182 
183 
185  const ArrayOfRetrievalQuantity& /*ppd*/,
186  const QuantumIdentifier& /*QI*/,
187  const Numeric& /*theta*/,
188  const Numeric& /*pressure*/,
189  const Numeric& /*self_pressure*/,
190  const Index /*this_species*/,
191  const Index /*h2o_species*/,
192  ConstVectorView /*vmrs*/) const
193 {
194 // const Index nppd = ppd.nelem();
195 //
196 // ComplexVector res(11);
197 // Numeric results1, results2;
198 // Index ipd = 0;
199 //
200 // // nb that continue is here to not count wrongly the number of parameters
201 // for(Index iq = 0; iq < nppd; iq++)
202 // {
203 // if(ppd[iq] == JacPropMatType::VMR)
204 // {
205 // if(QI > ppd[iq].QuantumIdentity())
206 // {
207 // GetPressureBroadeningParams_dSelfVMR(results1, results2, theta, pressure);
208 // res[ipd] = Complex(-results2, results1);
209 // }
210 // else
211 // continue;
212 // }
213 // else if(ppd[iq] == JacPropMatType::LineGammaSelf)
214 // {
215 // if(QI > ppd[iq].QuantumIdentity())
216 // {
217 // GetPressureBroadeningParams_dSelfGamma(results1, theta, self_pressure);
218 // res[ipd] = Complex(0.0, results1);
219 // }
220 // else
221 // continue;
222 // }
223 // else if(ppd[iq] == JacPropMatType::LineGammaForeign)
224 // {
225 // if(QI > ppd[iq].QuantumIdentity())
226 // {
227 // GetPressureBroadeningParams_dForeignGamma(results1, theta, pressure, self_pressure,
228 // this_species, h2o_species, vmrs);
229 // res[ipd] = Complex(0.0, results1);
230 // }
231 // else
232 // continue;
233 // }
234 // else if(ppd[iq] == JacPropMatType::LineGammaWater)
235 // {
236 // if(QI > ppd[iq].QuantumIdentity())
237 // {
238 // GetPressureBroadeningParams_dWaterGamma(results1, theta, pressure,
239 // this_species, h2o_species, vmrs);
240 // res[ipd] = Complex(0.0, results1);
241 // }
242 // else
243 // continue;
244 // }
245 // else if(ppd[iq] == JacPropMatType::LineShiftSelf)
246 // {
247 // if(QI > ppd[iq].QuantumIdentity())
248 // {
249 // GetPressureBroadeningParams_dSelfPsf(results2, theta, self_pressure);
250 // res[ipd] = Complex(-results2, 0.0);
251 // }
252 // else
253 // continue;
254 // }
255 // else if(ppd[iq] == JacPropMatType::LineShiftForeign)
256 // {
257 // if(QI > ppd[iq].QuantumIdentity())
258 // {
259 // GetPressureBroadeningParams_dForeignPsf(results2, theta, pressure, self_pressure,
260 // this_species, h2o_species, vmrs);
261 // res[ipd] = Complex(-results2, 0);
262 // }
263 // else
264 // continue;
265 // }
266 // else if(ppd[iq] == JacPropMatType::LineShiftWater)
267 // {
268 // if(QI > ppd[iq].QuantumIdentity())
269 // {
270 // GetPressureBroadeningParams_dWaterPsf(results2, theta, pressure,
271 // this_species, h2o_species, vmrs);
272 // res[ipd] = Complex(-results2, 0);
273 // }
274 // else
275 // continue;
276 // }
277 // else if(ppd[iq] == JacPropMatType::LineGammaSelfExp)
278 // {
279 // if(QI > ppd[iq].QuantumIdentity())
280 // {
281 // GetPressureBroadeningParams_dSelfExponent(results1, results2, theta, self_pressure);
282 // res[ipd] = Complex(-results2, results1);
283 // }
284 // else
285 // continue;
286 // }
287 // else if(ppd[iq] == JacPropMatType::LineGammaForeignExp)
288 // {
289 // if(QI > ppd[iq].QuantumIdentity())
290 // {
291 // GetPressureBroadeningParams_dForeignExponent(results1, results2, theta, pressure, self_pressure,
292 // this_species, h2o_species, vmrs);
293 // res[ipd] = Complex(-results2, results1);
294 // }
295 // else
296 // continue;
297 // }
298 // else if(ppd[iq] == JacPropMatType::LineGammaWaterExp)
299 // {
300 // if(QI > ppd[iq].QuantumIdentity())
301 // {
302 // GetPressureBroadeningParams_dWaterExponent(results1, results2, theta, pressure,
303 // this_species, h2o_species, vmrs);
304 // res[ipd] = Complex(-results2, results1);
305 // }
306 // else
307 // continue;
308 // }
309 // else
310 // continue;
311 //
312 // // Only activate this when something hit the target
313 // ++ipd;
314 // }
315 //
316 // derivatives.resize(ipd);
317 // for(Index iq = 0; iq < ipd; iq++)
318 // derivatives[iq] = res[iq];
319 }
320 
321 
322 
323 // Get catalog parameter derivatives: self broadening gamma
325  const Numeric& theta,
326  const Numeric& self_pressure) const
327 {
328  switch(mtype)
329  {
330  case PB_NONE:
331  // Note that this is oftentimes not wanted, but a valid case at low pressures
332  break;
333  case PB_AIR_BROADENING:
334  GetAirBroadening_dSelfGamma(gamma_dSelf, theta, self_pressure);
335  break;
337  GetAirAndWaterBroadening_dSelfGamma(gamma_dSelf,theta, self_pressure);
338  break;
340  throw std::runtime_error("Planetary broadening calculation type do not support "
341  "pressure broadening partial derivatives.\n");
342  break;
343  default:
344  throw std::runtime_error("You have defined an unknown broadening mechanism.\n");
345  }
346 }
347 
348 // Get catalog parameter derivatives: foreign broadening gamma
350  const Numeric& theta,
351  const Numeric& pressure,
352  const Numeric& self_pressure,
353  const Index this_species,
354  const Index h2o_species,
355  ConstVectorView vmrs) const
356 {
357  switch(mtype)
358  {
359  case PB_NONE:
360  // Note that this is oftentimes not wanted, but a valid case at low pressures
361  break;
362  case PB_AIR_BROADENING:
363  GetAirBroadening_dForeignGamma(gamma_dForeign, theta, pressure, self_pressure);
364  break;
366  GetAirAndWaterBroadening_dForeignGamma(gamma_dForeign, theta, pressure, self_pressure,
367  this_species, h2o_species, vmrs);
368  break;
370  throw std::runtime_error("Planetary broadening calculation type do not support "
371  "pressure broadening partial derivatives.\n");
372  break;
373  default:
374  throw std::runtime_error("You have defined an unknown broadening mechanism.\n");
375  }
376 }
377 
378 // Get catalog parameter derivatives: water broadening gamma
380  const Numeric& theta,
381  const Numeric& pressure,
382  const Index this_species,
383  const Index h2o_species,
384  ConstVectorView vmrs) const
385 {
386  switch(mtype)
387  {
388  case PB_NONE:
389  // Note that this is oftentimes not wanted, but a valid case at low pressures
390  break;
391  case PB_AIR_BROADENING:
392  throw std::runtime_error("Air broadening calculation type does not support water broadening partial derivatives.\n"
393  "Please check your catalog type and input lines to ensure that you are doing what you expect.\n");
394  break;
396  GetAirAndWaterBroadening_dWaterGamma(gamma_dWater, theta, pressure,
397  this_species, h2o_species, vmrs);
398  break;
400  throw std::runtime_error("Planetary broadening calculation type do not support "
401  "pressure broadening partial derivatives.\n");
402  break;
403  default:
404  throw std::runtime_error("You have defined an unknown broadening mechanism.\n");
405  }
406 }
407 
408 // Get catalog parameter derivatives: self broadening gamma
410  const Numeric& theta,
411  const Numeric& self_pressure) const
412 {
413  switch(mtype)
414  {
415  case PB_NONE:
416  // Note that this is oftentimes not wanted, but a valid case at low pressures
417  break;
418  case PB_AIR_BROADENING:
419  throw std::runtime_error("Air broadening calculations does not support self pressure shift partial derivatives.\n"
420  "Please check your catalog type and input lines to ensure that you are doing what you expect.\n");
421  break;
423  GetAirAndWaterBroadening_dSelfPsf(psf_dSelf,theta, self_pressure);
424  break;
426  throw std::runtime_error("Planetary broadening calculation type do not support "
427  "pressure broadening partial derivatives.\n");
428  break;
429  default:
430  throw std::runtime_error("You have defined an unknown broadening mechanism.\n");
431  }
432 }
433 
434 // Get catalog parameter derivatives: foreign broadening gamma
436  const Numeric& theta,
437  const Numeric& pressure,
438  const Numeric& self_pressure,
439  const Index this_species,
440  const Index h2o_species,
441  ConstVectorView vmrs) const
442 {
443  switch(mtype)
444  {
445  case PB_NONE:
446  // Note that this is oftentimes not wanted, but a valid case at low pressures
447  break;
448  case PB_AIR_BROADENING:
449  GetAirBroadening_dForeignPsf(psf_dForeign, theta, pressure);
450  break;
452  GetAirAndWaterBroadening_dForeignPsf(psf_dForeign, theta, pressure, self_pressure,
453  this_species, h2o_species, vmrs);
454  break;
456  throw std::runtime_error("Planetary broadening calculation type do not support "
457  "pressure broadening partial derivatives.\n");
458  break;
459  default:
460  throw std::runtime_error("You have defined an unknown broadening mechanism.\n");
461  }
462 }
463 
464 // Get catalog parameter derivatives: water broadening psf
466  const Numeric& theta,
467  const Numeric& pressure,
468  const Index this_species,
469  const Index h2o_species,
470  ConstVectorView vmrs) const
471 {
472  switch(mtype)
473  {
474  case PB_NONE:
475  // Note that this is oftentimes not wanted, but a valid case at low pressures
476  break;
477  case PB_AIR_BROADENING:
478  throw std::runtime_error("Air broadening calculation type does not support water broadening partial derivatives.\n"
479  "Please check your catalog type and input lines to ensure that you are doing what you expect.\n");
480  break;
482  GetAirAndWaterBroadening_dWaterPsf(psf_dWater, theta, pressure,
483  this_species, h2o_species, vmrs);
484  break;
486  throw std::runtime_error("Planetary broadening calculation type do not support "
487  "pressure broadening partial derivatives.\n");
488  break;
489  default:
490  throw std::runtime_error("You have defined an unknown broadening mechanism.\n");
491  }
492 }
493 
494 // Get catalog parameter derivatives: self broadening exponent
496  Numeric& psf_dSelfExponent,
497  const Numeric& theta,
498  const Numeric& self_pressure) const
499 {
500  switch(mtype)
501  {
502  case PB_NONE:
503  // Note that this is oftentimes not wanted, but a valid case at low pressures
504  break;
505  case PB_AIR_BROADENING:
506  GetAirBroadening_dSelfExponent(gamma_dSelfExponent, psf_dSelfExponent, theta, self_pressure);
507  break;
509  GetAirAndWaterBroadening_dSelfExponent(gamma_dSelfExponent, psf_dSelfExponent,
510  theta, self_pressure);
511  break;
513  throw std::runtime_error("Planetary broadening calculation type do not support "
514  "pressure broadening partial derivatives.\n");
515  break;
516  default:
517  throw std::runtime_error("You have defined an unknown broadening mechanism.\n");
518  }
519 }
520 
521 // Get catalog parameter derivatives: foreign broadening exponent
523  Numeric& psf_dForeignExponent,
524  const Numeric& theta,
525  const Numeric& pressure,
526  const Numeric& self_pressure,
527  const Index this_species,
528  const Index h2o_species,
529  ConstVectorView vmrs) const
530 {
531 
532  switch(mtype)
533  {
534  case PB_NONE:
535  // Note that this is oftentimes not wanted, but a valid case at low pressures
536  break;
537  case PB_AIR_BROADENING:
538  GetAirBroadening_dForeignExponent(gamma_dForeignExponent, psf_dForeignExponent,
539  theta, pressure, self_pressure);
540  break;
542  GetAirAndWaterBroadening_dForeignExponent(gamma_dForeignExponent, psf_dForeignExponent,
543  theta, pressure, self_pressure,
544  this_species, h2o_species, vmrs);
545  break;
547  throw std::runtime_error("Planetary broadening calculation type do not support "
548  "pressure broadening partial derivatives.\n");
549  break;
550  default:
551  throw std::runtime_error("You have defined an unknown broadening mechanism.\n");
552  }
553 }
554 
556  Numeric& psf_dWaterExponent,
557  const Numeric& theta,
558  const Numeric& pressure,
559  const Index this_species,
560  const Index h2o_species,
561  ConstVectorView vmrs) const
562 {
563  switch(mtype)
564  {
565  case PB_NONE:
566  // Note that this is oftentimes not wanted, but a valid case at low pressures
567  break;
568  case PB_AIR_BROADENING:
569  throw std::runtime_error("Air broadening calculation type does not support water broadening partial derivatives.\n"
570  "Please check your catalog type and input lines to ensure that you are doing what you expect.\n");
571  break;
573  GetAirAndWaterBroadening_dWaterExponent(gamma_dWaterExponent, psf_dWaterExponent,
574  theta, pressure,
575  this_species, h2o_species, vmrs);
576  break;
578  throw std::runtime_error("Planetary broadening calculation type do not support "
579  "pressure broadening partial derivatives.\n");
580  break;
581  default:
582  throw std::runtime_error("You have defined an unknown broadening mechanism.\n");
583  }
584 }
585 
586 // Get VMR influence
588  Numeric& split_dvmr,
589  const Numeric& theta,
590  const Numeric& pressure) const
591 {
592  switch(mtype)
593  {
594  case PB_NONE:
595  // Note that this is oftentimes not wanted, but a valid case at low pressures
596  break;
597  case PB_AIR_BROADENING:
598  gamma_dvmr = pressure * ( -mdata[2][0] * pow(theta,mdata[3][0]) + mdata[0][0] * pow(theta,mdata[1][0]));
599  split_dvmr = 0.0;
600  break;
602  gamma_dvmr = pressure * (- mdata[1][0] * pow(theta,mdata[1][1]) + mdata[0][0] * pow(theta,mdata[0][1]));
603  split_dvmr = pressure * (- mdata[1][2] * pow(theta,(Numeric)0.25+(Numeric)1.5*mdata[1][1]) + mdata[0][2] * pow(theta,(Numeric)0.25+(Numeric)1.5*mdata[0][1]));
604  break;
606  gamma_dvmr = mdata[0][0] * pow(theta, mdata[1][0]) * pressure;
607  split_dvmr = 0.0;
608  break;
609  default:
610  throw std::runtime_error("You have defined an unknown broadening mechanism.\n");
611  }
612 }
613 
615 // Get air broadening
617 
618 // This is the broadening used by ARTSCAT-3; the "N2"-tag in ARTSCAT-5
620  Numeric& deltaf,
621  const Numeric& theta,
622  const Numeric& pressure,
623  const Numeric& self_pressure) const
624 {
625  gamma =
626  mdata[2][0] * pow(theta,mdata[3][0]) * (pressure-self_pressure)
627  + mdata[0][0] * pow(theta,mdata[1][0]) * self_pressure;
628  deltaf =
629  mdata[4][0] * pressure
630  * pow (theta,(Numeric)0.25+(Numeric)1.5*mdata[3][0]);
631 }
632 
633 // This is the temperature derivative of the broadening used by ARTSCAT-3 type of broadening; the "N2"-tag in ARTSCAT-5
635  Numeric& ddeltaf_dT,
636  const Numeric& T,
637  const Numeric& T0,
638  const Numeric& pressure,
639  const Numeric& self_pressure) const
640 {
641  const Numeric theta = T0/T;
642 
643  dgamma_dT = - (mdata[3][0] *
644  mdata[2][0] * pow(theta,mdata[3][0]) * (pressure-self_pressure)
645  + mdata[1][0] *
646  mdata[0][0] * pow(theta,mdata[1][0]) * self_pressure) / T;
647 
648  ddeltaf_dT = - ((Numeric)0.25+(Numeric)1.5*mdata[3][0])/T *
649  mdata[4][0] * pressure
650  * pow (theta,(Numeric)0.25+(Numeric)1.5*mdata[3][0]);
651 }
652 
653 // This is the self broadening derivative of the broadening used by ARTSCAT-3; the "N2"-tag in ARTSCAT-5
655  const Numeric& theta,
656  const Numeric& self_pressure) const
657 {
658  gamma_dSelf = pow(theta, mdata[1][0]) * self_pressure;
659 }
660 
661 // This is the foreign broadening derivative of the broadening used by ARTSCAT-3; the "N2"-tag in ARTSCAT-5
663  const Numeric& theta,
664  const Numeric& pressure,
665  const Numeric& self_pressure) const
666 {
667  gamma_dForeign = pow(theta, mdata[3][0]) * (pressure-self_pressure);
668 }
669 
670 // This is the foreign broadening derivative of the broadening used by ARTSCAT-3; the "N2"-tag in ARTSCAT-5
672  const Numeric& theta,
673  const Numeric& pressure) const
674 {
675  psf_dForeign = pressure * pow (theta,(Numeric)0.25+(Numeric)1.5*mdata[3][0]);
676 }
677 
678 // This is the self broadening exponent derivative of the broadening used by ARTSCAT-3; the "N2"-tag in ARTSCAT-5
680  Numeric& psf_dSelfExponent,
681  const Numeric& theta,
682  const Numeric& self_pressure) const
683 {
684  Numeric log_theta = log(theta);
685  gamma_dSelfExponent = mdata[0][0] * pow(theta,mdata[1][0]) * self_pressure * log_theta;
686  psf_dSelfExponent = 0.; //Note that we assume the broadening is from 'air' so no self regardless of species
687 }
688 
689 // This is the foreign broadening exponent derivative of the broadening used by ARTSCAT-3; the "N2"-tag in ARTSCAT-5
691  Numeric& psf_dForeignExponent,
692  const Numeric& theta,
693  const Numeric& pressure,
694  const Numeric& self_pressure) const
695 {
696  Numeric log_theta = log(theta);
697  gamma_dForeignExponent = mdata[2][0] * pow(theta,mdata[3][0]) * (pressure-self_pressure) * log_theta;
698  psf_dForeignExponent =
699  mdata[4][0] * pressure * pow (theta,(Numeric)0.25+(Numeric)1.5*mdata[3][0]) * log_theta * 1.5;
700 }
701 
703 // Get air and water broadening
705 
706 // This is the broadening used by the "WA"-tag in ARTSCAT-5
708  Numeric& deltaf,
709  const Numeric& theta,
710  const Numeric& pressure,
711  const Numeric& self_pressure,
712  const Index this_species,
713  const Index h2o_species,
714  ConstVectorView vmrs) const
715 {
716  if(this_species==h2o_species)
717  {
718  gamma =
719  mdata[1][0] * pow(theta,mdata[1][1]) * (pressure-self_pressure)
720  + mdata[0][0] * pow(theta,mdata[0][1]) * self_pressure;
721 
722  deltaf =
723  mdata[1][2] * pow(theta,(Numeric)0.25+(Numeric)1.5*mdata[1][1]) * (pressure-self_pressure)
724  + mdata[0][2] * pow(theta,(Numeric)0.25+(Numeric)1.5*mdata[0][1]) * self_pressure;
725  }
726  else if(h2o_species==-1)
727  {
728  gamma =
729  mdata[1][0] * pow(theta,mdata[1][1]) * (pressure-self_pressure)
730  + mdata[0][0] * pow(theta,mdata[0][1]) * self_pressure;
731 
732  deltaf =
733  mdata[1][2] * pow(theta,(Numeric)0.25+(Numeric)1.5*mdata[1][1]) * (pressure-self_pressure)
734  + mdata[0][2] * pow(theta,(Numeric)0.25+(Numeric)1.5*mdata[0][1]) * self_pressure;
735  }
736  else
737  {
738  gamma =
739  mdata[1][0] * pow(theta,mdata[1][1]) * (pressure-self_pressure-vmrs[h2o_species]*pressure)
740  + mdata[0][0] * pow(theta,mdata[0][1]) * self_pressure
741  + mdata[2][0] * pow(theta,mdata[2][1]) * vmrs[h2o_species]*pressure;
742 
743  deltaf =
744  mdata[1][2] * pow(theta,(Numeric)0.25+(Numeric)1.5*mdata[1][1]) * (pressure-self_pressure-vmrs[h2o_species]*pressure)
745  + mdata[0][2] * pow(theta,(Numeric)0.25+(Numeric)1.5*mdata[0][1]) * self_pressure
746  + mdata[2][2] * pow(theta,(Numeric)0.25+(Numeric)1.5*mdata[2][1]) * vmrs[h2o_species]*pressure;
747  }
748 }
749 
750 // This is the temperature derivative of the broadening used by the "WA"-tag in ARTSCAT-5
752  Numeric& ddeltaf_dT,
753  const Numeric& T,
754  const Numeric& T0,
755  const Numeric& pressure,
756  const Numeric& self_pressure,
757  const Index this_species,
758  const Index h2o_species,
759  ConstVectorView vmrs) const
760 {
761  const Numeric theta = T0/T;
762 
763  if(this_species==h2o_species)
764  {
765  dgamma_dT = - (
766  mdata[1][1] * mdata[1][0] * pow(theta,mdata[1][1]) * (pressure-self_pressure)
767  + mdata[0][1] * mdata[0][0] * pow(theta,mdata[0][1]) * self_pressure) / T;
768 
769  ddeltaf_dT = - (
770  ((Numeric)0.25+(Numeric)1.5*mdata[1][1]) * mdata[1][2] * pow(theta,(Numeric)0.25+(Numeric)1.5*mdata[1][1]) * (pressure-self_pressure)
771  + ((Numeric)0.25+(Numeric)1.5*mdata[0][1]) * mdata[0][2] * pow(theta,(Numeric)0.25+(Numeric)1.5*mdata[0][1]) * self_pressure) /T;
772  }
773  else if(h2o_species==-1)
774  {
775  dgamma_dT = - (
776  mdata[1][1] * mdata[1][0] * pow(theta,mdata[1][1]) * (pressure-self_pressure)
777  + mdata[0][1] * mdata[0][0] * pow(theta,mdata[0][1]) * self_pressure) /T;
778 
779  ddeltaf_dT = - (
780  ((Numeric)0.25+(Numeric)1.5*mdata[1][1]) * mdata[1][2] * pow(theta,(Numeric)0.25+(Numeric)1.5*mdata[1][1]) * (pressure-self_pressure)
781  + ((Numeric)0.25+(Numeric)1.5*mdata[0][1]) * mdata[0][2] * pow(theta,(Numeric)0.25+(Numeric)1.5*mdata[0][1]) * self_pressure) / T;
782  }
783  else
784  {
785  dgamma_dT = - (
786  mdata[1][1] * mdata[1][0] * pow(theta,mdata[1][1]) * (pressure-self_pressure-vmrs[h2o_species]*pressure)
787  + mdata[0][1] * mdata[0][0] * pow(theta,mdata[0][1]) * self_pressure
788  + mdata[2][1] * mdata[2][0] * pow(theta,mdata[2][1]) * vmrs[h2o_species]*pressure ) / T;
789 
790  ddeltaf_dT = - (
791  ((Numeric)0.25+(Numeric)1.5*mdata[1][1]) * mdata[1][2] * pow(theta,(Numeric)0.25+(Numeric)1.5*mdata[1][1]) * (pressure-self_pressure-vmrs[h2o_species]*pressure)
792  + ((Numeric)0.25+(Numeric)1.5*mdata[0][1]) * mdata[0][2] * pow(theta,(Numeric)0.25+(Numeric)1.5*mdata[0][1]) * self_pressure
793  + ((Numeric)0.25+(Numeric)1.5*mdata[2][1]) * mdata[2][2] * pow(theta,(Numeric)0.25+(Numeric)1.5*mdata[2][1]) * vmrs[h2o_species]*pressure) / T;
794  }
795 }
796 
797 // This is the self broadening derivative of the broadening used by the "WA"-tag in ARTSCAT-5
799  const Numeric& theta,
800  const Numeric& self_pressure) const
801 {
802  gamma_dSelf = pow(theta,mdata[0][1]) * self_pressure;
803 }
804 
805 // This is the foreign broadening derivative of the broadening used by the "WA"-tag in ARTSCAT-5
807  const Numeric& theta,
808  const Numeric& pressure,
809  const Numeric& self_pressure,
810  const Index this_species,
811  const Index h2o_species,
812  ConstVectorView vmrs) const
813 {
814  if(this_species==h2o_species || h2o_species==-1)
815  gamma_dForeign = pow(theta,mdata[1][1]) * (pressure-self_pressure);
816  else
817  gamma_dForeign = pow(theta,mdata[1][1]) * (pressure-self_pressure-vmrs[h2o_species]*pressure);
818 }
819 
820 // This is the water broadening derivative of the broadening used by the "WA"-tag in ARTSCAT-5
822  const Numeric& theta,
823  const Numeric& pressure,
824  const Index this_species,
825  const Index h2o_species,
826  ConstVectorView vmrs) const
827 {
828  if(this_species==h2o_species)
829  throw std::runtime_error("Use \"Self broadening\" types of derivatives rather than water broadening for water lines.\n");
830  else if(h2o_species==-1)
831  {
832  gamma_dWater = 0.0;
833 
834 // out2 << "You have no H2O in species but you want the water broadening derivative. It is thus set to zero.\n";
835  }
836  else
837  gamma_dWater = pow(theta,mdata[2][1]) * vmrs[h2o_species]*pressure;
838 }
839 
840 // This is the self broadening derivative of the broadening used by the "WA"-tag in ARTSCAT-5
842  const Numeric& theta,
843  const Numeric& self_pressure) const
844 {
845  psf_dSelf = pow(theta,(Numeric)0.25+(Numeric)1.5*mdata[0][1]) * self_pressure;
846 }
847 
848 // This is the foreign broadening derivative of the broadening used by the "WA"-tag in ARTSCAT-5
850  const Numeric& theta,
851  const Numeric& pressure,
852  const Numeric& self_pressure,
853  const Index this_species,
854  const Index h2o_species,
855  ConstVectorView vmrs) const
856 {
857  if(this_species==h2o_species || h2o_species==-1)
858  psf_dForeign = pow(theta,mdata[1][1]) * (pressure-self_pressure);
859  else
860  psf_dForeign = pow(theta,mdata[1][1]) * (pressure-self_pressure-vmrs[h2o_species]*pressure);
861 }
862 
863 // This is the water broadening derivative of the broadening used by the "WA"-tag in ARTSCAT-5
865  const Numeric& theta,
866  const Numeric& pressure,
867  const Index this_species,
868  const Index h2o_species,
869  ConstVectorView vmrs) const
870 {
871  if(this_species==h2o_species)
872  throw std::runtime_error("Use \"Self broadening\" types of derivatives rather than water broadening for water lines.\n");
873  else if(h2o_species==-1)
874  {
875  psf_dWater = 0.0;
876 
877 // out2 << "You have no H2O in species but you want the water broadening derivative. It is thus set to zero.\n";
878  }
879  else
880  psf_dWater = pow(theta,(Numeric)0.25+(Numeric)1.5*mdata[2][1]) * vmrs[h2o_species]*pressure;
881 }
882 
883 // This is the self broadening exponent derivative of the broadening used by the "WA"-tag in ARTSCAT-5
885  Numeric& psf_dSelfExponent,
886  const Numeric& theta,
887  const Numeric& self_pressure) const
888 {
889  Numeric log_theta = log(theta);
890  gamma_dSelfExponent = mdata[0][0] * pow(theta,mdata[0][1]) * self_pressure * log_theta;
891  psf_dSelfExponent = mdata[0][2] * pow(theta,(Numeric)0.25+(Numeric)1.5*mdata[0][1]) * self_pressure * 1.5 * log_theta;
892 }
893 
894 // This is the foreign broadening exponent derivative of the broadening used by the "WA"-tag in ARTSCAT-5
896  Numeric& psf_dForeignExponent,
897  const Numeric& theta,
898  const Numeric& pressure,
899  const Numeric& self_pressure,
900  const Index this_species,
901  const Index h2o_species,
902  ConstVectorView vmrs) const
903 {
904  Numeric log_theta = log(theta);
905  if(this_species==h2o_species || h2o_species==-1)
906  {
907  gamma_dForeignExponent = mdata[1][0]* pow(theta,mdata[1][1]) * (pressure-self_pressure) * log_theta;
908  psf_dForeignExponent = mdata[1][2] * pow(theta,(Numeric)0.25+(Numeric)1.5*mdata[1][1]) * (pressure-self_pressure) * log_theta * 1.5;
909  }
910  else
911  {
912  gamma_dForeignExponent = mdata[1][0]* pow(theta,mdata[1][1]) * (pressure-self_pressure-vmrs[h2o_species]*pressure) * log_theta;
913  psf_dForeignExponent = mdata[1][2] * pow(theta,(Numeric)0.25+(Numeric)1.5*mdata[1][1]) * (pressure-self_pressure-vmrs[h2o_species]*pressure) * log_theta * 1.5;
914  }
915 }
916 
917 // This is the water broadening exponent derivative of the broadening used by the "WA"-tag in ARTSCAT-5
919  Numeric& psf_dWaterExponent,
920  const Numeric& theta,
921  const Numeric& pressure,
922  const Index this_species,
923  const Index h2o_species,
924  ConstVectorView vmrs) const
925 {
926  if(this_species==h2o_species)
927  throw std::runtime_error("Use \"Self broadening\" types of derivatives rather than water broadening for water lines.\n");
928  else if(h2o_species==-1)
929  {
930  gamma_dWaterExponent = 0.0;
931  psf_dWaterExponent = 0.;
932 
933 // out2 << "You have no H2O in species but you want the water broadening derivative. It is thus set to zero.\n";
934  }
935  else
936  {
937  Numeric log_theta = log(theta);
938  gamma_dWaterExponent = mdata[2][0] * pow(theta,mdata[2][1]) * vmrs[h2o_species]*pressure * log_theta;
939  psf_dWaterExponent = mdata[2][2] * pow(theta,(Numeric)0.25+(Numeric)1.5*mdata[2][1]) * vmrs[h2o_species]*pressure * 1.5 * log_theta;
940  }
941 }
942 
943 
945 // Get all planetary broadening
947 
948 // This is the broadening used by ARTSCAT-4; the "AP"-tag in ARTSCAT-5
950  Numeric& /*deltaf*/,
951  const Numeric& /*theta*/,
952  const Numeric& /*pressure*/,
953  const Numeric& /*self_pressure*/,
954  const ArrayOfIndex& /*broad_spec_locations*/,
955  ConstVectorView /*vmrs*/) const
956 {
957 // // Number of broadening species:
958 // const Index nbs = LineRecord::NBroadSpec();
959 // assert(nbs==broad_spec_locations.nelem());
960 //
961 // // Split total pressure in self and foreign part:
962 // const Numeric foreign_pressure = pressure - self_pressure;
963 //
964 // // Calculate sum of VMRs of all available foreign broadening species (we need this
965 // // for normalization). The species "Self" will not be included in the sum!
966 // Numeric broad_spec_vmr_sum = 0;
967 //
968 // // Gamma is the line width. We first initialize gamma with the self width
969 // gamma = mdata[0][0] * pow(theta, mdata[1][0]) * self_pressure;
970 //
971 // // Set deltaf to 0
972 // deltaf = 0;
973 //
974 // // and treat foreign width separately:
975 // Numeric foreign_gamma = 0;
976 //
977 // // Add up foreign broadening species, where available:
978 // for (Index i=0; i<nbs; ++i) {
979 // if ( broad_spec_locations[i] < -1 ) {
980 // // -2 means that this broadening species is identical to Self.
981 // // Throw runtime errors if the parameters are not identical.
982 // if (mdata[2][i]!=mdata[0][0] ||
983 // mdata[3][i]!=mdata[1][0])
984 // {
985 // std::ostringstream os;
986 // os << "Inconsistency in LineRecord, self broadening and line "
987 // << "broadening for " << LineRecord::BroadSpecName(i) << "\n"
988 // << "should be identical.\n";
989 // throw std::runtime_error(os.str());
990 // }
991 // } else if ( broad_spec_locations[i] >= 0 ) {
992 //
993 // // Add to VMR sum:
994 // broad_spec_vmr_sum += vmrs[broad_spec_locations[i]];
995 //
996 // // foreign broadening:
997 // foreign_gamma += mdata[2][i] * pow(theta, mdata[3][i])
998 // * vmrs[broad_spec_locations[i]];
999 //
1000 // // Delta f (not .25+1.5*foreign_broadening)
1001 // deltaf += mdata[4][i]
1002 // * pow( theta , (Numeric).25 + (Numeric)1.5*mdata[3][i] )
1003 // * vmrs[broad_spec_locations[i]];
1004 // }
1005 // }
1006 //
1007 // // // Check that sum of self and all foreign VMRs is not too far from 1:
1008 // // if ( abs(vmrs[this_species]+broad_spec_vmr_sum-1) > 0.1
1009 // // && out2.sufficient_priority() )
1010 // // {
1011 // // std::ostringstream os;
1012 // // os << "Warning: The total VMR of all your defined broadening\n"
1013 // // << "species (including \"self\") is "
1014 // // << vmrs[this_species]+broad_spec_vmr_sum
1015 // // << ", more than 10% " << "different from 1.\n";
1016 // // out2 << os.str();
1017 // // }
1018 //
1019 // // Normalize foreign gamma and deltaf with the foreign VMR sum (but only if
1020 // // we have any foreign broadening species):
1021 // if (broad_spec_vmr_sum != 0.)
1022 // {
1023 // foreign_gamma /= broad_spec_vmr_sum;
1024 // deltaf /= broad_spec_vmr_sum;
1025 // }
1026 // else if (self_pressure > 0.)
1027 // // If there are no foreign broadening species present, the best assumption
1028 // // we can make is to use gamma_self in place of foreign_gamma. for deltaf
1029 // // there is no equivalent solution, as we don't have a Delta_self and don't
1030 // // know which other Delta we should apply (in this case delta_f gets 0,
1031 // // which should be okayish):
1032 // {
1033 // foreign_gamma = gamma/self_pressure;
1034 // }
1035 // // It can happen that broad_spec_vmr_sum==0 AND p_self==0 (e.g., when p_grid
1036 // // exceeds the given atmosphere and zero-padding is applied). In this case,
1037 // // both gamma_foreign and deltaf are 0 and we leave it like that.
1038 //
1039 // // Multiply by pressure. For the width we take only the foreign pressure.
1040 // // This is consistent with that we have scaled with the sum of all foreign
1041 // // broadening VMRs. In this way we make sure that the total foreign broadening
1042 // // scales with the total foreign pressure.
1043 // foreign_gamma *= foreign_pressure;
1044 //
1045 // // For the width, add foreign parts:
1046 // gamma += foreign_gamma;
1047 //
1048 // // For the shift we simply take the total pressure, since there is no self part.
1049 // deltaf *= pressure;
1050 //
1051 // // That's it, we're done.
1052 }
1053 
1054 // This is the temperature derivative of the broadening used by ARTSCAT-4; the "AP"-tag in ARTSCAT-5
1056  Numeric& /*ddeltaf_dT*/,
1057  const Numeric& /*T*/,
1058  const Numeric& /*T0*/,
1059  const Numeric& /*pressure*/,
1060  const Numeric& /*self_pressure*/,
1061  const ArrayOfIndex& /*broad_spec_locations*/,
1062  ConstVectorView /*vmrs*/) const
1063 {
1064 // const Numeric theta = T0/T;
1065 //
1066 // // Number of broadening species:
1067 // const Index nbs = LineRecord::NBroadSpec();
1068 // assert(nbs==broad_spec_locations.nelem());
1069 //
1070 // // Split total pressure in self and foreign part:
1071 // const Numeric foreign_pressure = pressure - self_pressure;
1072 //
1073 // // Calculate sum of VMRs of all available foreign broadening species (we need this
1074 // // for normalization). The species "Self" will not be included in the sum!
1075 // Numeric broad_spec_vmr_sum = 0;
1076 //
1077 // // Gamma is the line width. We first initialize gamma with the self width
1078 // dgamma_dT = - mdata[1][0] * mdata[0][0] * pow(theta, mdata[1][0]) * self_pressure / T;
1079 //
1080 // // Set deltaf to 0
1081 // ddeltaf_dT = 0;
1082 //
1083 // // and treat foreign width separately:
1084 // Numeric foreign_dgamma_dT = 0;
1085 //
1086 // // Add up foreign broadening species, where available:
1087 // for (Index i=0; i<nbs; ++i) {
1088 // if ( broad_spec_locations[i] < -1 ) {
1089 // // -2 means that this broadening species is identical to Self.
1090 // // Throw runtime errors if the parameters are not identical.
1091 // if (mdata[2][i]!=mdata[0][0] ||
1092 // mdata[3][i]!=mdata[1][0])
1093 // {
1094 // std::ostringstream os;
1095 // os << "Inconsistency in LineRecord, self broadening and line "
1096 // << "broadening for " << LineRecord::BroadSpecName(i) << "\n"
1097 // << "should be identical.\n";
1098 // throw std::runtime_error(os.str());
1099 // }
1100 // } else if ( broad_spec_locations[i] >= 0 ) {
1101 //
1102 // // Add to VMR sum:
1103 // broad_spec_vmr_sum += vmrs[broad_spec_locations[i]];
1104 //
1105 // // foreign broadening:
1106 // foreign_dgamma_dT += - mdata[3][i] * mdata[2][i] * pow(theta, mdata[3][i])
1107 // * vmrs[broad_spec_locations[i]] / T;
1108 //
1109 // // Delta f (not .25+1.5*foreign_broadening)
1110 // ddeltaf_dT += - ((Numeric).25 + (Numeric)1.5*mdata[3][i]) * mdata[4][i]
1111 // * pow( theta , (Numeric).25 + (Numeric)1.5*mdata[3][i] )
1112 // * vmrs[broad_spec_locations[i]] / T;
1113 // }
1114 // }
1115 //
1116 // // // Check that sum of self and all foreign VMRs is not too far from 1:
1117 // // if ( abs(vmrs[this_species]+broad_spec_vmr_sum-1) > 0.1
1118 // // && out2.sufficient_priority() )
1119 // // {
1120 // // std::ostringstream os;
1121 // // os << "Warning: The total VMR of all your defined broadening\n"
1122 // // << "species (including \"self\") is "
1123 // // << vmrs[this_species]+broad_spec_vmr_sum
1124 // // << ", more than 10% " << "different from 1.\n";
1125 // // out2 << os.str();
1126 // // }
1127 //
1128 // // Normalize foreign gamma and deltaf with the foreign VMR sum (but only if
1129 // // we have any foreign broadening species):
1130 // if (broad_spec_vmr_sum != 0.)
1131 // {
1132 // foreign_dgamma_dT /= broad_spec_vmr_sum;
1133 // ddeltaf_dT /= broad_spec_vmr_sum;
1134 // }
1135 // else if (self_pressure > 0.)
1136 // // If there are no foreign broadening species present, the best assumption
1137 // // we can make is to use gamma_self in place of foreign_gamma. for deltaf
1138 // // there is no equivalent solution, as we don't have a Delta_self and don't
1139 // // know which other Delta we should apply (in this case delta_f gets 0,
1140 // // which should be okayish):
1141 // {
1142 // foreign_dgamma_dT = dgamma_dT/self_pressure;
1143 // }
1144 // // It can happen that broad_spec_vmr_sum==0 AND p_self==0 (e.g., when p_grid
1145 // // exceeds the given atmosphere and zero-padding is applied). In this case,
1146 // // both gamma_foreign and deltaf are 0 and we leave it like that.
1147 //
1148 // // Multiply by pressure. For the width we take only the foreign pressure.
1149 // // This is consistent with that we have scaled with the sum of all foreign
1150 // // broadening VMRs. In this way we make sure that the total foreign broadening
1151 // // scales with the total foreign pressure.
1152 // foreign_dgamma_dT *= foreign_pressure;
1153 //
1154 // // For the width, add foreign parts:
1155 // dgamma_dT += foreign_dgamma_dT;
1156 //
1157 // // For the shift we simply take the total pressure, since there is no self part.
1158 // ddeltaf_dT *= pressure;
1159 //
1160 // // That's it, we're done.
1161 }
1162 
1163 
1165 // Get SD broadening for air
1167 
1168 // This is the broadening used by the "SD-AIR"-tag in ARTSCAT-5
1170  Numeric& gamma2,
1171  Numeric& delta0,
1172  Numeric& delta2,
1173  const Numeric& theta,
1174  const Numeric& pressure) const
1175 {
1176  gamma0 = mdata[0][0] * pow(theta,mdata[1][0]) * pressure;
1177 
1178  gamma2 = mdata[0][1] * pow(theta,mdata[1][1]) * pressure;
1179 
1180  delta0 = mdata[0][2] * pow(theta,mdata[1][2]) * pressure;
1181 
1182  delta2 = mdata[0][3] * pow(theta,mdata[1][3]) * pressure;
1183 }
1184 
1185 // This is the broadening used by the "SD-AIR"-tag in ARTSCAT-5
1187  Numeric& dgamma2,
1188  Numeric& ddelta0,
1189  Numeric& ddelta2,
1190  const Numeric& T,
1191  const Numeric& T0,
1192  const Numeric& pressure) const
1193 {
1194  const Numeric theta = T0/T;
1195 
1196  dgamma0 = - (mdata[0][0] * pow(theta,mdata[1][0]) * pressure) / T * mdata[1][0];
1197 
1198  dgamma2 = - (mdata[0][1] * pow(theta,mdata[1][1]) * pressure) / T * mdata[1][1];
1199 
1200  ddelta0 = - (mdata[0][2] * pow(theta,mdata[1][2]) * pressure) / T * mdata[1][2];
1201 
1202  ddelta2 = - (mdata[0][3] * pow(theta,mdata[1][3]) * pressure) / T * mdata[1][3];
1203 }
1204 
1205 
1206 
1208 // Get HTP broadening for air
1210 
1211 // This is the broadening used by the "HTP-AIR"-tag in ARTSCAT-5
1213  Numeric& gamma2,
1214  Numeric& delta0,
1215  Numeric& delta2,
1216  Numeric& fvc,
1217  Numeric& eta,
1218  const Numeric& theta,
1219  const Numeric& pressure) const
1220 {
1221  gamma0 = mdata[0][0] * pow(theta,mdata[1][0]) * pressure;
1222 
1223  gamma2 = mdata[0][1] * pow(theta,mdata[1][1]) * pressure;
1224 
1225  delta0 = mdata[0][2] * pow(theta,mdata[1][2]) * pressure;
1226 
1227  delta2 = mdata[0][3] * pow(theta,mdata[1][3]) * pressure;
1228 
1229  fvc = mdata[0][4] * pow(theta,mdata[1][4]) * pressure;
1230 
1231  eta = mdata[0][5] * pow(theta,mdata[1][5]) * pressure;
1232 }
1233 
1234 
1235 // This is the broadening used by the "HTP-AIR"-tag in ARTSCAT-5
1237  Numeric& dgamma2,
1238  Numeric& ddelta0,
1239  Numeric& ddelta2,
1240  Numeric& dfvc,
1241  Numeric& deta,
1242  const Numeric& T,
1243  const Numeric& T0,
1244  const Numeric& pressure) const
1245 {
1246  const Numeric theta = T0/T;
1247 
1248  dgamma0 = - (mdata[0][0] * pow(theta,mdata[1][0]) * pressure) / T * mdata[1][0];
1249 
1250  dgamma2 = - (mdata[0][1] * pow(theta,mdata[1][1]) * pressure) / T * mdata[2][1];
1251 
1252  ddelta0 = - (mdata[0][2] * pow(theta,mdata[1][2]) * pressure) / T * mdata[1][2];
1253 
1254  ddelta2 = - (mdata[0][3] * pow(theta,mdata[1][3]) * pressure) / T * mdata[1][3];
1255 
1256  dfvc = - (mdata[0][4] * pow(theta,mdata[1][4]) * pressure) / T * mdata[1][4];
1257 
1258  deta = - (mdata[0][5] * pow(theta,mdata[1][5]) * pressure) / T * mdata[1][5];
1259 }
1260 
1262 // Get SD broadening for air
1264 
1265 // This is the broadening used by the "Testing"-tag in ARTSCAT-5
1267  Numeric& gamma2,
1268  Numeric& delta0,
1270  const Numeric& theta,
1271  const Numeric& pressure,
1272  const Index h2o_index) const
1273 {
1274  if(h2o_index > -1)
1275  {
1276  gamma0 = (mdata[0][0] * pow(theta,mdata[1][0]) * (1 - vmrs[h2o_index]) +
1277  mdata[2][0] * pow(theta,mdata[3][0]) * vmrs[h2o_index]) * pressure ;
1278 
1279  delta0 = (mdata[4][0] * (1 - vmrs[h2o_index]) +
1280  mdata[5][0] * vmrs[h2o_index]) * pressure;
1281 
1282  gamma2 = (mdata[6][0] * (1 - vmrs[h2o_index]) +
1283  mdata[7][0] * vmrs[h2o_index]) * pressure;
1284  }
1285  else
1286  {
1287  gamma0 = mdata[0][0] * pow(theta,mdata[1][0]) * pressure;
1288  delta0 = mdata[4][0] * pressure;
1289  gamma2 = mdata[6][0] * pressure;
1290  }
1291 
1292 }
1293 
1295 // Catalog interactions here
1297 
1298 // Use these to insert the data in the required format from catalog readings
1300  const Numeric& nself,
1301  const Numeric& agam,
1302  const Numeric& nair,
1303  const Numeric& air_pressure_DF,
1304  const Numeric& dsgam,
1305  const Numeric& dnself,
1306  const Numeric& dagam,
1307  const Numeric& dnair,
1308  const Numeric& dair_pressure_DF)
1309 {
1311  mdata.resize(5);
1312  mdataerror.resize(5);
1313  for(Index ii=0;ii<5;ii++)
1314  {
1315  mdata[ii].resize(1);
1316  mdataerror[ii].resize(1);
1317  }
1318  mdata[0][0] = sgam; // Self broadening gamma parameter
1319  mdata[1][0] = nself; // Self broadening n parameter
1320  mdata[2][0] = agam; // Air broadening gamma parameter
1321  mdata[3][0] = nair; // Air broadening n parameter
1322  mdata[4][0] = air_pressure_DF; // Pressure shift parameter
1323 
1324  mdataerror[0][0] = dsgam; // Self broadening gamma parameter
1325  mdataerror[1][0] = dnself; // Self broadening n parameter
1326  mdataerror[2][0] = dagam; // Air broadening gamma parameter
1327  mdataerror[3][0] = dnair; // Air broadening n parameter
1328  mdataerror[4][0] = dair_pressure_DF; // Pressure shift parameter
1329 }
1330 
1331 
1332 // Use these to insert the data in the required format from catalog readings
1334  const Numeric& sn,
1335  const Numeric& sdelta,
1336  const Numeric& agam,
1337  const Numeric& an,
1338  const Numeric& adelta,
1339  const Numeric& wgam,
1340  const Numeric& wn,
1341  const Numeric& wdelta)
1342 {
1344  mdata.resize(3);
1345  mdataerror.resize(0);
1346 
1347  mdata[0].resize(3);
1348  mdata[0][0] = sgam; // Self broadening gamma parameter
1349  mdata[0][1] = sn; // Self broadening n parameter
1350  mdata[0][2] = sdelta; // Self broadening shift parameter
1351 
1352  mdata[1].resize(3);
1353  mdata[1][0] = agam; // Air broadening gamma parameter
1354  mdata[1][1] = an; // Air broadening n parameter
1355  mdata[1][2] = adelta; // Air broadening shift parameter
1356 
1357  mdata[2].resize(3);
1358  mdata[2][0] = wgam; // Water broadening gamma parameter
1359  mdata[2][1] = wn; // Water broadening n parameter
1360  mdata[2][2] = wdelta; // Water broadening shift parameter
1361 }
1362 
1363 
1364 // Use these to insert the data in the required format from catalog readings
1366  const Numeric& nself,
1367  const Vector& foreign_gamma,
1368  const Vector& n_foreign,
1369  const Vector& foreign_pressure_DF)
1370 {
1371  // All vectors must have the same length
1372  assert(n_foreign.nelem()==foreign_gamma.nelem());
1373  assert(foreign_pressure_DF.nelem()==foreign_gamma.nelem());
1374 
1376  mdata.resize(5);
1377  mdataerror.resize(0);
1378  for(Index ii=0;ii<2;ii++)
1379  {
1380  mdata[ii].resize(1);
1381  }
1382  mdata[0][0] = sgam; // Self broadening gamma parameter
1383  mdata[1][0] = nself; // Self broadening n parameter
1384  mdata[2] = foreign_gamma; // Gas broadening gamma parameter per species
1385  mdata[3] = n_foreign; // Gas broadening n parameter per species
1386  mdata[4] = foreign_pressure_DF; // Pressure shift parameter per species
1387 }
1388 
1389 // Use these to insert the data in the required format from catalog readings
1391  const Numeric& gamma0_exp,
1392  const Numeric& gamma2,
1393  const Numeric& gamma2_exp,
1394  const Numeric& delta0,
1395  const Numeric& delta0_exp,
1396  const Numeric& delta2,
1397  const Numeric& delta2_exp)
1398 {
1400  mdata.resize(2);
1401  mdataerror.resize(0);
1402  for(Index ii=0;ii<2;ii++)
1403  {
1404  mdata[ii].resize(4);
1405  }
1406 
1407  mdata[0][0] = gamma0;
1408  mdata[1][0] = gamma0_exp;
1409 
1410  mdata[0][1] = gamma2;
1411  mdata[1][1] = gamma2_exp;
1412 
1413  mdata[0][2] = delta0;
1414  mdata[1][2] = delta0_exp;
1415 
1416  mdata[0][3] = delta2;
1417  mdata[1][3] = delta2_exp;
1418 }
1419 
1420 // Use these to insert the data in the required format from catalog readings
1422  const Numeric& gamma0_exp,
1423  const Numeric& gamma2,
1424  const Numeric& gamma2_exp,
1425  const Numeric& delta0,
1426  const Numeric& delta0_exp,
1427  const Numeric& delta2,
1428  const Numeric& delta2_exp,
1429  const Numeric& fvc,
1430  const Numeric& fvc_exp,
1431  const Numeric& eta,
1432  const Numeric& eta_exp)
1433 {
1435  mdata.resize(2);
1436  mdataerror.resize(0);
1437  for(Index ii=0;ii<2;ii++)
1438  {
1439  mdata[ii].resize(4);
1440  }
1441 
1442  mdata[0][0] = gamma0;
1443  mdata[1][0] = gamma0_exp;
1444 
1445  mdata[0][1] = gamma2;
1446  mdata[1][1] = gamma2_exp;
1447 
1448  mdata[0][2] = delta0;
1449  mdata[1][2] = delta0_exp;
1450 
1451  mdata[0][3] = delta2;
1452  mdata[1][3] = delta2_exp;
1453 
1454  mdata[0][4] = fvc;
1455  mdata[1][4] = fvc_exp;
1456 
1457  mdata[0][5] = eta;
1458  mdata[1][5] = eta_exp;
1459 }
1460 
1461 // Use these to insert the data in the required format from catalog readings
1463  const Numeric& gamma0_air_exp,
1464  const Numeric& gamma0_water,
1465  const Numeric& gamma0_water_exp,
1466  const Numeric& gamma2_air,
1467  const Numeric& gamma2_water,
1468  const Numeric& delta0_air,
1469  const Numeric& delta0_water)
1470 {
1472  mdata.resize(8);
1473  mdataerror.resize(0);
1474  for(Index ii=0;ii<8;ii++)
1475  {
1476  mdata[ii].resize(1);
1477  }
1478 
1479  mdata[0][0] = gamma0_air;
1480  mdata[1][0] = gamma0_air_exp;
1481 
1482  mdata[2][0] = gamma0_water;
1483  mdata[3][0] = gamma0_water_exp;
1484 
1485  mdata[4][0] = delta0_air;
1486  mdata[5][0] = delta0_water;
1487 
1488  mdata[6][0] = gamma2_air;
1489  mdata[7][0] = gamma2_water;
1490 
1491 }
1492 
1494 // Change of internals formats
1496 
1498  const Index this_species,
1499  const Index h2o_species,
1500  const ArrayOfIndex& broad_spec_locations)
1501 {
1502  switch(mtype)
1503  {
1504  case PB_NONE:
1505  // Note that this is oftentimes not wanted, but a valid case at low pressures
1506  break;
1507  case PB_AIR_BROADENING:
1508  mdata[0][0]+=change;
1509  break;
1511  mdata[0][0]+=change;
1512  if(this_species==h2o_species)
1513  mdata[2][0]+=change;
1514  break;
1516  mdata[0][0]+=change;
1517  for(Index ii=0;ii<broad_spec_locations.nelem();ii++)
1518  if(broad_spec_locations[ii]==-2)
1519  mdata[2][ii]+=change;
1520  break;
1521  default:
1522  throw std::runtime_error("ChangeSelf: Cannot recognize type");
1523  }
1524 }
1526  const Index this_species,
1527  const Index h2o_species,
1528  const ArrayOfIndex& broad_spec_locations)
1529 {
1530  switch(mtype)
1531  {
1532  case PB_NONE:
1533  // Note that this is oftentimes not wanted, but a valid case at low pressures
1534  break;
1535  case PB_AIR_BROADENING:
1536  mdata[1][0]+=change;
1537  break;
1539  mdata[0][1]+=change;
1540  if(this_species==h2o_species)
1541  mdata[2][1]+=change;
1542  break;
1544  mdata[1][0]+=change;
1545  for(Index ii=0;ii<broad_spec_locations.nelem();ii++)
1546  if(broad_spec_locations[ii]==-2)
1547  mdata[3][ii]+=change;
1548  break;
1549  default:
1550  throw std::runtime_error("ChangeSelfExponent: Cannot recognize type");
1551  }
1552 }
1554  const Index this_species,
1555  const Index h2o_species,
1556  const ArrayOfIndex& broad_spec_locations)
1557 {
1558  switch(mtype)
1559  {
1560  case PB_NONE:
1561  // Note that this is oftentimes not wanted, but a valid case at low pressures
1562  break;
1563  case PB_AIR_BROADENING:
1564  mdata[0][0]=new_value;
1565  break;
1567  mdata[0][0]=new_value;
1568  if(this_species==h2o_species)
1569  mdata[2][0]=new_value;
1570  break;
1572  mdata[0][0]=new_value;
1573  for(Index ii=0;ii<broad_spec_locations.nelem();ii++)
1574  if(broad_spec_locations[ii]==-2)
1575  mdata[2][ii]=new_value;
1576  break;
1577  default:
1578  throw std::runtime_error("SetSelf: Cannot recognize type");
1579  }
1580 }
1582  const Index this_species,
1583  const Index h2o_species,
1584  const ArrayOfIndex& broad_spec_locations)
1585 {
1586  switch(mtype)
1587  {
1588  case PB_NONE:
1589  // Note that this is oftentimes not wanted, but a valid case at low pressures
1590  break;
1591  case PB_AIR_BROADENING:
1592  mdata[1][0]=new_value;
1593  break;
1595  mdata[0][1]=new_value;
1596  if(this_species==h2o_species)
1597  mdata[2][1]=new_value;
1598  break;
1600  mdata[1][0]=new_value;
1601  for(Index ii=0;ii<broad_spec_locations.nelem();ii++)
1602  if(broad_spec_locations[ii]==-2)
1603  mdata[3][ii]=new_value;
1604  break;
1605  default:
1606  throw std::runtime_error("SetSelfExponent: Cannot recognize type");
1607  }
1608 }
1610  const Index this_species,
1611  const Index h2o_species,
1612  const ArrayOfIndex& broad_spec_locations)
1613 {
1614  switch(mtype)
1615  {
1616  case PB_NONE:
1617  // Note that this is oftentimes not wanted, but a valid case at low pressures
1618  break;
1619  case PB_AIR_BROADENING:
1620  mdata[0][0]*=1.0e0+change;
1621  break;
1623  mdata[0][0]*=1.0e0+change;
1624  if(this_species==h2o_species)
1625  mdata[2][0]*=1.0e0+change;
1626  break;
1628  mdata[0][0]*=1.0e0+change;
1629  for(Index ii=0;ii<broad_spec_locations.nelem();ii++)
1630  if(broad_spec_locations[ii]==-2)
1631  mdata[2][ii]*=1.0e0+change;
1632  break;
1633  default:
1634  throw std::runtime_error("ChangeSelfRelative: Cannot recognize type");
1635  }
1636 }
1638  const Index this_species,
1639  const Index h2o_species,
1640  const ArrayOfIndex& broad_spec_locations)
1641 {
1642  switch(mtype)
1643  {
1644  case PB_NONE:
1645  // Note that this is oftentimes not wanted, but a valid case at low pressures
1646  break;
1647  case PB_AIR_BROADENING:
1648  mdata[1][0]*=1.0e0+change;
1649  break;
1651  mdata[0][1]*=1.0e0+change;
1652  if(this_species==h2o_species)
1653  mdata[2][1]*=1.0e0+change;
1654  break;
1656  mdata[1][0]*=1.0e0+change;
1657  for(Index ii=0;ii<broad_spec_locations.nelem();ii++)
1658  if(broad_spec_locations[ii]==-2)
1659  mdata[3][ii]*=1.0e0+change;
1660  break;
1661  default:
1662  throw std::runtime_error("ChangeSelfExponentRelative: Cannot recognize type");
1663  }
1664 }
1666  const ArrayOfIndex& broad_spec_locations)
1667 {
1668  switch(mtype)
1669  {
1670  case PB_NONE:
1671  // Note that this is oftentimes not wanted, but a valid case at low pressures
1672  break;
1673  case PB_AIR_BROADENING:
1674  mdata[2][0]+=change;
1675  break;
1677  mdata[1][0]+=change;
1678  break;
1680  for(Index ii=0;ii<broad_spec_locations.nelem();ii++)
1681  if(broad_spec_locations[ii]!=-2)
1682  mdata[2][ii]+=change;
1683  break;
1684  default:
1685  throw std::runtime_error("ChangeForeign: Cannot recognize type");
1686  }
1687 }
1689  const ArrayOfIndex& broad_spec_locations)
1690 {
1691  switch(mtype)
1692  {
1693  case PB_NONE:
1694  // Note that this is oftentimes not wanted, but a valid case at low pressures
1695  break;
1696  case PB_AIR_BROADENING:
1697  mdata[3][0]+=change;
1698  break;
1700  mdata[1][1]+=change;
1701  break;
1703  for(Index ii=0;ii<broad_spec_locations.nelem();ii++)
1704  if(broad_spec_locations[ii]!=-2)
1705  mdata[3][ii]+=change;
1706  break;
1707  default:
1708  throw std::runtime_error("ChangeForeignExponent: Cannot recognize type");
1709  }
1710 }
1712  const ArrayOfIndex& broad_spec_locations)
1713 {
1714  switch(mtype)
1715  {
1716  case PB_NONE:
1717  // Note that this is oftentimes not wanted, but a valid case at low pressures
1718  break;
1719  case PB_AIR_BROADENING:
1720  mdata[2][0]=new_value;
1721  break;
1723  mdata[1][0]=new_value;
1724  break;
1726  for(Index ii=0;ii<broad_spec_locations.nelem();ii++)
1727  if(broad_spec_locations[ii]!=-2)
1728  mdata[2][ii]=new_value;
1729  break;
1730  default:
1731  throw std::runtime_error("SetForeign: Cannot recognize type");
1732  }
1733 }
1735  const ArrayOfIndex& broad_spec_locations)
1736 {
1737  switch(mtype)
1738  {
1739  case PB_NONE:
1740  // Note that this is oftentimes not wanted, but a valid case at low pressures
1741  break;
1742  case PB_AIR_BROADENING:
1743  mdata[3][0]=new_value;
1744  break;
1746  mdata[1][1]=new_value;
1747  break;
1749  for(Index ii=0;ii<broad_spec_locations.nelem();ii++)
1750  if(broad_spec_locations[ii]!=-2)
1751  mdata[3][ii]=new_value;
1752  break;
1753  default:
1754  throw std::runtime_error("SetForeignExponent: Cannot recognize type");
1755  }
1756 }
1758  const ArrayOfIndex& broad_spec_locations)
1759 {
1760  switch(mtype)
1761  {
1762  case PB_NONE:
1763  // Note that this is oftentimes not wanted, but a valid case at low pressures
1764  break;
1765  case PB_AIR_BROADENING:
1766  mdata[2][0]*=1.0e0+change;
1767  break;
1769  mdata[1][0]*=1.0e0+change;
1770  break;
1772  for(Index ii=0;ii<broad_spec_locations.nelem();ii++)
1773  if(broad_spec_locations[ii]!=-2)
1774  mdata[2][ii]*=1.0e0+change;
1775  break;
1776  default:
1777  throw std::runtime_error("ChangeForeignRelative: Cannot recognize type");
1778  }
1779 }
1781  const ArrayOfIndex& broad_spec_locations)
1782 {
1783  switch(mtype)
1784  {
1785  case PB_NONE:
1786  // Note that this is oftentimes not wanted, but a valid case at low pressures
1787  break;
1788  case PB_AIR_BROADENING:
1789  mdata[3][0]*=1.0e0+change;
1790  break;
1792  mdata[1][1]*=1.0e0+change;
1793  break;
1795  for(Index ii=0;ii<broad_spec_locations.nelem();ii++)
1796  if(broad_spec_locations[ii]!=-2)
1797 
1798  mdata[3][ii]*=1.0e0+change;
1799  break;
1800  default:
1801  throw std::runtime_error("ChangeForeignExponentRelative: Cannot recognize type");
1802  }
1803 }
1805  const ArrayOfIndex& broad_spec_locations)
1806 {
1807  switch(mtype)
1808  {
1809  case PB_NONE:
1810  // Note that this is oftentimes not wanted, but a valid case at low pressures
1811  break;
1812  case PB_AIR_BROADENING:
1813  mdata[4][0]*=1.0e0+change;
1814  break;
1816  mdata[1][2]*=1.0e0+change;
1817  break;
1819  for(Index ii=0;ii<broad_spec_locations.nelem();ii++)
1820  if(broad_spec_locations[ii]!=-2)
1821  mdata[4][ii]*=1.0e0+change;
1822  break;
1823  default:
1824  throw std::runtime_error("ChangeForeignRelative: Cannot recognize type");
1825  }
1826 }
1828  const ArrayOfIndex& broad_spec_locations)
1829 {
1830  switch(mtype)
1831  {
1832  case PB_NONE:
1833  // Note that this is oftentimes not wanted, but a valid case at low pressures
1834  break;
1835  case PB_AIR_BROADENING:
1836  mdata[4][0]+=change;
1837  break;
1839  mdata[1][2]+=change;
1840  break;
1842  for(Index ii=0;ii<broad_spec_locations.nelem();ii++)
1843  if(broad_spec_locations[ii]!=-2)
1844  mdata[4][ii]+=change;
1845  break;
1846  default:
1847  throw std::runtime_error("ChangeForeignRelative: Cannot recognize type");
1848  }
1849 }
1850 
1852 // Formating and readings here
1854 
1856 {
1857  switch(mtype) {
1858  case PB_NONE:
1859  return 0;
1860  case PB_AIR_BROADENING:
1861  return 10;
1863  return 9;
1865  return 20;
1866  case PB_PURELY_FOR_TESTING:
1867  case PB_SD_AIR_VOLUME:
1868  return 8;
1869  case PB_HTP_AIR_VOLUME:
1870  return 12;
1871  case PB_VOIGT_TEST_WATER:
1872  case PB_SD_TEST_WATER:
1873  return Index(TestParams::COUNT);
1874  }
1875  return -1;
1876 }
1877 
1879 {
1880  if(input.nelem()!=ExpectedVectorLengthFromType())
1881  throw std::runtime_error("Input pressure broadening is of wrong length.\n");
1882 
1883  switch(mtype)
1884  {
1885  case PB_NONE:
1886  // The none case
1887  mdata.resize(0);
1888  mdataerror.resize(0);
1889  break;
1890  case PB_AIR_BROADENING:
1891  SetAirBroadeningFromCatalog(input[0], input[1], input[2], input[3], input[4], input[5], input[6], input[7], input[8], input[9]);
1892  break;
1894  SetAirAndWaterBroadeningFromCatalog(input[0], input[1], input[2], input[3], input[4], input[5], input[6], input[7], input[8]);
1895  break;
1897  SetPlanetaryBroadeningFromCatalog(input[0], input[7], input[Range(1,6)], input[Range(8,6)], input[Range(14,6)]);
1898  break;
1899  case PB_PURELY_FOR_TESTING:
1900  case PB_SD_AIR_VOLUME:
1901  SetSDAirFromCatalog(input[0], input[1], input[2], input[3], input[4], input[5], input[6], input[7]);
1902  break;
1903  case PB_HTP_AIR_VOLUME:
1904  SetHTPAirFromCatalog(input[0], input[1], input[2], input[3], input[4], input[5], input[6], input[7], input[8], input[9], input[10], input[11]);
1905  break;
1906  case PB_VOIGT_TEST_WATER:
1907  case PB_SD_TEST_WATER:
1908  mdata.resize(1);
1909  mdata[0] = input;
1910  break;
1911  }
1912 }
1913 
1915 {
1916  if(input == "NA") // The none case
1917  mtype=PB_NONE;
1918  else if(input == "N2") // Air Broadening is N2 broadening mostly...
1920  else if(input == "WA") // Water and Air Broadening
1922  else if(input == "AP") // Planetary broadening
1924  else if(input == "SD-AIR")
1926  else if(input == "HTP-AIR")
1928  else if(input == "TESTING")
1930  else if(input == "PB_SD_TEST_WATER")
1932  else if(input == "PB_VOIGT_TEST_WATER")
1934  else
1935  throw std::runtime_error("StorageTag2SetType: Cannot recognize tag.\n");
1936 }
1937 
1939 {
1941  output.resize(n);
1942 
1943  switch(mtype) {
1944  case PB_NONE:
1945  break;
1946  case PB_AIR_BROADENING:
1947  output[0]=mdata[0][0];
1948  output[1]=mdata[1][0];
1949  output[2]=mdata[2][0];
1950  output[3]=mdata[3][0];
1951  output[4]=mdata[4][0];
1952  output[5]=mdataerror[0][0];
1953  output[6]=mdataerror[1][0];
1954  output[7]=mdataerror[2][0];
1955  output[8]=mdataerror[3][0];
1956  output[9]=mdataerror[4][0];
1957  break;
1959  output[0]=mdata[0][0];
1960  output[1]=mdata[0][1];
1961  output[2]=mdata[0][2];
1962  output[3]=mdata[1][0];
1963  output[4]=mdata[1][1];
1964  output[5]=mdata[1][2];
1965  output[6]=mdata[2][0];
1966  output[7]=mdata[2][1];
1967  output[8]=mdata[2][2];
1968  break;
1970  output[0]=mdata[0][0];
1971  output[7]=mdata[1][0];
1972  output[Range(1,6)]=mdata[2];
1973  output[Range(8,6)]=mdata[3];
1974  output[Range(14,6)]=mdata[4];
1975  break;
1976  case PB_SD_AIR_VOLUME:
1977  case PB_HTP_AIR_VOLUME:
1978  for(Index i = 0; i < n; i++) {
1979  if(i%2)
1980  output[i] = mdata[1][i/2];
1981  else
1982  output[i] = mdata[0][i/2];
1983  }
1984  break;
1985  case PB_PURELY_FOR_TESTING:
1986  for(Index i = 0; i < n; i++)
1987  output[i] = mdata[i][0];
1988  break;
1989  case PB_VOIGT_TEST_WATER:
1990  case PB_SD_TEST_WATER:
1991  output = mdata[0];
1992  break;
1993  }
1994 }
1995 
1996 
1998 {
1999  String output;
2000 
2001  switch(mtype) {
2002  case PB_NONE:
2003  return "NA";
2004  case PB_AIR_BROADENING:
2005  return "N2";
2007  return "WA";
2008  case PB_SD_AIR_VOLUME:
2009  return "SD-AIR";
2010  case PB_HTP_AIR_VOLUME:
2011  return "HTP-AIR";
2013  return "AP";
2014  case PB_SD_TEST_WATER:
2015  return "PB_SD_TEST_WATER";
2016  case PB_VOIGT_TEST_WATER:
2017  return "PB_VOIGT_TEST_WATER";
2018  case PB_PURELY_FOR_TESTING:
2019  throw std::runtime_error("Cannot save pure testing version");
2020  }
2021  return "-1";
2022 }
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
Numeric test_pressure_shift(const Numeric &T, const Numeric &T0, const Numeric &A, const Numeric &d, const Numeric &m)
void GetAirBroadening_dSelfExponent(Numeric &gamma_dSelfExponent, Numeric &psf_dSelfExponent, const Numeric &theta, const Numeric &self_pressure) const
void GetAirAndWaterBroadening_dWaterPsf(Numeric &psf_dWater, const Numeric &theta, const Numeric &pressure, const Index this_species, const Index h2o_species, ConstVectorView vmrs) const
void SetDataFromVectorWithKnownType(ConstVectorView input)
void SetAirBroadeningFromCatalog(const Numeric &sgam, const Numeric &nself, const Numeric &agam, const Numeric &nair, const Numeric &air_pressure_DF, const Numeric &dsgam, const Numeric &dnself, const Numeric &dagam, const Numeric &dnair, const Numeric &dair_pressure_DF)
The HITRAN air broadening scheme was used exclusively for a long time by ARTS.
void SetPlanetaryBroadeningFromCatalog(const Numeric &sgam, const Numeric &nself, const Vector &foreign_gamma, const Vector &n_foreign, const Vector &foreign_pressure_DF)
The ESA planetary study introduced species-dependent pressure broadenings.
Vector vmrs(const ConstVectorView &atmospheric_vmrs, const ArrayOfArrayOfSpeciesTag &atmospheric_species, const QuantumIdentifier &self, const ArrayOfSpeciesTag &lineshape_species, bool self_in_list, bool bath_in_list, Type type)
Returns a VMR vector for this model&#39;s main calculations.
void SetHTPAirFromCatalog(const Numeric &gamma0, const Numeric &gamma0_exp, const Numeric &gamma2, const Numeric &gamma2_exp, const Numeric &delta0, const Numeric &delta0_exp, const Numeric &delta2, const Numeric &delta2_exp, const Numeric &fvc, const Numeric &fvc_exp, const Numeric &eta, const Numeric &eta_exp)
TESTING *.
void ChangeSelfRelative(const Numeric &change, const Index this_species, const Index h2o_species, const ArrayOfIndex &broad_spec_locations)
Method for changing self-broadening by relative amount if available Error if not. ...
void SetSelfExponent(const Numeric &new_value, const Index this_species, const Index h2o_species, const ArrayOfIndex &broad_spec_locations)
Method for setting self-broadening exponent if available Error if not.
void GetPressureBroadeningParams_dForeignGamma(Numeric &gamma_dForeign, const Numeric &theta, const Numeric &pressure, const Numeric &self_pressure, const Index this_species, const Index h2o_species, ConstVectorView vmrs) const
void GetVectorFromData(Vector &output) const
Index nelem() const
Number of elements.
Definition: array.h:195
void GetAirAndWaterBroadening_dForeignGamma(Numeric &dgamma_dForeign, const Numeric &theta, const Numeric &pressure, const Numeric &self_pressure, const Index this_species, const Index h2o_species, ConstVectorView vmrs) const
void SetInternalDerivatives(ComplexVector &derivatives, const ArrayOfRetrievalQuantity &ppd, const QuantumIdentifier &QI, const Numeric &theta, const Numeric &pressure, const Numeric &self_pressure, const Index this_species, const Index h2o_species, ConstVectorView vmrs) const
Sets a vector of derivatives that fits with the QuantumIdentifier and partial derivative.
void GetSDAirBroadening(Numeric &gamma0, Numeric &gamma2, Numeric &delta0, Numeric &delta2, const Numeric &theta, const Numeric &pressure) const
Speed-dependent broadening calculations.
void GetAirBroadening_dForeignGamma(Numeric &gamma_dForeign, const Numeric &theta, const Numeric &pressure, const Numeric &self_pressure) const
void GetPressureBroadeningParams_dForeignExponent(Numeric &gamma_dForeignExponent, Numeric &psf_dForeignExponent, const Numeric &theta, const Numeric &pressure, const Numeric &self_pressure, const Index this_species, const Index h2o_species, ConstVectorView vmrs) const
The Vector class.
Definition: matpackI.h:860
void GetPressureBroadeningParams_dWaterPsf(Numeric &psf_dWater, const Numeric &theta, const Numeric &pressure, const Index this_species, const Index h2o_species, ConstVectorView vmrs) const
void GetSDAirBroadening_dT(Numeric &dgamma0, Numeric &dgamma2, Numeric &ddelta0, Numeric &ddelta2, const Numeric &T, const Numeric &T0, const Numeric &pressure) const
The range class.
Definition: matpackI.h:160
void GetPressureBroadeningParams_dSelfGamma(Numeric &gamma_dSelf, const Numeric &theta, const Numeric &self_pressure) const
void GetAirBroadening_dForeignExponent(Numeric &gamma_dForeignExponent, Numeric &psf_dForeignExponent, const Numeric &theta, const Numeric &pressure, const Numeric &self_pressure) const
void ChangeForeignShiftRelative(const Numeric &change, const ArrayOfIndex &broad_spec_locations)
Method for changing foreing-broadening shift(s) by relative amount if available Error if not availabl...
void GetTestBroadening(Numeric &gamma0, Numeric &gamma2, Numeric &delta0, ConstVectorView vmrs, const Numeric &theta, const Numeric &pressure, const Index h2o_index) const
void ChangeForeign(const Numeric &change, const ArrayOfIndex &broad_spec_locations)
Method for changing foreing-broadening(s) if available Error if not available and no change to water ...
void GetPressureBroadeningParams_dWaterExponent(Numeric &gamma_dWaterExponent, Numeric &psf_dWaterExponent, const Numeric &theta, const Numeric &pressure, const Index this_species, const Index h2o_species, ConstVectorView vmrs) const
Index nelem() const
Returns the number of elements.
Definition: matpackI.cc:51
void ChangeSelf(const Numeric &change, const Index this_species, const Index h2o_species, const ArrayOfIndex &broad_spec_locations)
Method for changing self-broadening if available Error if not.
void GetPressureBroadeningParams(Numeric &gamma_0, Numeric &gamma_2, Numeric &eta, Numeric &df_0, Numeric &df_2, Numeric &f_VC, const Numeric &T, const Numeric &T0, const Numeric &pressure, const Numeric &self_pressure, const Index this_species, const Index h2o_species, const ArrayOfIndex &broad_spec_locations, ConstVectorView vmrs) const
All broadening calculations are easiset to perform via these calls.
void GetAirAndWaterBroadening_dSelfExponent(Numeric &dgamma_dSelfExponent, Numeric &dpsf_dSelfExponent, const Numeric &theta, const Numeric &self_pressure) const
void SetAirAndWaterBroadeningFromCatalog(const Numeric &sgam, const Numeric &sn, const Numeric &sdelta, const Numeric &agam, const Numeric &an, const Numeric &adelta, const Numeric &wgam, const Numeric &wn, const Numeric &wdelta)
The HITRAN air broadening scheme was used exclusively for a long time by ARTS.
void GetPlanetaryBroadening(Numeric &gamma, Numeric &deltaf, const Numeric &theta, const Numeric &pressure, const Numeric &self_pressure, const ArrayOfIndex &broad_spec_locations, ConstVectorView vmrs) const
Planetary broadening calculations.
void ChangeSelfExponent(const Numeric &change, const Index this_species, const Index h2o_species, const ArrayOfIndex &broad_spec_locations)
Method for changing self-broadening exponent if available Error if not.
void GetPressureBroadeningParams_dSelfVMR(Numeric &gamma_dvmr, Numeric &split_dvmr, const Numeric &theta, const Numeric &pressure) const
void GetAirAndWaterBroadening(Numeric &gamma, Numeric &deltaf, const Numeric &theta, const Numeric &pressure, const Numeric &self_pressure, const Index this_species, const Index h2o_species, ConstVectorView vmrs) const
Air and water broadening calculations *.
void GetAirAndWaterBroadening_dSelfGamma(Numeric &dgamma_dSelf, const Numeric &theta, const Numeric &self_pressure) const
void GetAirAndWaterBroadening_dT(Numeric &dgamma_dT, Numeric &ddeltaf_dT, const Numeric &T, const Numeric &T0, const Numeric &pressure, const Numeric &self_pressure, const Index this_species, const Index h2o_species, ConstVectorView vmrs) const
void GetPressureBroadeningParams_dSelfExponent(Numeric &gamma_dSelfExponent, Numeric &psf_dSelfExponent, const Numeric &theta, const Numeric &self_pressure) const
void GetAirAndWaterBroadening_dWaterExponent(Numeric &gamma_dWaterExponent, Numeric &psf_dWaterExponent, const Numeric &theta, const Numeric &pressure, const Index this_species, const Index h2o_species, ConstVectorView vmrs) const
void GetHTPAirBroadening(Numeric &gamma0, Numeric &gamma2, Numeric &delta0, Numeric &delta2, Numeric &fvc, Numeric &eta, const Numeric &theta, const Numeric &pressure) const
Speed-dependent broadening calculations.
Class to identify and match lines by their quantum numbers.
Definition: quantum.h:390
Numeric test_pressure_broadening(const Numeric &T, const Numeric &T0, const Numeric &g, const Numeric &n)
void GetAirAndWaterBroadening_dWaterGamma(Numeric &gamma_dWater, const Numeric &theta, const Numeric &pressure, const Index this_species, const Index h2o_species, ConstVectorView vmrs) const
Contains the pressure broadening data class.
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:33
void GetAirAndWaterBroadening_dForeignExponent(Numeric &dgamma_dForeignExponent, Numeric &dpsf_dForeignExponent, const Numeric &theta, const Numeric &pressure, const Numeric &self_pressure, const Index this_species, const Index h2o_species, ConstVectorView vmrs) const
void SetSDAirFromCatalog(const Numeric &gamma0, const Numeric &gamma0_exp, const Numeric &gamma2, const Numeric &gamma2_exp, const Numeric &delta0, const Numeric &delta0_exp, const Numeric &delta2, const Numeric &delta2_exp)
TESTING.
void ChangeSelfExponentRelative(const Numeric &change, const Index this_species, const Index h2o_species, const ArrayOfIndex &broad_spec_locations)
Method for changing self-broadening exponent by relative amount if available Error if not...
void GetAirAndWaterBroadening_dSelfPsf(Numeric &dpsf_dSelf, const Numeric &theta, const Numeric &self_pressure) const
void GetAirBroadening_dForeignPsf(Numeric &psf_dForeign, const Numeric &theta, const Numeric &pressure) const
Numeric pow(const Rational base, Numeric exp)
Power of.
Definition: rational.h:628
The ComplexVector class.
Definition: complex.h:573
void SetTestFromCatalog(const Numeric &gamma0_air, const Numeric &gamma0_air_exp, const Numeric &gamma0_water, const Numeric &gamma0_water_exp, const Numeric &gamma2_air, const Numeric &gamma2_water, const Numeric &delta0_air, const Numeric &delta0_water)
TESTING.
void SetForeign(const Numeric &new_value, const ArrayOfIndex &broad_spec_locations)
Method for setting foreing-broadening(s) if available Error if not available and no change to water b...
void SetForeignExponent(const Numeric &new_value, const ArrayOfIndex &broad_spec_locations)
Method for setting foreing-broadening exponent(s) if available Error if not available and no change t...
void GetPlanetaryBroadening_dT(Numeric &dgamma_dT, Numeric &ddeltaf_dT, const Numeric &T, const Numeric &T0, const Numeric &pressure, const Numeric &self_pressure, const ArrayOfIndex &broad_spec_locations, ConstVectorView vmrs) const
void GetAirBroadening(Numeric &gamma, Numeric &deltaf, const Numeric &theta, const Numeric &pressure, const Numeric &self_pressure) const
Air broadening calculations.
void voigt_test_params(Numeric &G0, Numeric &D0, const Numeric &aP, const Numeric &sP, const Numeric &T, const Numeric &T0, const Numeric &sA, const Numeric &sg0, const Numeric &sn, const Numeric &sd0, const Numeric &sm, const Numeric &aA, const Numeric &ag0, const Numeric &an, const Numeric &ad0, const Numeric &am)
Numeric test_pressure_broadening_speed_term(const Numeric &T, const Numeric &T0, const Numeric &g, const Numeric &n)
void GetPressureBroadeningParams_dForeignPsf(Numeric &psf_dForeign, const Numeric &theta, const Numeric &pressure, const Numeric &self_pressure, const Index this_species, const Index h2o_species, ConstVectorView vmrs) const
void resize(Index n)
Resize function.
Definition: matpackI.cc:404
void GetPressureBroadeningParams_dT(Numeric &dgamma_0_dT, Numeric &dgamma_2_dT, Numeric &deta_dT, Numeric &ddf_0_dT, Numeric &ddf_2_dT, Numeric &df_VC_dT, const Numeric &T, const Numeric &T0, const Numeric &pressure, const Numeric &self_pressure, const Index this_species, const Index h2o_species, const ArrayOfIndex &broad_spec_locations, ConstVectorView vmrs) const
void GetPressureBroadeningParams_dSelfPsf(Numeric &psf_dSelf, const Numeric &theta, const Numeric &self_pressure) const
void ChangeForeignShift(const Numeric &change, const ArrayOfIndex &broad_spec_locations)
Method for changing foreing-broadening shift(s) if available Error if not available and no change to ...
A constant view of a Vector.
Definition: matpackI.h:476
void SetSelf(const Numeric &new_value, const Index this_species, const Index h2o_species, const ArrayOfIndex &broad_spec_locations)
Method for setting self-broadening if available Error if not.
void GetAirAndWaterBroadening_dForeignPsf(Numeric &dpsf_dForeign, const Numeric &theta, const Numeric &pressure, const Numeric &self_pressure, const Index this_species, const Index h2o_species, ConstVectorView vmrs) const
LineRecord class for managing line catalog data.
void StorageTag2SetType(const String &input)
void speed_dependent_test_params(Numeric &G0, Numeric &D0, Numeric &G2, Numeric &D2, const Numeric &aP, const Numeric &sP, const Numeric &T, const Numeric &T0, const Numeric &sA, const Numeric &sg0, const Numeric &sn0, const Numeric &sg2, const Numeric &sn2, const Numeric &sd0, const Numeric &sm, const Numeric &sd2, const Numeric &aA, const Numeric &ag0, const Numeric &an0, const Numeric &ag2, const Numeric &an2, const Numeric &ad0, const Numeric &am, const Numeric &ad2)
void ChangeForeignExponent(const Numeric &change, const ArrayOfIndex &broad_spec_locations)
Method for changing foreing-broadening exponent(s) if available Error if not available and no change ...
void GetAirBroadening_dT(Numeric &dgamma_dT, Numeric &ddeltaf_dT, const Numeric &T, const Numeric &T0, const Numeric &pressure, const Numeric &self_pressure) const
void ChangeForeignExponentRelative(const Numeric &change, const ArrayOfIndex &broad_spec_locations)
Method for changing foreing-broadening exponent(s) by relative amount if available Error if not avail...
void GetPressureBroadeningParams_dWaterGamma(Numeric &gamma_dWater, const Numeric &theta, const Numeric &pressure, const Index this_species, const Index h2o_species, ConstVectorView vmrs) const
void GetAirBroadening_dSelfGamma(Numeric &gamma_dSelf, const Numeric &theta, const Numeric &self_pressure) const
void GetHTPAirBroadening_dT(Numeric &dgamma0, Numeric &dgamma2, Numeric &ddelta0, Numeric &ddelta2, Numeric &dfvc, Numeric &deta, const Numeric &T, const Numeric &T0, const Numeric &pressure) const
void ChangeForeignRelative(const Numeric &change, const ArrayOfIndex &broad_spec_locations)
Method for changing foreing-broadening(s) by relative amount if available Error if not available and ...