ARTS  2.3.1285(git:92a29ea9-dirty)
absorption.cc
Go to the documentation of this file.
1 /* Copyright (C) 2000-2012
2  Stefan Buehler <sbuehler@ltu.se>
3  Axel von Engeln <engeln@uni-bremen.de>
4 
5  This program is free software; you can redistribute it and/or modify it
6  under the terms of the GNU General Public License as published by the
7  Free Software Foundation; either version 2, or (at your option) any
8  later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
18  USA. */
19 
33 #include "absorption.h"
34 #include <algorithm>
35 #include <cfloat>
36 #include <cmath>
37 #include <cstdlib>
38 #include <map>
39 #include "arts.h"
40 #include "auto_md.h"
41 #include "file.h"
42 #include "interpolation_poly.h"
43 #include "linescaling.h"
44 #include "logic.h"
45 #include "math_funcs.h"
46 #include "messages.h"
47 
48 #include "global_data.h"
49 #include "linefunctions.h"
50 
52 static const char* SpeciesAuxTypeNames[] = {"NONE",
53  "ISORATIO", //Built-in type
54  "ISOQUANTUM",
55  "PART_TFIELD",
56  "PART_COEFF", //Built-in type
57  "PART_COEFF_VIBROT"};
58 
61 
62  mparams.resize(species_data.nelem());
63  mparam_type.resize(species_data.nelem());
64 
65  for (Index isp = 0; isp < species_data.nelem(); isp++) {
66  const Index niso = species_data[isp].Isotopologue().nelem();
67  mparams[isp].resize(niso);
68  mparam_type[isp].resize(niso);
69  for (Index iso = 0; iso < niso; iso++) {
70  mparams[isp][iso].resize(0);
72  }
73  }
74 }
75 
76 void SpeciesAuxData::setParam(const Index species,
77  const Index isotopologue,
78  const AuxType auxtype,
79  const ArrayOfGriddedField1& auxdata) {
80  mparam_type[species][isotopologue] = auxtype;
81  mparams[species][isotopologue] = auxdata;
82 }
83 
84 void SpeciesAuxData::setParam(const String& artstag,
85  const String& auxtype,
86  const ArrayOfGriddedField1& auxdata) {
87  // Global species lookup data:
89 
90  // We need a species index sorted by Arts identifier. Keep this in a
91  // static variable, so that we have to do this only once. The ARTS
92  // species index is ArtsMap[<Arts String>].
93  static map<String, SpecIsoMap> ArtsMap;
94 
95  // Remember if this stuff has already been initialized:
96  static bool hinit = false;
97 
98  if (!hinit) {
99  for (Index i = 0; i < species_data.nelem(); ++i) {
100  const SpeciesRecord& sr = species_data[i];
101  for (Index j = 0; j < sr.Isotopologue().nelem(); ++j) {
102  SpecIsoMap indicies(i, j);
103  String buf = sr.Name() + "-" + sr.Isotopologue()[j].Name();
104  ArtsMap[buf] = indicies;
105  }
106  }
107  hinit = true;
108  }
109 
110  Index species;
111  Index isotopologue;
112 
113  // ok, now for the cool index map:
114  // is this arts identifier valid?
115  const map<String, SpecIsoMap>::const_iterator i = ArtsMap.find(artstag);
116  if (i == ArtsMap.end()) {
117  ostringstream os;
118  os << "ARTS Tag: " << artstag << " is unknown.";
119  throw runtime_error(os.str());
120  }
121 
122  SpecIsoMap id = i->second;
123 
124  // Set mspecies:
125  species = id.Speciesindex();
126 
127  // Set misotopologue:
128  isotopologue = id.Isotopologueindex();
129 
130  Index this_auxtype = 0;
131 
132  while (this_auxtype < AT_FINAL_ENTRY &&
133  auxtype != SpeciesAuxTypeNames[this_auxtype])
134  this_auxtype++;
135 
136  if (this_auxtype != AT_FINAL_ENTRY) {
137  setParam(species, isotopologue, (AuxType)this_auxtype, auxdata);
138  } else {
139  ostringstream os;
140  os << "Unknown SpeciesAuxData type: " << auxtype;
141  std::runtime_error(os.str());
142  }
143 }
144 
146  const Index species, const Index isotopologue) const {
147  return mparams[species][isotopologue];
148 }
149 
151  Numeric val = 1.0;
152  if (st.Isotopologue() > -1)
153  val = getParam(st.Species(), st.Isotopologue())[0].data[0];
154  return val;
155 }
156 
158  return getParam(qid.Species(), qid.Isotopologue())[0].data[0];
159 }
160 
162  const Index isotopologue) const {
163  assert(mparam_type[species][isotopologue] < AT_FINAL_ENTRY);
164  return SpeciesAuxTypeNames[mparam_type[species][isotopologue]];
165 }
166 
168  istream& is,
169  Index nparams,
170  const Verbosity& verbosity) {
171  CREATE_OUT3;
172 
173  // Global species lookup data:
175 
176  // We need a species index sorted by Arts identifier. Keep this in a
177  // static variable, so that we have to do this only once. The ARTS
178  // species index is ArtsMap[<Arts String>].
179  static map<String, SpecIsoMap> ArtsMap;
180 
181  // Remember if this stuff has already been initialized:
182  static bool hinit = false;
183 
184  if (!hinit) {
185  out3 << " ARTS index table:\n";
186 
187  for (Index i = 0; i < species_data.nelem(); ++i) {
188  const SpeciesRecord& sr = species_data[i];
189 
190  for (Index j = 0; j < sr.Isotopologue().nelem(); ++j) {
191  SpecIsoMap indicies(i, j);
192  String buf = sr.Name() + "-" + sr.Isotopologue()[j].Name();
193 
194  ArtsMap[buf] = indicies;
195 
196  // Print the generated data structures (for debugging):
197  // The explicit conversion of Name to a c-String is
198  // necessary, because setw does not work correctly for
199  // stl Strings.
200  const Index& i1 = ArtsMap[buf].Speciesindex();
201  const Index& i2 = ArtsMap[buf].Isotopologueindex();
202 
203  out3 << " Arts Identifier = " << buf << " Species = " << setw(10)
204  << setiosflags(ios::left) << species_data[i1].Name().c_str()
205  << "iso = " << species_data[i1].Isotopologue()[i2].Name().c_str()
206  << "\n";
207  }
208  }
209  hinit = true;
210  }
211 
212  // This always contains the rest of the line to parse. At the
213  // beginning the entire line. Line gets shorter and shorter as we
214  // continue to extract stuff from the beginning.
215  String line;
216 
217  // Look for more comments?
218  bool comment = true;
219 
220  while (comment) {
221  // Return true if eof is reached:
222  if (is.eof()) return true;
223 
224  // Throw runtime_error if stream is bad:
225  if (!is) throw runtime_error("Stream bad.");
226 
227  // Read line from file into linebuffer:
228  getline(is, line);
229 
230  // It is possible that we were exactly at the end of the file before
231  // calling getline. In that case the previous eof() was still false
232  // because eof() evaluates only to true if one tries to read after the
233  // end of the file. The following check catches this.
234  if (line.nelem() == 0 && is.eof()) return true;
235 
236  // @ as first character marks catalogue entry
237  char c;
238  extract(c, line, 1);
239 
240  // check for empty line
241  if (c == '@') {
242  comment = false;
243  }
244  }
245 
246  // read the arts identifier String
247  istringstream icecream(line);
248 
249  icecream >> artsid;
250 
251  if (artsid.length() != 0) {
252  Index mspecies;
253  Index misotopologue;
254 
255  // ok, now for the cool index map:
256  // is this arts identifier valid?
257  const map<String, SpecIsoMap>::const_iterator i = ArtsMap.find(artsid);
258  if (i == ArtsMap.end()) {
259  ostringstream os;
260  os << "ARTS Tag: " << artsid << " is unknown.";
261  throw runtime_error(os.str());
262  }
263 
264  SpecIsoMap id = i->second;
265 
266  // Set mspecies:
267  mspecies = id.Speciesindex();
268 
269  // Set misotopologue:
270  misotopologue = id.Isotopologueindex();
271 
272  ArrayOfGriddedField1 ratios;
273  ratios.resize(1);
274  // Extract accuracies:
275  try {
276  Numeric p = NAN;
277  std::vector<Numeric> aux;
278  for (Index ip = 0; ip < nparams; ip++) {
279  icecream >> double_imanip() >> p;
280  aux.push_back(p);
281  }
282 
283  Vector grid;
284  if (aux.size() > 1)
285  nlinspace(grid, 1, (Numeric)aux.size(), aux.size());
286  else
287  grid = Vector(1, .1);
288 
289  ratios[0].set_grid(0, grid);
290  ratios[0].data = aux;
291  mparams[mspecies][misotopologue] = ratios;
292  } catch (const runtime_error&) {
293  throw runtime_error("Error reading SpeciesAuxData.");
294  }
295  }
296 
297  // That's it!
298  return false;
299 }
300 
302  const SpeciesAuxData& isoratios) {
304 
305  // Check total number of species:
306  if (species_data.nelem() != isoratios.nspecies()) {
307  ostringstream os;
308  os << "Number of species in SpeciesAuxData (" << isoratios.nspecies()
309  << ") "
310  << "does not fit builtin species data (" << species_data.nelem() << ").";
311  throw runtime_error(os.str());
312  }
313 
314  // For the selected species, we check all isotopes by looping over the
315  // species data. (Trying to check only the isotopes actually used gets
316  // quite complicated, actually, so we do the simple thing here.)
317 
318  // Loop over the absorption species:
319  for (Index i = 0; i < abs_species.nelem(); i++) {
320  // sp is the index of this species in the internal lookup table
321  const Index sp = abs_species[i][0].Species();
322 
323  // Get handle on species data for this species:
324  const SpeciesRecord& this_sd = species_data[sp];
325 
326  // Check number of isotopologues:
327  if (this_sd.Isotopologue().nelem() != isoratios.nisotopologues(sp)) {
328  ostringstream os;
329  os << "Incorrect number of isotopologues in isotopologue data.\n"
330  << "Species: " << this_sd.Name() << ".\n"
331  << "Number of isotopes in SpeciesAuxData ("
332  << isoratios.nisotopologues(sp) << ") "
333  << "does not fit builtin species data ("
334  << this_sd.Isotopologue().nelem() << ").";
335  throw runtime_error(os.str());
336  }
337 
338  for (Index iso = 0; iso < this_sd.Isotopologue().nelem(); ++iso) {
339  // For "real" species (not representing continau) the isotopologue
340  // ratio must not be NAN or below zero.
341  if (!this_sd.Isotopologue()[iso].isContinuum()) {
342  if (std::isnan(isoratios.getParam(sp, iso)[0].data[0]) ||
343  isoratios.getParam(sp, iso)[0].data[0] < 0.) {
344  ostringstream os;
345  os << "Invalid isotopologue ratio.\n"
346  << "Species: " << this_sd.Name() << "-"
347  << this_sd.Isotopologue()[iso].Name() << "\n"
348  << "Ratio: " << isoratios.getParam(sp, iso)[0].data[0];
349  throw runtime_error(os.str());
350  }
351  }
352  }
353  }
354 }
355 
357  const SpeciesAuxData& partfun) {
359 
360  // Check total number of species:
361  if (species_data.nelem() != partfun.nspecies()) {
362  ostringstream os;
363  os << "Number of species in SpeciesAuxData (" << partfun.nspecies() << ") "
364  << "does not fit builtin species data (" << species_data.nelem() << ").";
365  throw runtime_error(os.str());
366  }
367 
368  // For the selected species, we check all isotopes by looping over the
369  // species data. (Trying to check only the isotopes actually used gets
370  // quite complicated, actually, so we do the simple thing here.)
371 
372  // Loop over the absorption species:
373  for (Index i = 0; i < abs_species.nelem(); i++) {
374  // sp is the index of this species in the internal lookup table
375  const Index sp = abs_species[i][0].Species();
376 
377  // Get handle on species data for this species:
378  const SpeciesRecord& this_sd = species_data[sp];
379 
380  // Check number of isotopologues:
381  if (this_sd.Isotopologue().nelem() != partfun.nisotopologues(sp)) {
382  ostringstream os;
383  os << "Incorrect number of isotopologues in partition function data.\n"
384  << "Species: " << this_sd.Name() << ".\n"
385  << "Number of isotopes in SpeciesAuxData ("
386  << partfun.nisotopologues(sp) << ") "
387  << "does not fit builtin species data ("
388  << this_sd.Isotopologue().nelem() << ").";
389  throw runtime_error(os.str());
390  }
391  }
392 }
393 
395  SpeciesAuxData& sad) {
397 
398  sad.InitFromSpeciesData();
399 
400  Vector grid(1, 1.);
401  ArrayOfGriddedField1 ratios;
402  ratios.resize(1);
403  ratios[0].set_name("IsoRatios");
404  ratios[0].set_grid_name(0, "Index");
405  ratios[0].set_grid(0, grid);
406  ratios[0].resize(1);
407 
408  for (Index isp = 0; isp < species_data.nelem(); isp++) {
409  for (Index iiso = 0; iiso < species_data[isp].Isotopologue().nelem();
410  iiso++) {
411  ratios[0].data[0] = species_data[isp].Isotopologue()[iiso].Abundance();
412  sad.setParam(isp, iiso, SpeciesAuxData::AT_ISOTOPOLOGUE_RATIO, ratios);
413  }
414  }
415 }
416 
418  SpeciesAuxData& sad) {
420 
421  sad.InitFromSpeciesData();
422 
423  ArrayOfGriddedField1 pfuncs;
424  pfuncs.resize(2);
425  pfuncs[0].set_name("PartitionFunction");
426  pfuncs[0].set_grid_name(0, "Coeff");
427  pfuncs[1].set_grid_name(0, "Temperature");
428 
429  ArrayOfString tgrid;
430  tgrid.resize(2);
431  tgrid[0] = "Tlower";
432  tgrid[1] = "Tupper";
433 
434  for (Index isp = 0; isp < species_data.nelem(); isp++) {
435  for (Index iiso = 0; iiso < species_data[isp].Isotopologue().nelem();
436  iiso++) {
437  Vector grid;
438  const Vector& coeffs = species_data[isp].Isotopologue()[iiso].GetCoeff();
439 
440  assert(coeffs.nelem() >= 2);
441 
442  nlinspace(grid, 0, (Numeric)coeffs.nelem() - 1., coeffs.nelem());
443  pfuncs[0].set_grid(0, grid);
444  pfuncs[0].data = coeffs;
445 
446  const Vector& temp_range =
447  species_data[isp].Isotopologue()[iiso].GetCoeffGrid();
448 
449  // Temperature data should either contain two Ts, lower and upper value of
450  // the valid range or be empty
451  assert(temp_range.nelem() == 0 || temp_range.nelem() == 2);
452 
453  if (temp_range.nelem() == 2) {
454  pfuncs[1].set_grid(0, tgrid);
455  pfuncs[1].data = temp_range;
456  } else {
457  pfuncs[1].resize(0);
458  pfuncs[1].set_grid(0, ArrayOfString());
459  }
460 
461  sad.setParam(
462  isp, iiso, SpeciesAuxData::AT_PARTITIONFUNCTION_COEFF, pfuncs);
463  }
464  }
465 }
466 
467 ostream& operator<<(ostream& os, const SpeciesRecord& sr) {
468  for (Index j = 0; j < sr.Isotopologue().nelem(); ++j) {
469  os << sr.Name() << "-" << sr.Isotopologue()[j].Name() << "\n";
470  }
471  return os;
472 }
473 
474 ostream& operator<<(ostream& os, const SpeciesAuxData& sad) {
476  for (Index sp = 0; sp < sad.nspecies(); sp++) {
477  for (Index iso = 0; iso < sad.nisotopologues(sp); iso++) {
478  os << species_name_from_species_index(sp) << "-"
479  << global_data::species_data[sp].Isotopologue()[iso].Name();
480  os << " " << sad.getTypeString(sp, iso) << std::endl;
481  for (Index ip = 0; ip < sad.getParam(sp, iso).nelem(); ip++)
482  os << "AuxData " << ip << " " << sad.getParam(sp, iso) << std::endl;
483  }
484  }
485 
486  return os;
487 }
488 
501  // Planck constant [Js]
502  extern const Numeric PLANCK_CONST;
503 
504  // Speed of light [m/s]
505  extern const Numeric SPEED_OF_LIGHT;
506 
507  // Constant to convert lower state energy from cm^-1 to J
508  const Numeric lower_energy_const = PLANCK_CONST * SPEED_OF_LIGHT * 1E2;
509 
510  return e * lower_energy_const;
511 }
512 
513 //======================================================================
514 // Functions related to species
515 //======================================================================
516 
518 
533 
534  // For the return value:
535  Index mspecies;
536 
537  // Trim whitespace
538  name.trim();
539 
540  // cout << "name / def = " << name << " / " << def << endl;
541 
542  // Look for species name in species map:
543  map<String, Index>::const_iterator mi = SpeciesMap.find(name);
544  if (mi != SpeciesMap.end()) {
545  // Ok, we've found the species. Set mspecies.
546  mspecies = mi->second;
547  } else {
548  // The species does not exist!
549  mspecies = -1;
550  }
551 
552  return mspecies;
553 }
554 
556 
570  // Species lookup data:
572 
573  // Assert that spec_ind is inside species data. (This is an assertion,
574  // because species indices should never be user input, but set by the
575  // program automatically, based on species names.)
576  assert(spec_ind >= 0);
577  assert(spec_ind < species_data.nelem());
578 
579  // A reference to the relevant record of the species data:
580  const SpeciesRecord& spr = species_data[spec_ind];
581 
582  return spr.Name();
583 }
584 
586 
598  const String& species_name,
599  const ArrayOfArrayOfSpeciesTag& abs_species,
600  const Matrix& abs_vmrs) {
601  const Index index = find_first_species_tg(
602  abs_species, species_index_from_species_name (species_name));
603 
604  vmr.resize(abs_vmrs.ncols());
605  if (index < 0)
606  vmr = -99;
607  else
608  vmr = abs_vmrs(index, Range(joker));
609 }
610 
612 {
613  return global_data::species_data[band.Species()];
614 }
615 
616 void xsec_species(Matrix& xsec,
617  Matrix& source,
618  Matrix& phase,
619  ArrayOfMatrix& dxsec_dx,
620  ArrayOfMatrix& dsource_dx,
621  ArrayOfMatrix& dphase_dx,
622  const ArrayOfRetrievalQuantity& jacobian_quantities,
623  const ArrayOfIndex& jacobian_propmat_positions,
624  const Vector& f_grid,
625  const Vector& abs_p,
626  const Vector& abs_t,
627  const EnergyLevelMap& abs_nlte,
628  const Matrix& abs_vmrs,
629  const ArrayOfArrayOfSpeciesTag& abs_species,
630  const AbsorptionLines& band,
631  const Numeric& isot_ratio,
632  const SpeciesAuxData::AuxType& partfun_type,
633  const ArrayOfGriddedField1& partfun_data) {
634  // Size of problem
635  const Index np = abs_p.nelem(); // number of pressure levels
636  const Index nf = f_grid.nelem(); // number of Dirac frequencies
637  const Index nl = band.NumLines(); // number of lines in the catalog
638  const Index nj =
639  jacobian_propmat_positions.nelem(); // number of partial derivatives
640  const Index nt = source.nrows(); // number of energy levels in NLTE
641 
642  // Type of problem
643  const bool do_nonlte = nt;
644 
645  Linefunctions::InternalData scratch(nf, nj);
646  Linefunctions::InternalData sum(nf, nj);
647 
648  // Test if the size of the problem is 0
649  if (not np or not nf or not nl) return;
650 
651  // Constant for all lines
652  const Numeric QT0 = single_partition_function(band.T0(), partfun_type, partfun_data);
653 
654  ArrayOfString fail_msg;
655  bool do_abort = false;
656 
657 #pragma omp parallel for if (!arts_omp_in_parallel() && np > 1) \
658  firstprivate(scratch, sum)
659  for (Index ip = 0; ip < np; ip++) {
660  if (do_abort) continue;
661  try {
662  // Constants for this level
663  const Numeric& temperature = abs_t[ip];
664  const Numeric& pressure = abs_p[ip];
665 
666  // Constants for this level
667  const Numeric QT =
668  single_partition_function(temperature, partfun_type, partfun_data);
670  QT,
671  temperature,
672  temperature_perturbation(jacobian_quantities),
673  partfun_type,
674  partfun_data);
675  const Numeric DC =
676  Linefunctions::DopplerConstant(temperature, band.SpeciesMass());
677  const Numeric dDCdT = Linefunctions::dDopplerConstant_dT(temperature, DC);
678  const Vector line_shape_vmr =
679  band.BroadeningSpeciesVMR(abs_vmrs(joker, ip), abs_species);
680 
682  sum,
683  f_grid,
684  band,
685  jacobian_quantities,
686  jacobian_propmat_positions,
687  line_shape_vmr,
688  abs_nlte[ip],
689  pressure,
690  temperature,
691  isot_ratio,
692  0,
693  DC,
694  dDCdT,
695  QT,
696  dQTdT,
697  QT0,
698  false);
699 
700  // absorption cross-section
701  MapToEigen(xsec).col(ip).noalias() += sum.F.real();
702  for (Index j = 0; j < nj; j++)
703  MapToEigen(dxsec_dx[j]).col(ip).noalias() += sum.dF.col(j).real();
704 
705  // phase cross-section
706  if (not phase.empty()) {
707  MapToEigen(phase).col(ip).noalias() += sum.F.imag();
708  for (Index j = 0; j < nj; j++)
709  MapToEigen(dphase_dx[j]).col(ip).noalias() += sum.dF.col(j).imag();
710  }
711 
712  // source ratio cross-section
713  if (do_nonlte) {
714  MapToEigen(source).col(ip).noalias() += sum.N.real();
715  for (Index j = 0; j < nj; j++)
716  MapToEigen(dsource_dx[j]).col(ip).noalias() += sum.dN.col(j).real();
717  }
718  } catch (const std::runtime_error& e) {
719  ostringstream os;
720  os << "Runtime-error in cross-section calculation at p_abs index " << ip
721  << ": \n";
722  os << e.what();
723 #pragma omp critical(xsec_species_cross_sections)
724  {
725  do_abort = true;
726  fail_msg.push_back(os.str());
727  }
728  }
729  }
730 
731  if (do_abort) {
733  os << "Error messages from failed cases:\n";
734  for (const auto& msg : fail_msg) {
735  os << msg << '\n';
736  }
737  throw std::runtime_error(os.str());
738  }
739 }
void iso(Array< IsotopologueRecord >::iterator &ii, String name, const ArrayOfNumeric &coeff, const ArrayOfNumeric &temp_range, const Index &coefftype)
Initialize isotopologue and move iterator to next one.
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
const Numeric PLANCK_CONST
Global constant, the Planck constant [Js].
const map< String, Index > SpeciesMap
The map associated with species_data.
Definition: species_data.cc:44
Numeric T0() const noexcept
Returns reference temperature.
ArrayOfArrayOfAuxData mparams
Definition: absorption.h:317
void InitFromSpeciesData()
Definition: absorption.cc:59
Index nelem() const
Number of elements.
Definition: array.h:195
void Isotopologue(Index iso)
Set the Isotopologue.
Definition: quantum.h:487
bool empty() const
Returns true if variable size is zero.
Definition: matpackI.cc:426
Declarations having to do with the four output streams.
The Vector class.
Definition: matpackI.h:860
Index Species() const
Molecular species index.
void set_cross_section_of_band(InternalData &scratch, InternalData &sum, const ConstVectorView f_grid, const AbsorptionLines &band, const ArrayOfRetrievalQuantity &derivatives_data, const ArrayOfIndex &derivatives_data_active, const Vector &vmrs, const EnergyLevelMap &nlte, const Numeric &P, const Numeric &T, const Numeric &isot_ratio, const Numeric &H, const Numeric &DC, const Numeric &dDCdT, const Numeric &QT, const Numeric &dQTdT, const Numeric &QT0, const bool no_negatives=false, const bool zeeman=false, const Zeeman::Polarization zeeman_polarization=Zeeman::Polarization::Pi)
Computes the cross-section of an absorption band.
The range class.
Definition: matpackI.h:160
bool ReadFromStream(String &artsid, istream &is, Index nparams, const Verbosity &verbosity)
Read parameters from input stream (only for version 1 format).
Definition: absorption.cc:167
void fillSpeciesAuxDataWithPartitionFunctionsFromSpeciesData(SpeciesAuxData &sad)
Fill SpeciesAuxData with default partition functions from species data.
Definition: absorption.cc:417
invlib::Vector< ArtsVector > Vector
invlib wrapper type for ARTS vectors.
Definition: oem.h:32
Numeric SpeciesMass() const noexcept
Mass of the molecule.
Numeric dsingle_partition_function_dT(const Numeric &QT, const Numeric &T, const Numeric &dT, const SpeciesAuxData::AuxType &partition_type, const ArrayOfGriddedField1 &partition_data)
Computes the partition function temperature derivative.
Definition: linescaling.cc:87
Index NumLines() const noexcept
Number of lines.
This file contains basic functions to handle ASCII files.
ostream & operator<<(ostream &os, const SpeciesRecord &sr)
Output operator for SpeciesRecord.
Definition: absorption.cc:467
G0 G2 FVC Y DV Numeric Numeric Numeric Zeeman LowerQuantumNumbers void * data
ArrayOfArrayOfAuxType mparam_type
Definition: absorption.h:318
Index nelem() const
Returns the number of elements.
Definition: matpackI.cc:51
void setParam(const Index species, const Index isotopologue, const AuxType auxtype, const ArrayOfGriddedField1 &auxdata)
Set parameter.
Definition: absorption.cc:76
const Array< SpeciesRecord > species_data
Species Data.
String species_name_from_species_index(const Index spec_ind)
Return species name for given species index.
Definition: absorption.cc:569
const SpeciesRecord & SpeciesDataOfBand(const AbsorptionLines &band)
Returns the species data.
Definition: absorption.cc:611
const Array< IsotopologueRecord > & Isotopologue() const
Definition: absorption.h:199
Stuff related to lineshape functions.
Index ncols() const
Returns the number of columns.
Definition: matpackI.cc:432
The global header file for ARTS.
_CS_string_type str() const
Definition: sstream.h:491
Numeric getIsotopologueRatio(const SpeciesTag &st) const
Returns mparams[st.Species()][st.Isotopologue()][0].data[0] if st.Isotopologue() > 0...
Definition: absorption.cc:150
void Species(Index sp)
Set the Species.
Definition: quantum.h:481
Contains the lookup data for one species.
Definition: absorption.h:144
void nlinspace(Vector &x, const Numeric start, const Numeric stop, const Index n)
nlinspace
Definition: math_funcs.cc:231
void xsec_species(Matrix &xsec, Matrix &source, Matrix &phase, ArrayOfMatrix &dxsec_dx, ArrayOfMatrix &dsource_dx, ArrayOfMatrix &dphase_dx, const ArrayOfRetrievalQuantity &jacobian_quantities, const ArrayOfIndex &jacobian_propmat_positions, const Vector &f_grid, const Vector &abs_p, const Vector &abs_t, const EnergyLevelMap &abs_nlte, const Matrix &abs_vmrs, const ArrayOfArrayOfSpeciesTag &abs_species, const AbsorptionLines &band, const Numeric &isot_ratio, const SpeciesAuxData::AuxType &partfun_type, const ArrayOfGriddedField1 &partfun_data)
Cross-section algorithm.
Definition: absorption.cc:616
Index Species() const noexcept
Species Index.
A tag group can consist of the sum of several of these.
Vector BroadeningSpeciesVMR(const ConstVectorView, const ArrayOfArrayOfSpeciesTag &) const
Returns the VMRs of the broadening species.
Index find_first_species_tg(const ArrayOfArrayOfSpeciesTag &tgs, const Index &spec)
Find first occurrence of species in tag groups.
void extract(T &x, String &line, Index n)
Extract something from the beginning of a string.
Definition: mystring.h:297
Class to identify and match lines by their quantum numbers.
Definition: quantum.h:390
Numeric temperature_perturbation(const ArrayOfRetrievalQuantity &js) noexcept
Returns the temperature perturbation if it exists.
Definition: jacobian.cc:1304
const Joker joker
const ArrayOfGriddedField1 & getParam(const Index species, const Index isotopologue) const
Return a constant reference to the parameters.
Definition: absorption.cc:145
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:33
The Matrix class.
Definition: matpackI.h:1193
String getTypeString(const Index species, const Index isotopologue) const
Return a parameter type as string.
Definition: absorption.cc:161
Index nelem() const
Number of elements.
Definition: mystring.h:246
const String & Name() const
Definition: absorption.h:197
Declarations required for the calculation of absorption coefficients.
Index nspecies() const
Returns number of species.
Definition: absorption.h:239
Array< String > ArrayOfString
An array of Strings.
Definition: mystring.h:283
Numeric dDopplerConstant_dT(const Numeric &T, const Numeric &dc)
Returns the temperature derivative of the frequency-independent part of the Doppler broadening...
Index nisotopologues(const Index species) const
Returns number of isotopologues for a certain species.
Definition: absorption.h:242
Index species_index_from_species_name(String name)
Return species index for given species name.
Definition: absorption.cc:531
void trim()
Trim leading and trailing whitespace.
Definition: mystring.h:225
Header file for logic.cc.
basic_ostringstream< char, string_char_traits< char >, alloc > ostringstream
Definition: sstream.h:204
This can be used to make arrays out of anything.
Definition: array.h:40
Header file for interpolation_poly.cc.
void checkIsotopologueRatios(const ArrayOfArrayOfSpeciesTag &abs_species, const SpeciesAuxData &isoratios)
Check that isotopologue ratios for the given species are correctly defined.
Definition: absorption.cc:301
Constains various line scaling functions.
void checkPartitionFunctions(const ArrayOfArrayOfSpeciesTag &abs_species, const SpeciesAuxData &partfun)
Check that partition functions for the given species are correctly defined.
Definition: absorption.cc:356
void resize(Index n)
Resize function.
Definition: matpackI.cc:404
Numeric DopplerConstant(Numeric T, Numeric mass)
Returns the frequency-independent part of the Doppler broadening.
const Index & Speciesindex() const
Definition: absorption.h:345
void fillSpeciesAuxDataWithIsotopologueRatiosFromSpeciesData(SpeciesAuxData &sad)
Fill SpeciesAuxData with default isotopologue ratios from species data.
Definition: absorption.cc:394
#define CREATE_OUT3
Definition: messages.h:207
Numeric single_partition_function(const Numeric &T, const SpeciesAuxData::AuxType &partition_type, const ArrayOfGriddedField1 &partition_data)
Computes the partition function at one temperature.
Definition: linescaling.cc:72
Auxiliary data for isotopologues.
Definition: absorption.h:217
ComplexConstMatrixViewMap MapToEigen(const ConstComplexMatrixView &A)
Definition: complex.cc:1655
void set_vmr_from_first_species(Vector &vmr, const String &species_name, const ArrayOfArrayOfSpeciesTag &abs_species, const Matrix &abs_vmrs)
set_abs_from_first_species.
Definition: absorption.cc:597
const Numeric SPEED_OF_LIGHT
Index Isotopologue() const
Isotopologue species index.
Index nrows() const
Returns the number of rows.
Definition: matpackI.cc:429
Input manipulator class for doubles to enable nan and inf parsing.
Definition: file.h:117
Numeric wavenumber_to_joule(Numeric e)
A little helper function to convert energy from units of wavenumber (cm^-1) to Joule (J)...
Definition: absorption.cc:500