ARTS  2.2.66
jacobian.h
Go to the documentation of this file.
1 /* Copyright (C) 2004-2012 Mattias Ekstrom <ekstrom@rss.chalmers.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 
24 #ifndef jacobian_h
25 #define jacobian_h
26 
27 #include <map>
28 #include <iostream>
29 #include <stdexcept>
30 #include "matpackI.h"
31 #include "array.h"
32 #include "mystring.h"
33 #include "make_array.h"
34 #include "bifstream.h"
35 #include "interpolation.h"
36 #include "logic.h"
37 #include "methods.h"
38 #include "ppath.h"
39 #include "agenda_class.h"
40 
41 
42 
46 public:
47 
50  msubtag(),
51  mmode(),
52  manalytical(-1),
53  mperturbation(0.),
54  mgrids()
55  { /* Nothing to do here. */ }
56 
57 
59  RetrievalQuantity(const String& maintag,
60  const String& subtag,
61  const String& mode,
62  const Index& analytical,
63  const Numeric& perturbation,
64  const ArrayOfVector& grids ) :
65  mmaintag(maintag),
66  msubtag(subtag),
67  mmode(mode),
68  manalytical(analytical),
69  mperturbation(perturbation),
70  mgrids(grids)
71  {
72  // With Matpack, initialization of mgrids from grids should work correctly.
73  }
74 
76  const String& MainTag() const { return mmaintag; }
77  void MainTag( const String& mt ) { mmaintag = mt; }
79  const String& Subtag() const { return msubtag; }
80  void Subtag( const String& st ) { msubtag = st; }
82  const String& Mode() const { return mmode; }
83  void Mode( const String& m ) { mmode = m; }
85  const Index& Analytical() const { return manalytical; }
86  void Analytical( const Index& m ) { manalytical = m; }
88  const Numeric& Perturbation() const { return mperturbation; }
89  void Perturbation( const Numeric& p ) { mperturbation = p; }
91  const ArrayOfVector& Grids() const { return mgrids; }
92  void Grids( const ArrayOfVector& g ) { mgrids = g; }
93 
94 private:
95 
102 };
103 
107 ostream& operator << (ostream& os, const RetrievalQuantity& ot);
108 
110 
111 
112 
113 // A macro to loop analytical jacobian quantities
114 #define FOR_ANALYTICAL_JACOBIANS_DO(what_to_do) \
115  for( Index iq=0; iq<jacobian_quantities.nelem(); iq++ ) \
116  { \
117  if( jacobian_quantities[iq].Analytical() ) \
118  { what_to_do } \
119  }
120 
121 
122 
123 
124 
125 //======================================================================
126 // Functions related to calculation of Jacobian
127 //======================================================================
128 
129 void calc_nd_field( Tensor3View& nd,
130  const VectorView& p,
131  const Tensor3View& t);
132 
134  ostringstream& os,
135  const Vector& p_grid,
136  const Vector& lat_grid,
137  const Vector& lon_grid,
138  const Vector& p_retr,
139  const Vector& lat_retr,
140  const Vector& lon_retr,
141  const String& p_retr_name,
142  const String& lat_retr_name,
143  const String& lon_retr_name,
144  const Index& dim);
145 
147  Tensor3View diy_dx,
148  const RetrievalQuantity& jacobian_quantity,
149  ConstTensor3View diy_dpath,
150  const Index& atmosphere_dim,
151  const Ppath& ppath,
152  ConstVectorView ppath_p );
153 
155  const Vector& atm_grid,
156  const Vector& jac_grid,
157  const bool& is_pressure);
158 
160  const Vector& pert_grid,
161  const Vector& atm_limit);
162 
163 void get_perturbation_range( Range& range,
164  const Index& index,
165  const Index& length);
166 
168  ArrayOfIndex& abs_species_i,
169  ArrayOfIndex& is_t,
170  ArrayOfIndex& wind_i,
171  const ArrayOfRetrievalQuantity& jacobian_quantities,
172  const ArrayOfArrayOfSpeciesTag& abs_species );
173 
175  const ArrayOfGridPos& p_gp,
176  const Index& p_pert_n,
177  const Range& p_range,
178  const Numeric& size,
179  const Index& method);
180 
182  const ArrayOfGridPos& p_gp,
183  const ArrayOfGridPos& lat_gp,
184  const Index& p_pert_n,
185  const Index& lat_pert_n,
186  const Range& p_range,
187  const Range& lat_range,
188  const Numeric& size,
189  const Index& method);
190 
192  const ArrayOfGridPos& p_gp,
193  const ArrayOfGridPos& lat_gp,
194  const ArrayOfGridPos& lon_gp,
195  const Index& p_pert_n,
196  const Index& lat_pert_n,
197  const Index& lon_pert_n,
198  const Range& p_range,
199  const Range& lat_range,
200  const Range& lon_range,
201  const Numeric& size,
202  const Index& method);
203 
205  Vector& b,
206  const Vector& x,
207  const Index& poly_coeff );
208 
209 void vmrunitscf(
210  Numeric& x,
211  const String& unit,
212  const Numeric& vmr,
213  const Numeric& p,
214  const Numeric& t );
215 
216 #endif // jacobian_h
RetrievalQuantity::Analytical
const Index & Analytical() const
Boolean to make analytical calculations (if possible).
Definition: jacobian.h:85
MatrixView
The MatrixView class.
Definition: matpackI.h:679
get_perturbation_limit
void get_perturbation_limit(ArrayOfIndex &limit, const Vector &pert_grid, const Vector &atm_limit)
Get limits for perturbation of a box.
Definition: jacobian.cc:580
RetrievalQuantity::Grids
const ArrayOfVector & Grids() const
Grids.
Definition: jacobian.h:91
check_retrieval_grids
bool check_retrieval_grids(ArrayOfVector &grids, ostringstream &os, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Vector &p_retr, const Vector &lat_retr, const Vector &lon_retr, const String &p_retr_name, const String &lat_retr_name, const String &lon_retr_name, const Index &dim)
Check that the retrieval grids are defined for each atmosphere dim.
Definition: jacobian.cc:396
interpolation.h
Header file for interpolation.cc.
perturbation_field_1d
void perturbation_field_1d(VectorView field, const ArrayOfGridPos &p_gp, const Index &p_pert_n, const Range &p_range, const Numeric &size, const Index &method)
Calculate the 1D perturbation for a relative perturbation.
Definition: jacobian.cc:662
RetrievalQuantity::mmode
String mmode
Definition: jacobian.h:98
RetrievalQuantity::RetrievalQuantity
RetrievalQuantity(const String &maintag, const String &subtag, const String &mode, const Index &analytical, const Numeric &perturbation, const ArrayOfVector &grids)
Constructor that sets the values.
Definition: jacobian.h:59
ArrayOfRetrievalQuantity
Array< RetrievalQuantity > ArrayOfRetrievalQuantity
Definition: jacobian.h:109
RetrievalQuantity::mperturbation
Numeric mperturbation
Definition: jacobian.h:100
array.h
This file contains the definition of Array.
Ppath
The structure to describe a propagation path and releated quantities.
Definition: ppath.h:59
RetrievalQuantity::Subtag
void Subtag(const String &st)
Definition: jacobian.h:80
matpackI.h
Tensor3View
The Tensor3View class.
Definition: matpackIII.h:232
Array< Vector >
RetrievalQuantity::Perturbation
void Perturbation(const Numeric &p)
Definition: jacobian.h:89
polynomial_basis_func
void polynomial_basis_func(Vector &b, const Vector &x, const Index &poly_coeff)
Calculates polynomial basis functions.
Definition: jacobian.cc:805
agenda_class.h
Declarations for agendas.
perturbation_field_3d
void perturbation_field_3d(Tensor3View field, const ArrayOfGridPos &p_gp, const ArrayOfGridPos &lat_gp, const ArrayOfGridPos &lon_gp, const Index &p_pert_n, const Index &lat_pert_n, const Index &lon_pert_n, const Range &p_range, const Range &lat_range, const Range &lon_range, const Numeric &size, const Index &method)
Calculate the 3D perturbation for a relative perturbation.
Definition: jacobian.cc:758
my_basic_string< char >
vmrunitscf
void vmrunitscf(Numeric &x, const String &unit, const Numeric &vmr, const Numeric &p, const Numeric &t)
vmrunitscf
Definition: jacobian.cc:853
RetrievalQuantity::MainTag
const String & MainTag() const
Main tag.
Definition: jacobian.h:76
VectorView
The VectorView class.
Definition: matpackI.h:372
perturbation_field_2d
void perturbation_field_2d(MatrixView field, const ArrayOfGridPos &p_gp, const ArrayOfGridPos &lat_gp, const Index &p_pert_n, const Index &lat_pert_n, const Range &p_range, const Range &lat_range, const Numeric &size, const Index &method)
Calculate the 2D perturbation for a relative perturbation.
Definition: jacobian.cc:707
RetrievalQuantity::Mode
const String & Mode() const
Calculation mode.
Definition: jacobian.h:82
Numeric
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:29
RetrievalQuantity::RetrievalQuantity
RetrievalQuantity()
Default constructor.
Definition: jacobian.h:49
make_array.h
Implements the class MakeArray, which is a derived class of Array, allowing explicit initialization.
RetrievalQuantity::Analytical
void Analytical(const Index &m)
Definition: jacobian.h:86
bifstream.h
This file contains the class declaration of bifstream.
RetrievalQuantity::Grids
void Grids(const ArrayOfVector &g)
Definition: jacobian.h:92
diy_from_path_to_rgrids
void diy_from_path_to_rgrids(Tensor3View diy_dx, const RetrievalQuantity &jacobian_quantity, ConstTensor3View diy_dpath, const Index &atmosphere_dim, const Ppath &ppath, ConstVectorView ppath_p)
Definition: jacobian.cc:110
Range
The range class.
Definition: matpackI.h:148
ppath.h
Propagation path structure and functions.
RetrievalQuantity::manalytical
Index manalytical
Definition: jacobian.h:99
logic.h
Header file for logic.cc.
calc_nd_field
void calc_nd_field(Tensor3View &nd, const VectorView &p, const Tensor3View &t)
Calculate the number density field.
Definition: jacobian.cc:347
RetrievalQuantity::MainTag
void MainTag(const String &mt)
Definition: jacobian.h:77
ConstTensor3View
A constant view of a Tensor3.
Definition: matpackIII.h:139
get_perturbation_gridpos
void get_perturbation_gridpos(ArrayOfGridPos &gp, const Vector &atm_grid, const Vector &jac_grid, const bool &is_pressure)
Calculate array of GridPos for perturbation interpolation.
Definition: jacobian.cc:521
get_perturbation_range
void get_perturbation_range(Range &range, const Index &index, const Index &length)
Get range for perturbation.
Definition: jacobian.cc:632
get_pointers_for_analytical_jacobians
void get_pointers_for_analytical_jacobians(ArrayOfIndex &abs_species_i, ArrayOfIndex &is_t, ArrayOfIndex &wind_i, const ArrayOfRetrievalQuantity &jacobian_quantities, const ArrayOfArrayOfSpeciesTag &abs_species)
Help function for analytical jacobian calculations.
Definition: jacobian.cc:292
RetrievalQuantity::msubtag
String msubtag
Definition: jacobian.h:97
Index
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:35
RetrievalQuantity
Contains the data for one retrieval quantity.
Definition: jacobian.h:45
RetrievalQuantity::mmaintag
String mmaintag
Definition: jacobian.h:96
RetrievalQuantity::mgrids
ArrayOfVector mgrids
Definition: jacobian.h:101
Vector
The Vector class.
Definition: matpackI.h:556
RetrievalQuantity::Mode
void Mode(const String &m)
Definition: jacobian.h:83
ConstVectorView
A constant view of a Vector.
Definition: matpackI.h:292
RetrievalQuantity::Subtag
const String & Subtag() const
Subtag.
Definition: jacobian.h:79
methods.h
Declaration of the class MdRecord.
mystring.h
This file contains the definition of String, the ARTS string class.
operator<<
ostream & operator<<(ostream &os, const RetrievalQuantity &ot)
Output operator for RetrievalQuantity.
Definition: jacobian.cc:38
RetrievalQuantity::Perturbation
const Numeric & Perturbation() const
Size of perturbation used for perturbation calculations.
Definition: jacobian.h:88