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;
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());
321 const Index sp = abs_species[
i][0].Species();
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());
375 const Index sp = abs_species[
i][0].Species();
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;
508 const Numeric lower_energy_const = PLANCK_CONST * SPEED_OF_LIGHT * 1E2;
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;
663 const Numeric& temperature = abs_t[ip];
664 const Numeric& pressure = abs_p[ip];
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());
733 os <<
"Error messages from failed cases:\n";
734 for (
const auto& msg : fail_msg) {
737 throw std::runtime_error(os.str());
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.
const Numeric PLANCK_CONST
Global constant, the Planck constant [Js].
const map< String, Index > SpeciesMap
The map associated with species_data.
Numeric T0() const noexcept
Returns reference temperature.
ArrayOfArrayOfAuxData mparams
void InitFromSpeciesData()
Index nelem() const
Number of elements.
void Isotopologue(Index iso)
Set the Isotopologue.
bool empty() const
Returns true if variable size is zero.
Declarations having to do with the four output streams.
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.
bool ReadFromStream(String &artsid, istream &is, Index nparams, const Verbosity &verbosity)
Read parameters from input stream (only for version 1 format).
void fillSpeciesAuxDataWithPartitionFunctionsFromSpeciesData(SpeciesAuxData &sad)
Fill SpeciesAuxData with default partition functions from species data.
invlib::Vector< ArtsVector > Vector
invlib wrapper type for ARTS vectors.
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.
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.
G0 G2 FVC Y DV Numeric Numeric Numeric Zeeman LowerQuantumNumbers void * data
ArrayOfArrayOfAuxType mparam_type
Index nelem() const
Returns the number of elements.
void setParam(const Index species, const Index isotopologue, const AuxType auxtype, const ArrayOfGriddedField1 &auxdata)
Set parameter.
const Array< SpeciesRecord > species_data
Species Data.
String species_name_from_species_index(const Index spec_ind)
Return species name for given species index.
const SpeciesRecord & SpeciesDataOfBand(const AbsorptionLines &band)
Returns the species data.
const Array< IsotopologueRecord > & Isotopologue() const
Stuff related to lineshape functions.
Index ncols() const
Returns the number of columns.
The global header file for ARTS.
_CS_string_type str() const
Numeric getIsotopologueRatio(const SpeciesTag &st) const
Returns mparams[st.Species()][st.Isotopologue()][0].data[0] if st.Isotopologue() > 0...
void Species(Index sp)
Set the Species.
Contains the lookup data for one species.
void nlinspace(Vector &x, const Numeric start, const Numeric stop, const Index n)
nlinspace
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 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.
void extract(T &x, String &line, Index n)
Extract something from the beginning of a string.
Class to identify and match lines by their quantum numbers.
Numeric temperature_perturbation(const ArrayOfRetrievalQuantity &js) noexcept
Returns the temperature perturbation if it exists.
const ArrayOfGriddedField1 & getParam(const Index species, const Index isotopologue) const
Return a constant reference to the parameters.
NUMERIC Numeric
The type to use for all floating point numbers.
String getTypeString(const Index species, const Index isotopologue) const
Return a parameter type as string.
Index nelem() const
Number of elements.
const String & Name() const
Declarations required for the calculation of absorption coefficients.
Index nspecies() const
Returns number of species.
Array< String > ArrayOfString
An array of Strings.
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.
Index species_index_from_species_name(String name)
Return species index for given species name.
void trim()
Trim leading and trailing whitespace.
Header file for logic.cc.
basic_ostringstream< char, string_char_traits< char >, alloc > ostringstream
This can be used to make arrays out of anything.
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.
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.
void resize(Index n)
Resize function.
Numeric DopplerConstant(Numeric T, Numeric mass)
Returns the frequency-independent part of the Doppler broadening.
const Index & Speciesindex() const
void fillSpeciesAuxDataWithIsotopologueRatiosFromSpeciesData(SpeciesAuxData &sad)
Fill SpeciesAuxData with default isotopologue ratios from species data.
Numeric single_partition_function(const Numeric &T, const SpeciesAuxData::AuxType &partition_type, const ArrayOfGriddedField1 &partition_data)
Computes the partition function at one temperature.
Auxiliary data for isotopologues.
ComplexConstMatrixViewMap MapToEigen(const ConstComplexMatrixView &A)
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.
const Numeric SPEED_OF_LIGHT
Index Isotopologue() const
Isotopologue species index.
Index nrows() const
Returns the number of rows.
Input manipulator class for doubles to enable nan and inf parsing.
Numeric wavenumber_to_joule(Numeric e)
A little helper function to convert energy from units of wavenumber (cm^-1) to Joule (J)...