42 std::set<Species::Species> unique_species;
43 for (
auto& asp : abs_species) {
44 for (
auto& sp : asp) {
45 if (sp.Type() == Species::TagType::HitranXsec) {
46 unique_species.insert(sp.Spec());
51 String tmpbasename = basename;
52 if (basename.length() && basename[basename.length() - 1] !=
'/') {
57 hitran_xsec_data.clear();
58 for (
auto& species_name : unique_species) {
60 const String filename{tmpbasename +
61 String(Species::toShortName(species_name)) +
".xml"};
64 ReadXML(xsec_coeffs,
"", filename,
"", verbosity);
66 hitran_xsec_data.push_back(xsec_coeffs);
67 }
catch (
const std::exception& e) {
69 "Error reading coefficients file:\n", filename,
"\n", e.what());
94 "Mismatch dimensions on species and VMR inputs");
97 "Mismatch dimensions on internal matrices of xsec and frequency");
100 if (dpropmat_clearsky_dx.
nelem()) {
102 dpropmat_clearsky_dx.
nelem() not_eq jacobian_quantities.
nelem(),
103 "Mismatch dimensions on xsec derivatives and Jacobian grids");
105 std::any_of(dpropmat_clearsky_dx.cbegin(),
106 dpropmat_clearsky_dx.cend(),
108 return x.NumberOfFrequencies() not_eq f_grid.nelem();
110 "Mismatch dimensions on internal matrices of xsec derivatives and frequency");
147 bool do_abort =
false;
151 for (
Index i = 0; i < abs_species.
nelem(); i++) {
152 for (
Index s = 0; s < abs_species[i].
nelem(); s++) {
153 const SpeciesTag& this_species = abs_species[i][s];
156 if (this_species.Type() != Species::TagType::HitranXsec)
continue;
158 Index this_xdata_index =
161 "Cross-section species ",
163 " not found in *hitran_xsec_data*.")
164 const XsecRecord& this_xdata = hitran_xsec_data[this_xdata_index];
167 if (do_abort)
continue;
168 const Numeric current_p = force_p < 0 ? rtp_pressure : force_p;
169 const Numeric current_t = force_t < 0 ? rtp_temperature : force_t;
172 this_xdata.
Extract(xsec_temp, f_grid, current_p, current_t, verbosity);
175 dxsec_temp_dF, dfreq, current_p, current_t, verbosity);
179 dxsec_temp_dT, f_grid, current_p, current_t + dt, verbosity);
186 xsec_temp *= nd * rtp_vmr[i];
187 propmat_clearsky.
Kjj() += xsec_temp;
191 propmat_clearsky.
Kjj()[f] += xsec_temp[f] * nd * rtp_vmr[i];
192 for (
Index iq = 0; iq < jacobian_quantities.
nelem(); iq++) {
193 const auto& deriv = jacobian_quantities[iq];
195 if (!deriv.propmattype())
continue;
198 dpropmat_clearsky_dx[iq].Kjj()[f] +=
199 (dxsec_temp_dF[f] - xsec_temp[f]) * nd * rtp_vmr[i] / df;
201 deriv == Jacobian::Line::VMR) {
203 dpropmat_clearsky_dx[iq].Kjj()[f] +=
204 xsec_temp[f] * nd * rtp_vmr[i];
207 dpropmat_clearsky_dx[iq].Kjj()[f] +=
208 ((dxsec_temp_dT[f] - xsec_temp[f]) / dt * nd +
209 xsec_temp[f] * dnd_dt) *
240 const Index n_xsec = abs_xsec_per_species.
nelem();
244 "The following variables must all have the same dimension:\n"
248 "abs_xsec_per_species: ",
263 "The following variables must all have the same dimension:\n"
277 bool do_abort =
false;
282 for (
Index ii = 0; ii < abs_species_active.
nelem(); ii++) {
283 const Index i = abs_species_active[ii];
285 for (
Index s = 0; s < abs_species[i].
nelem(); s++) {
286 const SpeciesTag& this_species = abs_species[i][s];
289 if (this_species.Type() != Species::TagType::HitranXsec)
continue;
291 Index this_xdata_index =
294 "Cross-section species ",
296 " not found in *hitran_xsec_data*.")
297 const XsecRecord& this_xdata = hitran_xsec_data[this_xdata_index];
298 Matrix& this_xsec = abs_xsec_per_species[i];
301#pragma omp parallel for if (!arts_omp_in_parallel() && abs_p.nelem() >= 1) \
302 firstprivate(xsec_temp)
303 for (
Index ip = 0; ip < abs_p.
nelem(); ip++) {
304 if (do_abort)
continue;
305 const Numeric current_p = force_p < 0 ? abs_p[ip] : force_p;
306 const Numeric current_t = force_t < 0 ? abs_t[ip] : force_t;
315 }
catch (runtime_error& e) {
317 os <<
"Problem with HITRAN cross section species "
318 << this_species.Name() <<
" at pressure level " << ip <<
" ("
319 << abs_p[ip] / 100. <<
" hPa):\n"
321#pragma omp critical(abs_xsec_per_speciesAddHitranXsec)
324 fail_msg.push_back(os.str());
327 this_xsec(
joker, ip) += xsec_temp;
The global header file for ARTS.
This can be used to make arrays out of anything.
Index nelem() const ARTS_NOEXCEPT
Number of elements.
Index nelem() const noexcept
Returns the number of elements.
Index NumberOfFrequencies() const
The number of frequencies of the propagation matrix.
VectorView Kjj(const Index iz=0, const Index ia=0)
Vector view to diagonal elements.
void resize(Index n)
Resize function.
Hitran crosssection class.
void Extract(VectorView result, const Vector &f_grid, Numeric pressure, Numeric temperature, const Verbosity &verbosity) const
Calculate hitran cross section data.
#define ARTS_USER_ERROR(...)
#define ARTS_USER_ERROR_IF(condition,...)
Index hitran_xsec_get_index(const ArrayOfXsecRecord &xsec_data, const Species::Species species)
Get the index in hitran_xsec_data for the given species.
Methods and classes for HITRAN absorption cross section data.
bool do_frequency_jacobian(const ArrayOfRetrievalQuantity &js) noexcept
Returns if the array wants a frequency derivative.
bool species_match(const RetrievalQuantity &rq, const ArrayOfSpeciesTag &ast)
Returns if the Retrieval quantity is VMR derivative for all the species in the species tags.
bool do_temperature_jacobian(const ArrayOfRetrievalQuantity &js) noexcept
Returns if the array wants the temperature derivative.
bool supports_hitran_xsec(const ArrayOfRetrievalQuantity &js)
Returns if the array supports HITRAN cross-section derivatives.
bool is_frequency_parameter(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a frequency parameter in propagation matrix calculations.
Numeric temperature_perturbation(const ArrayOfRetrievalQuantity &js) noexcept
Returns the temperature perturbation if it exists.
Numeric frequency_perturbation(const ArrayOfRetrievalQuantity &js) noexcept
Returns the frequency perturbation if it exists.
Routines for setting up the jacobian.
void abs_xsec_per_speciesAddHitranXsec(ArrayOfMatrix &abs_xsec_per_species, ArrayOfArrayOfMatrix &, const ArrayOfArrayOfSpeciesTag &abs_species, const ArrayOfRetrievalQuantity &, const ArrayOfIndex &abs_species_active, const Vector &f_grid, const Vector &abs_p, const Vector &abs_t, const ArrayOfXsecRecord &hitran_xsec_data, const Numeric &force_p, const Numeric &force_t, const Verbosity &verbosity)
WORKSPACE METHOD: abs_xsec_per_speciesAddHitranXsec.
void propmat_clearskyAddHitranXsec(PropagationMatrix &propmat_clearsky, ArrayOfPropagationMatrix &dpropmat_clearsky_dx, const ArrayOfArrayOfSpeciesTag &abs_species, const ArrayOfRetrievalQuantity &jacobian_quantities, const Vector &f_grid, const Numeric &rtp_pressure, const Numeric &rtp_temperature, const Vector &rtp_vmr, const ArrayOfXsecRecord &hitran_xsec_data, const Numeric &force_p, const Numeric &force_t, const Verbosity &verbosity)
WORKSPACE METHOD: propmat_clearskyAddHitranXsec.
void ReadXsecData(ArrayOfXsecRecord &hitran_xsec_data, const ArrayOfArrayOfSpeciesTag &abs_species, const String &basename, const Verbosity &verbosity)
WORKSPACE METHOD: ReadXsecData.
Workspace methods and template functions for supergeneric XML IO.
void ReadXML(T &v, const String &v_name, const String &f, const String &f_name, const Verbosity &verbosity)
WORKSPACE METHOD: ReadXML.
NUMERIC Numeric
The type to use for all floating point numbers.
INDEX Index
The type to use for all integer numbers and indices.
Declarations having to do with the four output streams.
my_basic_string< char > String
The String type for ARTS.
Particulates ENUMCLASS(Line, char, VMR, Strength, Center, ShapeG0X0, ShapeG0X1, ShapeG0X2, ShapeG0X3, ShapeD0X0, ShapeD0X1, ShapeD0X2, ShapeD0X3, ShapeG2X0, ShapeG2X1, ShapeG2X2, ShapeG2X3, ShapeD2X0, ShapeD2X1, ShapeD2X2, ShapeD2X3, ShapeFVCX0, ShapeFVCX1, ShapeFVCX2, ShapeFVCX3, ShapeETAX0, ShapeETAX1, ShapeETAX2, ShapeETAX3, ShapeYX0, ShapeYX1, ShapeYX2, ShapeYX3, ShapeGX0, ShapeGX1, ShapeGX2, ShapeGX3, ShapeDVX0, ShapeDVX1, ShapeDVX2, ShapeDVX3, ECS_SCALINGX0, ECS_SCALINGX1, ECS_SCALINGX2, ECS_SCALINGX3, ECS_BETAX0, ECS_BETAX1, ECS_BETAX2, ECS_BETAX3, ECS_LAMBDAX0, ECS_LAMBDAX1, ECS_LAMBDAX2, ECS_LAMBDAX3, ECS_DCX0, ECS_DCX1, ECS_DCX2, ECS_DCX3, NLTE) static_assert(Index(Line ArrayOfSpeciesTagVMR
This file contains declerations of functions of physical character.
constexpr Numeric dnumber_density_dt(Numeric p, Numeric t) noexcept
dnumber_density_dT
constexpr Numeric number_density(Numeric p, Numeric t) noexcept
number_density