Go to the documentation of this file.
52 static const char* SpeciesAuxTypeNames[] = {
"NONE",
77 const Index isotopologue,
81 mparams[species][isotopologue] = auxdata;
93 static map<String, SpecIsoMap> ArtsMap;
96 static bool hinit =
false;
104 ArtsMap[buf] = indicies;
115 const map<String, SpecIsoMap>::const_iterator i = ArtsMap.find(artstag);
116 if (i == ArtsMap.end()) {
118 os <<
"ARTS Tag: " << artstag <<
" is unknown.";
119 throw runtime_error(os.str());
128 isotopologue =
id.Isotopologueindex();
130 Index this_auxtype = 0;
133 auxtype != SpeciesAuxTypeNames[this_auxtype])
140 os <<
"Unknown SpeciesAuxData type: " << auxtype;
141 std::runtime_error(os.str());
146 const Index species,
const Index isotopologue)
const {
147 return mparams[species][isotopologue];
162 const Index isotopologue)
const {
164 return SpeciesAuxTypeNames[
mparam_type[species][isotopologue]];
179 static map<String, SpecIsoMap> ArtsMap;
182 static bool hinit =
false;
185 out3 <<
" ARTS index table:\n";
194 ArtsMap[buf] = indicies;
201 const Index& i2 = ArtsMap[buf].Isotopologueindex();
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()
222 if (is.eof())
return true;
225 if (!is)
throw runtime_error(
"Stream bad.");
234 if (line.
nelem() == 0 && is.eof())
return true;
247 istringstream icecream(line);
251 if (artsid.length() != 0) {
257 const map<String, SpecIsoMap>::const_iterator i = ArtsMap.find(artsid);
258 if (i == ArtsMap.end()) {
260 os <<
"ARTS Tag: " << artsid <<
" is unknown.";
261 throw runtime_error(os.str());
270 misotopologue =
id.Isotopologueindex();
277 std::vector<Numeric> aux;
278 for (
Index ip = 0; ip < nparams; ip++) {
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.");
308 os <<
"Number of species in SpeciesAuxData (" << isoratios.
nspecies()
310 <<
"does not fit builtin species data (" <<
species_data.nelem() <<
").";
311 throw runtime_error(os.str());
329 os <<
"Incorrect number of isotopologues in isotopologue data.\n"
330 <<
"Species: " << this_sd.
Name() <<
".\n"
331 <<
"Number of isotopes in SpeciesAuxData ("
333 <<
"does not fit builtin species data ("
335 throw runtime_error(os.str());
342 if (std::isnan(isoratios.
getParam(sp,
iso)[0].data[0]) ||
345 os <<
"Invalid isotopologue ratio.\n"
346 <<
"Species: " << this_sd.
Name() <<
"-"
348 <<
"Ratio: " << isoratios.
getParam(sp,
iso)[0].data[0];
349 throw runtime_error(os.str());
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());
383 os <<
"Incorrect number of isotopologues in partition function data.\n"
384 <<
"Species: " << this_sd.
Name() <<
".\n"
385 <<
"Number of isotopes in SpeciesAuxData ("
387 <<
"does not fit builtin species data ("
389 throw runtime_error(os.str());
403 ratios[0].set_name(
"IsoRatios");
404 ratios[0].set_grid_name(0,
"Index");
405 ratios[0].set_grid(0, grid);
411 ratios[0].data[0] =
species_data[isp].Isotopologue()[iiso].Abundance();
425 pfuncs[0].set_name(
"PartitionFunction");
426 pfuncs[0].set_grid_name(0,
"Coeff");
427 pfuncs[1].set_grid_name(0,
"Temperature");
440 assert(coeffs.
nelem() >= 2);
443 pfuncs[0].set_grid(0, grid);
444 pfuncs[0].data = coeffs;
446 const Vector& temp_range =
451 assert(temp_range.
nelem() == 0 || temp_range.
nelem() == 2);
453 if (temp_range.
nelem() == 2) {
454 pfuncs[1].set_grid(0, tgrid);
455 pfuncs[1].data = temp_range;
482 os <<
"AuxData " << ip <<
" " << sad.
getParam(sp,
iso) << std::endl;
510 return e * lower_energy_const;
543 map<String, Index>::const_iterator mi =
SpeciesMap.find(name);
546 mspecies = mi->second;
576 assert(spec_ind >= 0);
598 const String& species_name,
639 jacobian_propmat_positions.
nelem();
643 const bool do_nonlte = nt;
649 if (not np or not nf or not nl)
return;
655 bool do_abort =
false;
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;
678 const Vector line_shape_vmr =
686 jacobian_propmat_positions,
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();
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();
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();
718 }
catch (
const std::runtime_error& e) {
720 os <<
"Runtime-error in cross-section calculation at p_abs index " << ip
723 #pragma omp critical(xsec_species_cross_sections)
726 fail_msg.push_back(os.str());
732 std::ostringstream os;
733 os <<
"Error messages from failed cases:\n";
734 for (
const auto& msg : fail_msg) {
737 throw std::runtime_error(os.str());
void checkPartitionFunctions(const ArrayOfArrayOfSpeciesTag &abs_species, const SpeciesAuxData &partfun)
Check that partition functions for the given species are correctly defined.
void Isotopologue(Index iso)
Set the Isotopologue.
Class to identify and match lines by their quantum numbers.
Vector BroadeningSpeciesVMR(const ConstVectorView, const ArrayOfArrayOfSpeciesTag &) const
Returns the VMRs of the broadening species.
ArrayOfRetrievalQuantity jacobian_quantities(Workspace &ws) noexcept
Declarations required for the calculation of absorption coefficients.
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.
void fillSpeciesAuxDataWithPartitionFunctionsFromSpeciesData(SpeciesAuxData &sad)
Fill SpeciesAuxData with default partition functions from species data.
const SpeciesRecord & SpeciesDataOfBand(const AbsorptionLines &band)
Returns the species data.
Index NumLines() const noexcept
Number of lines.
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.
Numeric T0() const noexcept
Returns reference temperature.
const Numeric PLANCK_CONST
Global constant, the Planck constant [Js].
Stuff related to lineshape functions.
Verbosity verbosity(Workspace &ws) noexcept
Numeric temperature_perturbation(const ArrayOfRetrievalQuantity &js) noexcept
Returns the temperature perturbation if it exists.
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.
const map< String, Index > SpeciesMap
The map associated with species_data.
void resize(Index n)
Resize function.
Numeric single_partition_function(const Numeric &T, const SpeciesAuxData::AuxType &partition_type, const ArrayOfGriddedField1 &partition_data)
Computes the partition function at one temperature.
bool ReadFromStream(String &artsid, istream &is, Index nparams, const Verbosity &verbosity)
Read parameters from input stream (only for version 1 format).
Index nrows() const
Returns the number of rows.
const Array< SpeciesRecord > species_data
Species Data.
void setParam(const Index species, const Index isotopologue, const AuxType auxtype, const ArrayOfGriddedField1 &auxdata)
Set parameter.
const ArrayOfGriddedField1 & getParam(const Index species, const Index isotopologue) const
Return a constant reference to the parameters.
Auxiliary data for isotopologues.
Matrix abs_vmrs(Workspace &ws) noexcept
void extract(T &x, String &line, Index n)
Extract something from the beginning of a string.
Numeric SpeciesMass() const noexcept
Mass of the molecule.
This can be used to make arrays out of anything.
A tag group can consist of the sum of several of these.
@ AT_PARTITIONFUNCTION_COEFF
Index nelem(const Lines &l)
Number of lines.
ComplexConstMatrixViewMap MapToEigen(const ConstComplexMatrixView &A)
ArrayOfArrayOfAuxType mparam_type
Index species_index_from_species_name(String name)
Return species index for given species name.
Numeric getIsotopologueRatio(const SpeciesTag &st) const
Returns mparams[st.Species()][st.Isotopologue()][0].data[0] if st.Isotopologue() > 0,...
void checkIsotopologueRatios(const ArrayOfArrayOfSpeciesTag &abs_species, const SpeciesAuxData &isoratios)
Check that isotopologue ratios for the given species are correctly defined.
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.
String species_name_from_species_index(const Index spec_ind)
Return species name for given species index.
void Species(Index sp)
Set the Species.
Declarations having to do with the four output streams.
ostream & operator<<(ostream &os, const SpeciesRecord &sr)
Output operator for SpeciesRecord.
Array< String > ArrayOfString
An array of Strings.
Index nelem() const
Returns the number of elements.
Input manipulator class for doubles to enable nan and inf parsing.
ArrayOfArrayOfSpeciesTag abs_species(Workspace &ws) noexcept
NUMERIC Numeric
The type to use for all floating point numbers.
const Index & Speciesindex() const
Numeric dDopplerConstant_dT(const Numeric &T, const Numeric &dc)
Returns the temperature derivative of the frequency-independent part of the Doppler broadening.
Vector f_grid(Workspace &ws) noexcept
void trim()
Trim leading and trailing whitespace.
Index nisotopologues(const Index species) const
Returns number of isotopologues for a certain species.
Index Species() const noexcept
Species Index.
Contains the lookup data for one species.
Index nelem() const
Number of elements.
Header file for interpolation_poly.cc.
bool empty() const
Returns true if variable size is zero.
void nlinspace(Vector &x, const Numeric start, const Numeric stop, const Index n)
nlinspace
Vector abs_t(Workspace &ws) noexcept
invlib::Vector< ArtsVector > Vector
invlib wrapper type for ARTS vectors.
const Array< IsotopologueRecord > & Isotopologue() const
void fillSpeciesAuxDataWithIsotopologueRatiosFromSpeciesData(SpeciesAuxData &sad)
Fill SpeciesAuxData with default isotopologue ratios from species data.
Numeric wavenumber_to_joule(Numeric e)
A little helper function to convert energy from units of wavenumber (cm^-1) to Joule (J).
Header file for logic.cc.
Numeric DopplerConstant(Numeric T, Numeric mass)
Returns the frequency-independent part of the Doppler broadening.
const String & Name() const
Constains various line scaling functions.
ArrayOfArrayOfAuxData mparams
Index nspecies() const
Returns number of species.
Index Isotopologue() const
Isotopologue species index.
void InitFromSpeciesData()
const Numeric SPEED_OF_LIGHT
This file contains basic functions to handle ASCII files.
INDEX Index
The type to use for all integer numbers and indices.
Vector abs_p(Workspace &ws) noexcept
String getTypeString(const Index species, const Index isotopologue) const
Return a parameter type as string.
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.
Index Species() const
Molecular species index.
Index nelem() const
Number of elements.
The global header file for ARTS.
EnergyLevelMap abs_nlte(Workspace &ws) noexcept