FV3 Bundle
QgFortran.h
Go to the documentation of this file.
1 /*
2  * (C) Copyright 2009-2016 ECMWF.
3  *
4  * This software is licensed under the terms of the Apache Licence Version 2.0
5  * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6  * In applying this licence, ECMWF does not waive the privileges and immunities
7  * granted to it by virtue of its status as an intergovernmental organisation nor
8  * does it submit to any jurisdiction.
9  */
10 
11 #ifndef QG_MODEL_QGFORTRAN_H_
12 #define QG_MODEL_QGFORTRAN_H_
13 
14 // Forward declarations
15 namespace eckit {
16  class Configuration;
17 }
18 
19 namespace util {
20  class DateTime;
21  class Duration;
22 }
23 
24 namespace qg {
25 
26 // Geometry key type
27 typedef int F90geom;
28 typedef int F90iter;
29 // Model key type
30 typedef int F90model;
31 // Variables key type
32 typedef int F90vars;
33 // Locations key type
34 typedef int F90locs;
35 // Goms key type
36 typedef int F90goms;
37 // Fields key type
38 typedef int F90flds;
39 // Trajectory key type
40 typedef int F90traj;
41 // Background error covariance key type
42 typedef int F90bmat;
43 // Background error std dev key type
44 typedef int F90bstddev;
45 // Observation vector key type
46 typedef int F90ovec;
47 // Obs operator key type
48 typedef int F90hop;
49 // Observation data base type
50 typedef int F90odb;
51 // Localization matrix
52 typedef int F90lclz;
53 
54 /// Interface to Fortran QG model
55 /*!
56  * The core of the QG model is coded in Fortran.
57  * Here we define the interfaces to the Fortran code.
58  */
59 
60 extern "C" {
61 // -----------------------------------------------------------------------------
62 // Geometry
63 // -----------------------------------------------------------------------------
64  void qg_geo_setup_f90(F90geom &, const eckit::Configuration * const *);
65  void qg_geo_clone_f90(const F90geom &, F90geom &);
66  void qg_geo_info_f90(const F90geom &, int &, int &);
67  void qg_geo_delete_f90(F90geom &);
68 
69  void qg_geo_iter_setup_f90(F90iter &, const F90geom &, const int &);
70  void qg_geo_iter_clone_f90(F90iter &, const F90iter &);
72  void qg_geo_iter_equals_f90(const F90iter &, const F90iter&, int &);
73  void qg_geo_iter_current_f90(const F90iter &, double &, double &);
74  void qg_geo_iter_next_f90(const F90iter &);
75 // -----------------------------------------------------------------------------
76 // Model
77 // -----------------------------------------------------------------------------
78  void qg_setup_f90(const eckit::Configuration * const *, const F90geom &, F90model &);
79  void qg_delete_f90(F90model &);
80 
81  void qg_prepare_integration_f90(const F90model &, const F90flds &);
82  void qg_prepare_integration_tl_f90(const F90model &, const F90flds &);
83  void qg_prepare_integration_ad_f90(const F90model &, const F90flds &);
84 
85  void qg_propagate_f90(const F90model &, const F90flds &);
86  void qg_prop_traj_f90(const F90model &, const F90flds &, F90traj &);
87  void qg_propagate_tl_f90(const F90model &, const F90flds &, const F90traj &);
88  void qg_propagate_ad_f90(const F90model &, const F90flds &, const F90traj &);
89 
90  void qg_wipe_traj_f90(F90traj &);
91  void qg_traj_minmaxrms_f90(const F90traj &, double &);
92 
93 // -----------------------------------------------------------------------------
94 // Fields
95 // -----------------------------------------------------------------------------
96  void qg_field_create_f90(F90flds &, const F90geom &, const F90vars *);
98 
99  void qg_field_copy_f90(const F90flds &, const F90flds &);
100  void qg_field_zero_f90(const F90flds &);
101  void qg_field_self_add_f90(const F90flds &, const F90flds &);
102  void qg_field_self_sub_f90(const F90flds &, const F90flds &);
103  void qg_field_self_mul_f90(const F90flds &, const double &);
104  void qg_field_axpy_f90(const F90flds &, const double &, const F90flds &);
105  void qg_field_dot_prod_f90(const F90flds &, const F90flds &, double &);
106  void qg_field_self_schur_f90(const F90flds &, const F90flds &);
107  void qg_field_random_f90(const F90flds &);
108  void qg_field_dirac_f90(const F90flds &, const eckit::Configuration * const *);
109 
110  void qg_field_add_incr_f90(const F90flds &, const F90flds &);
111  void qg_field_diff_incr_f90(const F90flds &, const F90flds &, const F90flds &);
112 
113  void qg_field_change_resol_f90(const F90flds &, const F90flds &);
114 
115  void qg_field_read_file_f90(const F90flds &, const eckit::Configuration * const *,
116  util::DateTime * const *);
117  void qg_field_analytic_init_f90(const F90flds &, const F90geom &,
118  const eckit::Configuration * const *,
119  util::DateTime * const *);
120  void qg_field_write_file_f90(const F90flds &, const eckit::Configuration * const *,
121  const util::DateTime * const *);
122 
123  void qg_field_interp_f90(const F90flds &, const F90locs &, const F90vars *, const F90goms &);
124  void qg_field_interp_tl_f90(const F90flds &, const F90locs &, const F90vars *, const F90goms &);
125  void qg_field_interp_ad_f90(const F90flds &, const F90locs &, const F90vars *, const F90goms &);
126  void qg_field_ug_coord_f90(const F90flds &, const int &, const int &);
127  void qg_field_field_to_ug_f90(const F90flds &, const int &, const int &);
128  void qg_field_field_from_ug_f90(const F90flds &, const int &);
129 
130  void qg_field_gpnorm_f90(const F90flds &, const int &, double &);
131  void qg_field_sizes_f90(const F90flds &, int &, int &, int &, int &, int &);
132  void qg_field_rms_f90(const F90flds &, double &);
133  void qg_field_getpoint_f90(const F90flds&, const F90iter&, const int &, double &);
134 // -----------------------------------------------------------------------------
135 // Background error
136 // -----------------------------------------------------------------------------
137  void qg_b_setup_f90(F90bmat &, const eckit::Configuration * const *, const F90geom &);
138  void qg_b_delete_f90(F90bmat &);
139 
140  void qg_b_linearize_f90(const F90bmat &, const eckit::Configuration * const *);
141 
142  void qg_b_mult_f90(const F90bmat &, const F90flds &, const F90flds &);
143  void qg_b_invmult_f90(const F90bmat &, const F90flds &, const F90flds &);
144 
145  void qg_b_randomize_f90(const F90bmat &, const F90flds &);
146 
147 // -----------------------------------------------------------------------------
148 // Background error standard deviations
149 // -----------------------------------------------------------------------------
150  void qg_bstddev_setup_f90(F90bstddev &, const eckit::Configuration * const *);
152  void qg_bstddev_mult_f90(const F90bstddev &, const F90flds &, const F90flds &);
153  void qg_bstddev_invmult_f90(const F90bstddev &, const F90flds &, const F90flds &);
154 
155 // -----------------------------------------------------------------------------
156 // Localization matrix
157 // -----------------------------------------------------------------------------
158  void qg_localization_setup_f90(F90lclz &, const eckit::Configuration * const *,
159  const F90geom &);
161  void qg_localization_mult_f90(const F90lclz &, const F90flds &);
162 
163 // -----------------------------------------------------------------------------
164 // Locations
165 // -----------------------------------------------------------------------------
166  void qg_loc_create_f90(F90locs &);
167  void qg_loc_test_f90(const F90locs &, const eckit::Configuration * const *,
168  const int &, const double *, const double *, const double*);
169  void qg_loc_delete_f90(F90locs &);
170  void qg_loc_nobs_f90(const F90locs &, int &);
171  void qg_loc_element_f90(const F90locs &, const int &, double *);
172 
173 // -----------------------------------------------------------------------------
174 // Local Values (GOM)
175 // -----------------------------------------------------------------------------
176  void qg_gom_setup_f90(F90goms &, const F90locs &, const F90vars *);
177  void qg_gom_create_f90(F90goms &);
178  void qg_gom_delete_f90(F90goms &);
179  void qg_gom_abs_f90(const F90goms &);
180  void qg_gom_rms_f90(const F90goms &, double &);
181  void qg_gom_zero_f90(const F90goms &);
182  void qg_gom_assign_f90(const F90goms &, const F90goms &);
183  void qg_gom_random_f90(const F90goms &);
184  void qg_gom_mult_f90(const F90goms &, const double &);
185  void qg_gom_add_f90(const F90goms &, const F90goms &);
186  void qg_gom_diff_f90(const F90goms &, const F90goms &);
187  void qg_gom_divide_f90(const F90goms &, const F90goms &);
188  void qg_gom_dotprod_f90(const F90goms &, const F90goms &, double &);
189  void qg_gom_minmaxavg_f90(const F90goms &, int &, double &, double &, double &);
190  void qg_gom_maxloc_f90(const F90goms &, double &, int &, int &);
191  void qg_gom_read_file_f90(const F90goms &, const eckit::Configuration * const *);
192  void qg_gom_analytic_init_f90(const F90goms &, const F90locs &,
193  const eckit::Configuration * const *);
194  void qg_gom_write_file_f90(const F90goms &, const eckit::Configuration * const *);
195 
196 // -----------------------------------------------------------------------------
197 // Streamfunction observations
198 // -----------------------------------------------------------------------------
199  void qg_stream_setup_f90(F90hop &, const eckit::Configuration * const *);
201 
202  void qg_stream_equiv_f90(const F90goms &, const F90ovec &, const double &);
203  void qg_stream_equiv_tl_f90(const F90goms &, const F90ovec &, const double &);
204  void qg_stream_equiv_ad_f90(const F90goms &, const F90ovec &, double &);
205 
206 // -----------------------------------------------------------------------------
207 // Wind observations
208 // -----------------------------------------------------------------------------
209  void qg_wind_setup_f90(F90hop &, const eckit::Configuration * const *);
210  void qg_wind_delete_f90(F90hop &);
211 
212  void qg_wind_equiv_f90(const F90goms &, F90ovec &, const double &);
213  void qg_wind_equiv_tl_f90(const F90goms &, const F90ovec &, const double &);
214  void qg_wind_equiv_ad_f90(const F90goms &, const F90ovec &, double &);
215 
216 // -----------------------------------------------------------------------------
217 // Wind speed observations
218 // -----------------------------------------------------------------------------
219  void qg_wspeed_setup_f90(F90hop &, const eckit::Configuration * const *);
221 
222  void qg_wspeed_eqv_f90(const F90goms &, const F90ovec &, const double &);
223  void qg_wspeed_equiv_tl_f90(const F90goms &, const F90ovec &, const F90goms &, const double &);
224  void qg_wspeed_equiv_ad_f90(const F90goms &, const F90ovec &, const F90goms &, double &);
225 
226  void qg_wspeed_gettraj_f90(const F90hop &, const int &, const int *, F90goms &);
227  void qg_wspeed_settraj_f90(const F90goms &, const F90goms &);
228 
229 // -----------------------------------------------------------------------------
230 // Observation Vectors
231 // -----------------------------------------------------------------------------
232  void qg_obsvec_setup_f90(F90ovec &, const int &, const int &);
233  void qg_obsvec_clone_f90(const F90ovec &, F90ovec &);
235 
236  void qg_obsvec_assign_f90(const F90ovec &, const F90ovec &);
237  void qg_obsvec_zero_f90(const F90ovec &);
238  void qg_obsvec_mul_scal_f90(const F90ovec &, const double &);
239  void qg_obsvec_add_f90(const F90ovec &, const F90ovec &);
240  void qg_obsvec_sub_f90(const F90ovec &, const F90ovec &);
241  void qg_obsvec_mul_f90(const F90ovec &, const F90ovec &);
242  void qg_obsvec_div_f90(const F90ovec &, const F90ovec &);
243  void qg_obsvec_axpy_f90(const F90ovec &, const double &, const F90ovec &);
244  void qg_obsvec_invert_f90(const F90ovec &);
245  void qg_obsvec_random_f90(const F90ovec &);
246  void qg_obsvec_dotprod_f90(const F90ovec &, const F90ovec &, double &);
247  void qg_obsvec_minmaxavg_f90(const F90ovec &, double &, double &, double &);
248  void qg_obsvec_nobs_f90(const F90ovec &, int &);
249 
250 // -----------------------------------------------------------------------------
251 // Observation Handler
252 // -----------------------------------------------------------------------------
253  void qg_obsdb_setup_f90(F90odb &, const eckit::Configuration * const *);
254  void qg_obsdb_delete_f90(F90odb &);
255  void qg_obsdb_get_f90(const F90odb &, const int &, const char *,
256  const int &, const char *, const F90ovec &);
257  void qg_obsdb_put_f90(const F90odb &, const int &, const char *,
258  const int &, const char *, const F90ovec &);
259  void qg_obsdb_locations_f90(const F90odb &, const int &, const char *,
260  const util::DateTime * const *, const util::DateTime * const *,
261  F90locs &);
262  void qg_obsdb_generate_f90(const F90odb &, const int &, const char *,
263  const eckit::Configuration * const *, const util::DateTime * const *,
264  const util::Duration * const *, const int &, int &);
265  void qg_obsdb_nobs_f90(const F90odb &, const int &, const char *, int &);
266  void qg_obsoper_inputs_f90(const F90hop &, F90vars *);
267 
268 }
269 
270 // -----------------------------------------------------------------------------
271 
272 } // namespace qg
273 #endif // QG_MODEL_QGFORTRAN_H_
void qg_gom_read_file_f90(const F90goms &, const eckit::Configuration *const *)
void qg_loc_element_f90(const F90locs &, const int &, double *)
void qg_b_linearize_f90(const F90bmat &, const eckit::Configuration *const *)
void qg_wspeed_gettraj_f90(const F90hop &, const int &, const int *, F90goms &)
void qg_gom_divide_f90(const F90goms &, const F90goms &)
void qg_stream_equiv_ad_f90(const F90goms &, const F90ovec &, double &)
void qg_wind_equiv_f90(const F90goms &, F90ovec &, const double &)
void qg_geo_iter_clone_f90(F90iter &, const F90iter &)
void qg_field_interp_ad_f90(const F90flds &, const F90locs &, const F90vars *, const F90goms &)
void qg_loc_test_f90(const F90locs &, const eckit::Configuration *const *, const int &, const double *, const double *, const double *)
void qg_field_change_resol_f90(const F90flds &, const F90flds &)
void qg_obsdb_generate_f90(const F90odb &, const int &, const char *, const eckit::Configuration *const *, const util::DateTime *const *, const util::Duration *const *, const int &, int &)
void qg_localization_delete_f90(F90lclz &)
void qg_bstddev_delete_f90(F90bstddev &)
void qg_obsvec_mul_scal_f90(const F90ovec &, const double &)
void qg_obsdb_locations_f90(const F90odb &, const int &, const char *, const util::DateTime *const *, const util::DateTime *const *, F90locs &)
void qg_field_self_mul_f90(const F90flds &, const double &)
void qg_field_add_incr_f90(const F90flds &, const F90flds &)
void qg_prepare_integration_ad_f90(const F90model &, const F90flds &)
void qg_geo_iter_delete_f90(F90iter &)
void qg_field_interp_f90(const F90flds &, const F90locs &, const F90vars *, const F90goms &)
void qg_field_analytic_init_f90(const F90flds &, const F90geom &, const eckit::Configuration *const *, util::DateTime *const *)
void qg_field_axpy_f90(const F90flds &, const double &, const F90flds &)
void qg_b_delete_f90(F90bmat &)
void qg_geo_setup_f90(F90geom &, const eckit::Configuration *const *)
Interface to Fortran QG model.
void qg_wspeed_settraj_f90(const F90goms &, const F90goms &)
void qg_prepare_integration_f90(const F90model &, const F90flds &)
void qg_gom_analytic_init_f90(const F90goms &, const F90locs &, const eckit::Configuration *const *)
void qg_wspeed_eqv_f90(const F90goms &, const F90ovec &, const double &)
void qg_obsvec_zero_f90(const F90ovec &)
void qg_gom_diff_f90(const F90goms &, const F90goms &)
void qg_geo_clone_f90(const F90geom &, F90geom &)
void qg_gom_dotprod_f90(const F90goms &, const F90goms &, double &)
void qg_propagate_ad_f90(const F90model &, const F90flds &, const F90traj &)
void qg_loc_create_f90(F90locs &)
void qg_geo_info_f90(const F90geom &, int &, int &)
void qg_stream_setup_f90(F90hop &, const eckit::Configuration *const *)
void qg_b_mult_f90(const F90bmat &, const F90flds &, const F90flds &)
void qg_bstddev_setup_f90(F90bstddev &, const eckit::Configuration *const *)
void qg_obsdb_nobs_f90(const F90odb &, const int &, const char *, int &)
void qg_field_field_to_ug_f90(const F90flds &, const int &, const int &)
void qg_loc_delete_f90(F90locs &)
void qg_obsvec_axpy_f90(const F90ovec &, const double &, const F90ovec &)
void qg_geo_iter_next_f90(const F90iter &)
void qg_obsvec_nobs_f90(const F90ovec &, int &)
void qg_field_field_from_ug_f90(const F90flds &, const int &)
int F90bmat
Definition: QgFortran.h:42
void qg_wind_setup_f90(F90hop &, const eckit::Configuration *const *)
void qg_localization_setup_f90(F90lclz &, const eckit::Configuration *const *, const F90geom &)
int F90ovec
Definition: QgFortran.h:46
void qg_stream_delete_f90(F90hop &)
void qg_obsvec_mul_f90(const F90ovec &, const F90ovec &)
void qg_obsdb_delete_f90(F90odb &)
void qg_obsvec_add_f90(const F90ovec &, const F90ovec &)
void qg_wind_delete_f90(F90hop &)
void qg_field_random_f90(const F90flds &)
void qg_field_self_add_f90(const F90flds &, const F90flds &)
void qg_geo_iter_equals_f90(const F90iter &, const F90iter &, int &)
void qg_obsvec_sub_f90(const F90ovec &, const F90ovec &)
int F90flds
Definition: QgFortran.h:38
void qg_localization_mult_f90(const F90lclz &, const F90flds &)
void qg_gom_delete_f90(F90goms &)
void qg_bstddev_mult_f90(const F90bstddev &, const F90flds &, const F90flds &)
void qg_obsvec_dotprod_f90(const F90ovec &, const F90ovec &, double &)
int F90bstddev
Definition: QgFortran.h:44
void qg_gom_minmaxavg_f90(const F90goms &, int &, double &, double &, double &)
void qg_gom_write_file_f90(const F90goms &, const eckit::Configuration *const *)
int F90odb
Definition: QgFortran.h:50
void qg_setup_f90(const eckit::Configuration *const *, const F90geom &, F90model &)
void qg_prepare_integration_tl_f90(const F90model &, const F90flds &)
void qg_stream_equiv_tl_f90(const F90goms &, const F90ovec &, const double &)
void qg_obsdb_get_f90(const F90odb &, const int &, const char *, const int &, const char *, const F90ovec &)
void qg_traj_minmaxrms_f90(const F90traj &, double &)
void qg_wspeed_delete_f90(F90hop &)
int F90traj
Definition: QgFortran.h:40
void qg_obsvec_random_f90(const F90ovec &)
void qg_obsoper_inputs_f90(const F90hop &, F90vars *)
int F90geom
Definition: QgFortran.h:27
int F90hop
Definition: QgFortran.h:48
void qg_gom_abs_f90(const F90goms &)
void qg_b_setup_f90(F90bmat &, const eckit::Configuration *const *, const F90geom &)
void qg_field_dirac_f90(const F90flds &, const eckit::Configuration *const *)
void qg_geo_iter_current_f90(const F90iter &, double &, double &)
void qg_gom_assign_f90(const F90goms &, const F90goms &)
void qg_gom_maxloc_f90(const F90goms &, double &, int &, int &)
void qg_wspeed_equiv_tl_f90(const F90goms &, const F90ovec &, const F90goms &, const double &)
void qg_wspeed_setup_f90(F90hop &, const eckit::Configuration *const *)
void qg_field_ug_coord_f90(const F90flds &, const int &, const int &)
void qg_loc_nobs_f90(const F90locs &, int &)
void qg_gom_mult_f90(const F90goms &, const double &)
int F90lclz
Definition: QgFortran.h:52
void qg_obsdb_put_f90(const F90odb &, const int &, const char *, const int &, const char *, const F90ovec &)
void qg_obsvec_div_f90(const F90ovec &, const F90ovec &)
void qg_propagate_tl_f90(const F90model &, const F90flds &, const F90traj &)
void qg_obsvec_delete_f90(F90ovec &)
void qg_field_dot_prod_f90(const F90flds &, const F90flds &, double &)
void qg_wipe_traj_f90(F90traj &)
void qg_gom_random_f90(const F90goms &)
void qg_field_gpnorm_f90(const F90flds &, const int &, double &)
void qg_field_delete_f90(F90flds &)
void qg_b_randomize_f90(const F90bmat &, const F90flds &)
void qg_gom_rms_f90(const F90goms &, double &)
int F90vars
Definition: QgFortran.h:32
void qg_wspeed_equiv_ad_f90(const F90goms &, const F90ovec &, const F90goms &, double &)
void qg_bstddev_invmult_f90(const F90bstddev &, const F90flds &, const F90flds &)
void qg_field_diff_incr_f90(const F90flds &, const F90flds &, const F90flds &)
int F90iter
Definition: QgFortran.h:28
void qg_field_read_file_f90(const F90flds &, const eckit::Configuration *const *, util::DateTime *const *)
void qg_field_sizes_f90(const F90flds &, int &, int &, int &, int &, int &)
void qg_obsdb_setup_f90(F90odb &, const eckit::Configuration *const *)
void qg_wind_equiv_tl_f90(const F90goms &, const F90ovec &, const double &)
void qg_obsvec_setup_f90(F90ovec &, const int &, const int &)
void qg_b_invmult_f90(const F90bmat &, const F90flds &, const F90flds &)
void qg_delete_f90(F90model &)
void qg_field_create_f90(F90flds &, const F90geom &, const F90vars *)
void qg_field_write_file_f90(const F90flds &, const eckit::Configuration *const *, const util::DateTime *const *)
void qg_geo_delete_f90(F90geom &)
void qg_gom_zero_f90(const F90goms &)
void qg_field_interp_tl_f90(const F90flds &, const F90locs &, const F90vars *, const F90goms &)
void qg_obsvec_invert_f90(const F90ovec &)
void qg_field_getpoint_f90(const F90flds &, const F90iter &, const int &, double &)
void qg_field_zero_f90(const F90flds &)
void qg_field_rms_f90(const F90flds &, double &)
int F90locs
Definition: QgFortran.h:34
void qg_gom_create_f90(F90goms &)
void qg_obsvec_clone_f90(const F90ovec &, F90ovec &)
void qg_stream_equiv_f90(const F90goms &, const F90ovec &, const double &)
void qg_gom_add_f90(const F90goms &, const F90goms &)
void qg_field_self_sub_f90(const F90flds &, const F90flds &)
void qg_wind_equiv_ad_f90(const F90goms &, const F90ovec &, double &)
void qg_obsvec_assign_f90(const F90ovec &, const F90ovec &)
int F90goms
Definition: QgFortran.h:36
The namespace for the qg model.
void qg_field_copy_f90(const F90flds &, const F90flds &)
void qg_obsvec_minmaxavg_f90(const F90ovec &, double &, double &, double &)
void qg_gom_setup_f90(F90goms &, const F90locs &, const F90vars *)
void qg_geo_iter_setup_f90(F90iter &, const F90geom &, const int &)
void qg_field_self_schur_f90(const F90flds &, const F90flds &)
int F90model
Definition: QgFortran.h:30
void qg_prop_traj_f90(const F90model &, const F90flds &, F90traj &)
void qg_propagate_f90(const F90model &, const F90flds &)