ARTS  2.4.0(git:4fb77825)
gas_abs_lookup.h
Go to the documentation of this file.
1 /* Copyright (C) 2002-2012 Stefan Buehler <sbuehler@ltu.se>
2 
3  This program is free software; you can redistribute it and/or modify it
4  under the terms of the GNU General Public License as published by the
5  Free Software Foundation; either version 2, or (at your option) any
6  later version.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software
15  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16  USA. */
17 
26 #ifndef gas_abs_lookup_h
27 #define gas_abs_lookup_h
28 
29 #include "abs_species_tags.h"
30 #include "absorption.h"
31 #include "interpolation_poly.h"
32 #include "matpackIV.h"
33 #include "messages.h"
34 
35 // Declare existance of some classes:
36 class bifstream;
37 class bofstream;
38 class Agenda;
39 class Workspace;
40 
42 
45 class GasAbsLookup {
46  public:
48  : species(),
50  f_grid(),
51  p_grid(),
52  vmrs_ref(),
53  t_ref(),
54  t_pert(),
55  nls_pert(),
56  xsec() { /* Nothing to do here */
57  }
58 
59  // Documentation is with the implementation!
60  void Adapt(const ArrayOfArrayOfSpeciesTag& current_species,
61  ConstVectorView current_f_grid,
62  const Verbosity& verbosity);
63 
64  // Documentation is with the implementation!
65  void Extract(Matrix& sga,
66  const Index& p_interp_order,
67  const Index& t_interp_order,
68  const Index& h2o_interp_order,
69  const Index& f_interp_order,
70  const Numeric& p,
71  const Numeric& T,
73  ConstVectorView new_f_grid,
74  const Numeric& extpolfac) const;
75 
76  const Vector& GetFgrid() const;
77 
78  const Vector& GetPgrid() const;
79 
80  Index GetSpeciesIndex(const Index& isp) const {
81  return species[isp][0].Species();
82  }
83 
84  // IO functions must be friends:
85  friend void xml_read_from_stream(istream& is_xml,
86  GasAbsLookup& gal,
87  bifstream* pbifs,
88  const Verbosity& verbosity);
89  friend void xml_write_to_stream(ostream& os_xml,
90  const GasAbsLookup& gal,
91  bofstream* pbofs,
92  const String& name,
93  const Verbosity& verbosity);
94 
95  friend void abs_lookupCalc( // Workspace reference:
96  Workspace& ws,
97  // WS Output:
100  // WS Input:
103  const Vector& f_grid,
104  const Vector& abs_p,
105  const Matrix& abs_vmrs,
106  const Vector& abs_t,
107  const Vector& abs_t_pert,
108  const Vector& abs_nls_pert,
109  const Agenda& abs_xsec_agenda,
110  // Verbosity object:
111  const Verbosity& verbosity);
112 
113  friend Numeric calc_lookup_error( // Parameters for lookup table:
114  Workspace& ws,
115  const GasAbsLookup& al,
116  const Index& abs_p_interp_order,
117  const Index& abs_t_interp_order,
119  const bool ignore_errors,
120  // Parameters for LBL:
121  const Agenda& abs_xsec_agenda,
122  // Parameters for both:
123  const Numeric& local_p,
124  const Numeric& local_t,
125  const Vector& local_vmrs,
126  const Verbosity& verbosity);
127 
128  friend void abs_lookupTestAccuracy( // Workspace reference:
129  Workspace& ws,
130  // WS Input:
131  const GasAbsLookup& abs_lookup,
133  const Index& abs_p_interp_order,
134  const Index& abs_t_interp_order,
136  const Agenda& abs_xsec_agenda,
137  // Verbosity object:
138  const Verbosity& verbosity);
139 
140  friend void abs_lookupTestAccMC( // Workspace reference:
141  Workspace& ws,
142  // WS Input:
143  const GasAbsLookup& abs_lookup,
145  const Index& abs_p_interp_order,
146  const Index& abs_t_interp_order,
148  const Index& mc_seed,
149  const Agenda& abs_xsec_agenda,
150  // Verbosity object:
151  const Verbosity& verbosity);
152 
153  friend void nca_read_from_file(const int ncid,
154  GasAbsLookup& gal,
155  const Verbosity&);
156 
157  friend void nca_write_to_file(const int ncid,
158  const GasAbsLookup& gal,
159  const Verbosity&);
160 
163 
166 
168  Vector& Fgrid() {return f_grid;}
169 
172 
174  Vector& Pgrid() {return p_grid;}
175 
178 
180  Matrix& VMRs() {return vmrs_ref;}
181 
183  Vector& Tref() {return t_ref;}
184 
186  Vector& Tpert() {return t_pert;}
187 
189  Vector& NLSPert() {return nls_pert;}
190 
192  Tensor4& Xsec() {return xsec;}
193 
194  private:
197 
199 
206 
208 
210 
212 
220 
222 
224 
226 
232 
234 
242 
244 
247 
249 
261 
263 
276 
278 
310 };
311 
312 ostream& operator<<(ostream& os, const GasAbsLookup& gal);
313 
314 #endif // gas_abs_lookup_h
Matrix
The Matrix class.
Definition: matpackI.h:1193
GasAbsLookup::GetPgrid
const Vector & GetPgrid() const
Definition: gas_abs_lookup.cc:1138
GasAbsLookup::nca_write_to_file
friend void nca_write_to_file(const int ncid, const GasAbsLookup &gal, const Verbosity &)
Writes a GasAbsLookup table to a NetCDF file.
Definition: nc_io_compound_types.cc:72
GasAbsLookup::GetSpeciesIndex
Index GetSpeciesIndex(const Index &isp) const
Definition: gas_abs_lookup.h:80
GasAbsLookup::GetFgrid
const Vector & GetFgrid() const
Definition: gas_abs_lookup.cc:1136
GasAbsLookup::nonlinear_species
ArrayOfIndex nonlinear_species
The species tags with non-linear treatment.
Definition: gas_abs_lookup.h:205
absorption.h
Declarations required for the calculation of absorption coefficients.
ARTS::Var::verbosity
Verbosity verbosity(Workspace &ws) noexcept
Definition: autoarts.h:7112
GasAbsLookup::Extract
void Extract(Matrix &sga, const Index &p_interp_order, const Index &t_interp_order, const Index &h2o_interp_order, const Index &f_interp_order, const Numeric &p, const Numeric &T, ConstVectorView abs_vmrs, ConstVectorView new_f_grid, const Numeric &extpolfac) const
Extract scalar gas absorption coefficients from the lookup table.
Definition: gas_abs_lookup.cc:515
ARTS::Var::abs_lookup_is_adapted
Index abs_lookup_is_adapted(Workspace &ws) noexcept
Definition: autoarts.h:2047
Tensor4
The Tensor4 class.
Definition: matpackIV.h:421
Agenda
The Agenda class.
Definition: agenda_class.h:44
ARTS::Var::abs_lookup
GasAbsLookup abs_lookup(Workspace &ws) noexcept
Definition: autoarts.h:2037
GasAbsLookup
An absorption lookup table.
Definition: gas_abs_lookup.h:45
ARTS::Var::abs_vmrs
Matrix abs_vmrs(Workspace &ws) noexcept
Definition: autoarts.h:2267
matpackIV.h
GasAbsLookup::FGPDefault
ArrayOfGridPosPoly & FGPDefault()
Frequency grid positions.
Definition: gas_abs_lookup.h:171
Array
This can be used to make arrays out of anything.
Definition: array.h:108
GasAbsLookup::Tref
Vector & Tref()
The reference temperature profile [K].
Definition: gas_abs_lookup.h:183
GasAbsLookup::calc_lookup_error
friend Numeric calc_lookup_error(Workspace &ws, const GasAbsLookup &al, const Index &abs_p_interp_order, const Index &abs_t_interp_order, const Index &abs_nls_interp_order, const bool ignore_errors, const Agenda &abs_xsec_agenda, const Numeric &local_p, const Numeric &local_t, const Vector &local_vmrs, const Verbosity &verbosity)
Compare lookup and LBL calculation.
Definition: m_abs_lookup.cc:2441
messages.h
Declarations having to do with the four output streams.
GasAbsLookup::abs_lookupCalc
friend void abs_lookupCalc(Workspace &ws, GasAbsLookup &abs_lookup, Index &abs_lookup_is_adapted, const ArrayOfArrayOfSpeciesTag &abs_species, const ArrayOfArrayOfSpeciesTag &abs_nls, const Vector &f_grid, const Vector &abs_p, const Matrix &abs_vmrs, const Vector &abs_t, const Vector &abs_t_pert, const Vector &abs_nls_pert, const Agenda &abs_xsec_agenda, const Verbosity &verbosity)
WORKSPACE METHOD: abs_lookupCalc.
Definition: m_abs_lookup.cc:60
my_basic_string< char >
GasAbsLookup::t_ref
Vector t_ref
The reference temperature profile [K].
Definition: gas_abs_lookup.h:246
ARTS::Var::abs_species
ArrayOfArrayOfSpeciesTag abs_species(Workspace &ws) noexcept
Definition: autoarts.h:2157
GasAbsLookup::Xsec
Tensor4 & Xsec()
Absorption cross sections.
Definition: gas_abs_lookup.h:192
GasAbsLookup::f_grid
Vector f_grid
The frequency grid [Hz].
Definition: gas_abs_lookup.h:209
GasAbsLookup::p_grid
Vector p_grid
The pressure grid for the table [Pa].
Definition: gas_abs_lookup.h:223
GasAbsLookup::GasAbsLookup
GasAbsLookup()
Definition: gas_abs_lookup.h:47
Numeric
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:33
Verbosity
Definition: messages.h:49
GasAbsLookup::abs_lookupTestAccuracy
friend void abs_lookupTestAccuracy(Workspace &ws, const GasAbsLookup &abs_lookup, const Index &abs_lookup_is_adapted, const Index &abs_p_interp_order, const Index &abs_t_interp_order, const Index &abs_nls_interp_order, const Agenda &abs_xsec_agenda, const Verbosity &verbosity)
WORKSPACE METHOD: abs_lookupTestAccuracy.
Definition: m_abs_lookup.cc:2567
GasAbsLookup::nca_read_from_file
friend void nca_read_from_file(const int ncid, GasAbsLookup &gal, const Verbosity &)
Reads a GasAbsLookup table from a NetCDF file.
Definition: nc_io_compound_types.cc:49
bifstream
Binary output file stream class.
Definition: bifstream.h:42
GasAbsLookup::fgp_default
ArrayOfGridPosPoly fgp_default
Frequency grid positions.
Definition: gas_abs_lookup.h:219
GasAbsLookup::nls_pert
Vector nls_pert
The vector of perturbations for the VMRs of the nonlinear species.
Definition: gas_abs_lookup.h:275
GasAbsLookup::xsec
Tensor4 xsec
Absorption cross sections.
Definition: gas_abs_lookup.h:309
ARTS::Var::abs_xsec_agenda
Agenda abs_xsec_agenda(Workspace &ws) noexcept
Definition: autoarts.h:2274
ARTS::Var::abs_nls_interp_order
Index abs_nls_interp_order(Workspace &ws) noexcept
Definition: autoarts.h:2081
abs_species_tags.h
Header file for stuff related to absorption species tags.
ARTS::Var::abs_nls_pert
Vector abs_nls_pert(Workspace &ws) noexcept
Definition: autoarts.h:2095
interpolation_poly.h
Header file for interpolation_poly.cc.
GasAbsLookup::Species
ArrayOfArrayOfSpeciesTag & Species()
The species tags for which the table is valid.
Definition: gas_abs_lookup.h:162
ARTS::Var::abs_t
Vector abs_t(Workspace &ws) noexcept
Definition: autoarts.h:2186
GasAbsLookup::species
ArrayOfArrayOfSpeciesTag species
The species tags for which the table is valid.
Definition: gas_abs_lookup.h:196
GasAbsLookup::NonLinearSpecies
ArrayOfIndex & NonLinearSpecies()
The species tags with non-linear treatment.
Definition: gas_abs_lookup.h:165
GasAbsLookup::abs_lookupTestAccMC
friend void abs_lookupTestAccMC(Workspace &ws, const GasAbsLookup &abs_lookup, const Index &abs_lookup_is_adapted, const Index &abs_p_interp_order, const Index &abs_t_interp_order, const Index &abs_nls_interp_order, const Index &mc_seed, const Agenda &abs_xsec_agenda, const Verbosity &verbosity)
WORKSPACE METHOD: abs_lookupTestAccMC.
Definition: m_abs_lookup.cc:2880
GasAbsLookup::NLSPert
Vector & NLSPert()
The vector of perturbations for the VMRs of the nonlinear species.
Definition: gas_abs_lookup.h:189
ARTS::Var::abs_nls
ArrayOfArrayOfSpeciesTag abs_nls(Workspace &ws) noexcept
Definition: autoarts.h:2065
GasAbsLookup::Pgrid
Vector & Pgrid()
The pressure grid for the table [Pa].
Definition: gas_abs_lookup.h:174
GasAbsLookup::log_p_grid
Vector log_p_grid
The natural log of the pressure grid.
Definition: gas_abs_lookup.h:231
Workspace
Workspace class.
Definition: workspace_ng.h:40
GasAbsLookup::LogPgrid
Vector & LogPgrid()
The natural log of the pressure grid.
Definition: gas_abs_lookup.h:177
ARTS::Var::abs_t_pert
Vector abs_t_pert(Workspace &ws) noexcept
Definition: autoarts.h:2215
GasAbsLookup::Adapt
void Adapt(const ArrayOfArrayOfSpeciesTag &current_species, ConstVectorView current_f_grid, const Verbosity &verbosity)
Adapt lookup table to current calculation.
Definition: gas_abs_lookup.cc:118
GasAbsLookup::Tpert
Vector & Tpert()
The vector of temperature perturbations [K].
Definition: gas_abs_lookup.h:186
ARTS::Var::abs_t_interp_order
Index abs_t_interp_order(Workspace &ws) noexcept
Definition: autoarts.h:2202
GasAbsLookup::VMRs
Matrix & VMRs()
The reference VMR profiles.
Definition: gas_abs_lookup.h:180
ARTS::Var::mc_seed
Index mc_seed(Workspace &ws) noexcept
Definition: autoarts.h:4369
Index
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
ARTS::Var::abs_p
Vector abs_p(Workspace &ws) noexcept
Definition: autoarts.h:2129
operator<<
ostream & operator<<(ostream &os, const GasAbsLookup &gal)
Output operatior for GasAbsLookup.
Definition: gas_abs_lookup.cc:1141
GasAbsLookup::vmrs_ref
Matrix vmrs_ref
The reference VMR profiles.
Definition: gas_abs_lookup.h:241
ARTS::Var::abs_p_interp_order
Index abs_p_interp_order(Workspace &ws) noexcept
Definition: autoarts.h:2145
GasAbsLookup::t_pert
Vector t_pert
The vector of temperature perturbations [K].
Definition: gas_abs_lookup.h:260
GasAbsLookup::xml_write_to_stream
friend void xml_write_to_stream(ostream &os_xml, const GasAbsLookup &gal, bofstream *pbofs, const String &name, const Verbosity &verbosity)
Writes GasAbsLookup to XML output stream.
Definition: xml_io_compound_types.cc:386
Vector
The Vector class.
Definition: matpackI.h:860
ConstVectorView
A constant view of a Vector.
Definition: matpackI.h:476
GasAbsLookup::Fgrid
Vector & Fgrid()
The frequency grid [Hz].
Definition: gas_abs_lookup.h:168
GasAbsLookup::xml_read_from_stream
friend void xml_read_from_stream(istream &is_xml, GasAbsLookup &gal, bifstream *pbifs, const Verbosity &verbosity)
Reads GasAbsLookup from XML input stream.
Definition: xml_io_compound_types.cc:356
bofstream
Binary output file stream class.
Definition: bofstream.h:42