ARTS 2.5.0 (git: 9ee3ac6c)
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 "arts.h"
35#include "auto_md.h"
36#include "file.h"
37#include "linescaling.h"
38#include "lineshape.h"
39#include "logic.h"
40#include "math_funcs.h"
41#include "messages.h"
42#include <algorithm>
43#include <cfloat>
44#include <cmath>
45#include <cstdlib>
46#include <map>
47
48#include "global_data.h"
49
50void checkPartitionFunctions(const ArrayOfArrayOfAbsorptionLines& abs_lines_per_species) {
51 for (auto& abs_lines: abs_lines_per_species) {
52 for (auto& band: abs_lines) {
54 "Species: ", band.Isotopologue().FullName(), " has no partition function\n",
55 "You must recompile ARTS partition functions with data for this species to continue your calculations,\n"
56 "or exclude the species from your computation setup")
57 }
58 }
59}
60
62 const Species::IsotopologueRatios& isoratios) {
63
64 for (auto& abs_lines: abs_lines_per_species) {
65 for (auto& band: abs_lines) {
66 ARTS_USER_ERROR_IF (std::isnan(isoratios[band.Isotopologue()]),
67 "Species: ", band.Isotopologue().FullName(), " has no isotopologue ratios\n",
68 "You must add its isotopologue ratios to your included data or\n"
69 "exclude the species from your computation setup")
70 }
71 }
72}
73
86 // Planck constant [Js]
87 extern const Numeric PLANCK_CONST;
88
89 // Speed of light [m/s]
90 extern const Numeric SPEED_OF_LIGHT;
91
92 // Constant to convert lower state energy from cm^-1 to J
93 const Numeric lower_energy_const = PLANCK_CONST * SPEED_OF_LIGHT * 1E2;
94
95 return e * lower_energy_const;
96}
97
99
111 const String& species_name,
112 const ArrayOfArrayOfSpeciesTag& abs_species,
113 const Matrix& abs_vmrs) {
114 const Index index = find_first_species(abs_species, Species::fromShortName(species_name));
115
116 vmr.resize(abs_vmrs.ncols());
117 if (index < 0)
118 vmr = -99;
119 else
120 vmr = abs_vmrs(index, Range(joker));
121}
void checkIsotopologueRatios(const ArrayOfArrayOfAbsorptionLines &abs_lines_per_species, const Species::IsotopologueRatios &isoratios)
Check that isotopologue ratios for the given species are correctly defined.
Definition: absorption.cc:61
void checkPartitionFunctions(const ArrayOfArrayOfAbsorptionLines &abs_lines_per_species)
Check that ARTS was compiled for all requested species tags.
Definition: absorption.cc:50
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:110
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:85
Declarations required for the calculation of absorption coefficients.
The global header file for ARTS.
const Numeric SPEED_OF_LIGHT
This can be used to make arrays out of anything.
Definition: array.h:107
Index ncols() const ARTS_NOEXCEPT
Returns the number of columns.
Definition: matpackI.cc:436
The Matrix class.
Definition: matpackI.h:1225
The range class.
Definition: matpackI.h:165
The Vector class.
Definition: matpackI.h:876
void resize(Index n)
Resize function.
Definition: matpackI.cc:408
const Numeric PLANCK_CONST
Global constant, the Planck constant [Js].
#define ARTS_USER_ERROR_IF(condition,...)
Definition: debug.h:134
This file contains basic functions to handle ASCII files.
Constains various line scaling functions.
Header file for logic.cc.
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:33
const Joker joker
Declarations having to do with the four output streams.
constexpr bool has_partfun(const Species::IsotopeRecord &ir) noexcept
Definition: partfun.h:147
constexpr bool isnan(double d) noexcept
Definition: nonstd.h:39
Index find_first_species(const ArrayOfArrayOfSpeciesTag &specs, Species::Species spec) noexcept