FlowSieve  3.4.0
FlowSieve Coarse-Graining Documentation
functions.hpp
Go to the documentation of this file.
1 #ifndef FUNCTIONS_HPP
2 #define FUNCTIONS_HPP 1
3 
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <vector>
7 #include <string>
8 #include <map>
9 #include <mpi.h>
10 #include "constants.hpp"
11 
24 class dataset {
25 
26  public:
27 
28  //
30  //
31 
32  // Storage for processor assignments
33  int Nprocs_in_time, Nprocs_in_depth;
34 
35  // Vectors to store the dimension variables
36  std::vector<double> time, depth, latitude, longitude;
37  int Ntime = -1, Ndepth = -1, Nlat = -1, Nlon = -1;
38  int full_Ntime = -1, full_Ndepth = -1;
39 
40  // MPI Communicator Objects
41  MPI_Comm MPI_Comm_Global = MPI_COMM_WORLD;
42  MPI_Comm MPI_subcomm_sametimes;
43  MPI_Comm MPI_subcomm_samedepths;
44 
45  // Store cell areas
46  std::vector<double> areas;
47 
48  // Boolean to indicate if we're computing u_r from incompressibility
49  bool compute_radial_vel = false,
50  use_depth_derivatives = false,
51  depth_is_elevation = false,
52  depth_is_increasing = true;
53 
54  // Dictionary for the variables (velocity components, density, etc)
55  std::map< std::string , std::vector<double> > variables;
56 
57  // Vectors and dictionary for storing the regions.
58  // these are what will be used for the post-processing
59  std::vector< std::string > region_names;
60  std::map< std::string, std::vector<bool> > regions;
61  std::vector<double> region_areas, region_areas_water_only;
62 
63  // The vectors for the coarse lat/lon maps
64  std::vector<double> coarse_map_lat, coarse_map_lon, coarse_map_areas;
65 
66  // Store mask data (i.e. land vs water)
67  std::vector<bool> mask, reference_mask, mask_DEPTH;
68 
69  // Store data-chunking info. These keep track of the MPI divisions to ensure
70  // that the output is in the same order as the input.
71  std::vector<int> myCounts, myStarts;
72 
73  //
75  //
76 
77  // Constructor
78  dataset();
79 
80  // Dimension loaders
81  void load_time( const std::string dim_name, const std::string filename );
82  void load_depth( const std::string dim_name, const std::string filename );
83  void load_latitude( const std::string dim_name, const std::string filename );
84  void load_longitude( const std::string dim_name, const std::string filename );
85 
86  // Compute areas
87  void compute_cell_areas();
88 
89  // Load in variable and store in dictionary
90  void load_variable( const std::string var_name,
91  const std::string var_name_in_file,
92  const std::string filename,
93  const bool read_mask = true,
94  const bool load_counts = true,
95  const bool do_splits = true );
96 
97  // Load in region definitions
98  void load_region_definitions( const std::string filename,
99  const std::string dim_name,
100  const std::string var_name,
101  const MPI_Comm = MPI_COMM_WORLD );
102  void compute_region_areas();
103 
104  // Prepare for grid-coarsening outputs
105  void prepare_for_coarsened_grids( const std::string filename,
106  const MPI_Comm = MPI_COMM_WORLD );
107 
108  // Check the processors divions between dimensions
109  void check_processor_divisions( const int Nprocs_in_time_input,
110  const int Nprocs_in_depth_input,
111  const MPI_Comm = MPI_COMM_WORLD );
112 
113  // Function to gather a variable across all depths (i.e. reconstruct depth profile)
114  // this is necessary for things like depth derivatives
115  void gather_variable_across_depth( const std::vector<double> & var,
116  std::vector<double> & gathered_var ) const ;
117  void gather_mask_across_depth( const std::vector<bool> & var,
118  std::vector<bool> & gathered_var
119  ) const ;
120 
121  // Indexing functions
122  size_t local_index( const int Itime,
123  const int Idepth,
124  const int Ilat,
125  const int Ilon
126  ) const;
127  size_t global_index( const int Itime,
128  const int Idepth,
129  const int Ilat,
130  const int Ilon,
131  const std::string merge_kind
132  ) const;
133  size_t index_local_to_global( const size_t index, const std::string merge_kind ) const;
134  size_t index_global_to_local( const size_t index, const std::string merge_kind ) const;
135  void index1to4_local( const size_t index,
136  int & Itime, int & Idepth, int & Ilat, int & Ilon
137  ) const;
138  void index1to4_global( const size_t index,
139  int & Itime, int & Idepth, int & Ilat, int & Ilon,
140  const std::string merge_kind
141  ) const;
142 
143 
144 };
145 
146 void compute_areas(
147  std::vector<double> & areas,
148  const std::vector<double> & longitude,
149  const std::vector<double> & latitude);
150 
151 size_t Index( const int Itime, const int Idepth, const int Ilat, const int Ilon,
152  const int Ntime, const int Ndepth, const int Nlat, const int Nlon );
153 
154 void Index1to4( const size_t index,
155  int & Itime, int & Idepth, int & Ilat, int & Ilon,
156  const int & Ntime, const int & Ndepth, const int & Nlat, const int & Nlon );
157 
158 double distance(const double lon1, const double lat1,
159  const double lon2, const double lat2,
160  const double Llon = 0, const double Llat = 0);
161 
163  std::vector<double> & local_kernel,
164  const double scale,
165  const dataset & source_data,
166  const int Ilat, const int Ilon,
167  const int LAT_lb, const int LAT_ub);
168 
169 void KE_from_vels(
170  std::vector<double> & KE,
171  std::vector<double> * u1,
172  std::vector<double> * u2,
173  std::vector<double> * u3,
174  const std::vector<bool> & mask,
175  const double rho0 = constants::rho0
176  );
177 
178 void vel_Spher_to_Cart(
179  std::vector<double> & u_x,
180  std::vector<double> & u_y,
181  std::vector<double> & u_z,
182  const std::vector<double> & u_r,
183  const std::vector<double> & u_lon,
184  const std::vector<double> & u_lat,
185  const dataset & source_data
186  );
187 
189  double & u_x,
190  double & u_y,
191  double & u_z,
192  const double u_r,
193  const double u_lon,
194  const double u_lat,
195  const double lon,
196  const double lat
197  );
198 
199 
200 void vel_Cart_to_Spher(
201  std::vector<double> & u_r,
202  std::vector<double> & u_lon,
203  std::vector<double> & u_lat,
204  const std::vector<double> & u_x,
205  const std::vector<double> & u_y,
206  const std::vector<double> & u_z,
207  const dataset & source_data
208  );
209 
210 
212  double & u_r,
213  double & u_lon,
214  double & u_lat,
215  const double u_x,
216  const double u_y,
217  const double u_z,
218  const double lon,
219  const double lat
220  );
221 
222 void filtering(const dataset & source_data,
223  const std::vector<double> & scales,
224  const MPI_Comm comm = MPI_COMM_WORLD);
225 
227  const dataset & source_data,
228  const std::vector<double> & scales,
229  const MPI_Comm comm = MPI_COMM_WORLD
230  );
231 
233  std::vector<double*> & coarse_val,
234  const std::vector<const std::vector<double>*> & fields,
235  const dataset & source_data,
236  const int Itime, const int Idepth, const int Ilat, const int Ilon,
237  const int LAT_lb,
238  const int LAT_ub,
239  const double scale,
240  const std::vector<bool> & use_mask,
241  const std::vector<double> & local_kernel,
242  const std::vector<double> * weight = NULL
243  );
244 
245 double kernel(const double distance, const double scale);
246 
247 double kernel_alpha(void);
248 
250  double & vort_r_tmp,
251  double & vort_lon_tmp,
252  double & vort_lat_tmp,
253  double & div_tmp,
254  double & OkuboWeiss_tmp,
255  const dataset & source_data,
256  const std::vector<double> & u_r,
257  const std::vector<double> & u_lon,
258  const std::vector<double> & u_lat,
259  const int Itime, const int Idepth, const int Ilat, const int Ilon);
260 
261 void compute_vorticity(
262  std::vector<double> & vort_r,
263  std::vector<double> & vort_lon,
264  std::vector<double> & vort_lat,
265  std::vector<double> & vel_div,
266  std::vector<double> & OkuboWeiss,
267  const dataset & source_data,
268  const std::vector<double> & u_r,
269  const std::vector<double> & u_lon,
270  const std::vector<double> & u_lat,
271  const MPI_Comm comm = MPI_COMM_WORLD);
272 
274  double & uxux_tmp, double & uxuy_tmp, double & uxuz_tmp,
275  double & uyuy_tmp, double & uyuz_tmp, double & uzuz_tmp,
276  double & vort_ux_tmp, double & vort_uy_tmp, double & vort_uz_tmp,
277  const std::vector<double> & u_x,
278  const std::vector<double> & u_y,
279  const std::vector<double> & u_z,
280  const std::vector<double> & vort_r,
281  const dataset & source_data,
282  const int Itime, const int Idepth, const int Ilat, const int Ilon,
283  const int LAT_lb, const int LAT_ub,
284  const double scale,
285  const std::vector<double> & local_kernel);
286 
287 void compute_Pi(
288  std::vector<double> & energy_transfer,
289  const dataset & source_data,
290  const std::vector<double> & ux,
291  const std::vector<double> & uy,
292  const std::vector<double> & uz,
293  const std::vector<double> & uxux,
294  const std::vector<double> & uxuy,
295  const std::vector<double> & uxuz,
296  const std::vector<double> & uyuy,
297  const std::vector<double> & uyuz,
298  const std::vector<double> & uzuz,
299  const MPI_Comm comm = MPI_COMM_WORLD);
300 
302  std::vector<double> & energy_transfer,
303  const dataset & source_data,
304  const std::vector<double> & ux,
305  const std::vector<double> & uy,
306  const std::vector<double> & uz,
307  const std::vector<double> & uxux,
308  const std::vector<double> & uxuy,
309  const std::vector<double> & uxuz,
310  const std::vector<double> & uyuy,
311  const std::vector<double> & uyuz,
312  const std::vector<double> & uzuz,
313  const MPI_Comm comm = MPI_COMM_WORLD);
314 
316  std::vector<double> & energy_transfer,
317  const dataset & source_data,
318  const std::vector<double> & ulon,
319  const std::vector<double> & ulat,
320  const std::vector<double> & ulon_ulon,
321  const std::vector<double> & ulon_ulat,
322  const std::vector<double> & ulat_ulat,
323  const MPI_Comm comm = MPI_COMM_WORLD
324  );
325 
326 void compute_Z(
327  std::vector<double> & enstrophy_transfer,
328  const dataset & source_data,
329  const std::vector<double> & ux,
330  const std::vector<double> & uy,
331  const std::vector<double> & uz,
332  const std::vector<double> & coarse_vort_r,
333  const std::vector<double> & vort_ux,
334  const std::vector<double> & vort_uy,
335  const std::vector<double> & vort_uz,
336  const MPI_Comm comm = MPI_COMM_WORLD);
337 
338 void compute_Lambda_rotational(
339  std::vector<double> & Lambda_rot,
340  const std::vector<double> & coarse_vort_r,
341  const std::vector<double> & coarse_vort_lon,
342  const std::vector<double> & coarse_vort_lat,
343  const std::vector<double> & coarse_rho,
344  const std::vector<double> & coarse_p,
345  const int Ntime, const int Ndepth, const int Nlat, const int Nlon,
346  const std::vector<double> & longitude,
347  const std::vector<double> & latitude,
348  const std::vector<bool> & mask,
349  const double scale_factor
350  );
351 
352 
353 void compute_Lambda_full(
354  std::vector<double> & Lambda,
355  const std::vector<double> & coarse_u_r,
356  const std::vector<double> & coarse_u_lon,
357  const std::vector<double> & coarse_u_lat,
358  const std::vector<double> & tilde_u_r,
359  const std::vector<double> & tilde_u_lon,
360  const std::vector<double> & tilde_u_lat,
361  const std::vector<double> & coarse_p,
362  const int Ntime,
363  const int Ndepth,
364  const int Nlat,
365  const int Nlon,
366  const std::vector<double> & longitude,
367  const std::vector<double> & latitude,
368  const std::vector<bool> & mask
369  );
370 
371 void compute_Lambda_nonlin_model(
372  std::vector<double> & Lambda_nonlin,
373  const std::vector<double> & coarse_u_r,
374  const std::vector<double> & coarse_u_lon,
375  const std::vector<double> & coarse_u_lat,
376  const std::vector<double> & coarse_rho,
377  const std::vector<double> & coarse_p,
378  const int Ntime, const int Ndepth, const int Nlat, const int Nlon,
379  const std::vector<double> & longitude,
380  const std::vector<double> & latitude,
381  const std::vector<bool> & mask,
382  const double scale_factor
383  );
384 
386  const double p,
387  const double theta);
388 
389 double equation_of_state(
390  const double T,
391  const double S,
392  const double p);
393 
395  std::vector<double> & div_J,
396  const dataset & source_data,
397  const std::vector<double> & u_x,
398  const std::vector<double> & u_y,
399  const std::vector<double> & u_z,
400  const std::vector<double> & uxux,
401  const std::vector<double> & uxuy,
402  const std::vector<double> & uxuz,
403  const std::vector<double> & uyuy,
404  const std::vector<double> & uyuz,
405  const std::vector<double> & uzuz,
406  const std::vector<double> & coarse_p,
407  const MPI_Comm comm = MPI_COMM_WORLD
408  );
409 
411  std::vector<double> & means,
412  const std::vector<double> & field,
413  const std::vector<double> & areas,
414  const int Ntime,
415  const int Ndepth,
416  const int Nlat,
417  const int Nlon,
418  const std::vector<bool> & mask);
419 
420 void get_lat_bounds(
421  int & LAT_lb,
422  int & LAT_ub,
423  const std::vector<double> & latitude,
424  const int Ilat,
425  const double scale);
426 
427 void get_lon_bounds(
428  int & LON_lb,
429  int & LON_ub,
430  const std::vector<double> & longitude,
431  const int Ilon,
432  const double centre_lat,
433  const double curr_lat,
434  const double scale);
435 
436 void print_compile_info(
437  const std::vector<double> * scales = NULL);
438 
439 int get_omp_chunksize(const int Nlat, const int Nlon);
440 
441 
443  std::vector<double> & longitude,
444  std::vector<double> & latitude
445  );
446 
447 void mask_out_pole(
448  const std::vector<double> & latitude,
449  std::vector<bool> & mask,
450  const int Ntime,
451  const int Ndepth,
452  const int Nlat,
453  const int Nlon
454  );
455 
456 
457 void roll_field(
458  std::vector<double> & field_to_roll,
459  const std::string dimension,
460  const int roll_count,
461  const int Ntime,
462  const int Ndepth,
463  const int Nlat,
464  const int Nlon
465  );
466 
467 
468 // Extending to the poles
469 
470 void extend_latitude_to_poles(
471  const std::vector<double> & original_latitude,
472  std::vector<double> & extended_latitude,
473  int & orig_Ilat_start,
474  const bool IS_DEGREES = false,
475  const MPI_Comm comm = MPI_COMM_WORLD
476  );
477 
478 void extend_field_to_poles(
479  std::vector<double> & array_to_extend,
480  const dataset & source_data,
481  const std::vector<double> & extended_latitude,
482  const int Ilat_start
483  );
484 
485 void extend_mask_to_poles(
486  std::vector<bool> & mask_to_extend,
487  const dataset & source_data,
488  const std::vector<double> & extended_latitude,
489  const int Ilat_start,
490  const bool extend_val = constants::FILTER_OVER_LAND
491  );
492 
500 
501  public:
503  Timing_Records();
504 
506  void reset();
507 
513  void add_to_record( const double delta, const std::string record_name );
514 
516  void print() const;
517 
518  private:
524  std::map< std::string, double > time_records;
525 };
526 
527 
537 class InputParser {
538 
539  public:
540  InputParser (int &argc, char **argv);
541 
545  const std::string getCmdOption(
546  const std::string &option,
547  const std::string &default_value = "",
548  const bool help = false,
549  const std::string &description = ""
550  ) const;
551 
555  bool cmdOptionExists(const std::string &option) const;
556 
561  void getFilterScales(
562  std::vector<double> &filter_scales,
563  const std::string &argname,
564  const bool help = false
565  ) const;
566 
571  void getListofStrings(
572  std::vector<std::string> &list_of_strings,
573  const std::string &argname,
574  const bool help = false,
575  const std::string &description = ""
576  ) const;
577 
578  private:
579  std::vector <std::string> tokens;
580 
581 };
582 
586 bool string_to_bool( std::string str );
587 
588 void print_header_info( );
589 
590 #endif
void KE_from_vels(std::vector< double > &KE, std::vector< double > *u1, std::vector< double > *u2, std::vector< double > *u3, const std::vector< bool > &mask, const double rho0=constants::rho0)
Compute (local) KE density from the provided velocities.
Definition: KE_from_vels.cpp:16
void Index1to4(const size_t index, int &Itime, int &Idepth, int &Ilat, int &Ilon, const int &Ntime, const int &Ndepth, const int &Nlat, const int &Nlon)
Convenience tool to convert logical index to physical index (time, depth, lat, lon).
Definition: Index1to4.cpp:18
void compute_div_transport(std::vector< double > &div_J, const dataset &source_data, const std::vector< double > &u_x, const std::vector< double > &u_y, const std::vector< double > &u_z, const std::vector< double > &uxux, const std::vector< double > &uxuy, const std::vector< double > &uxuz, const std::vector< double > &uyuy, const std::vector< double > &uyuz, const std::vector< double > &uzuz, const std::vector< double > &coarse_p, const MPI_Comm comm=MPI_COMM_WORLD)
Compute KE transport caused by div(J)
Definition: compute_div_transport.cpp:92
const double rho0
Mean fluid density.
Definition: constants.hpp:76
void vel_Cart_to_Spher_at_point(double &u_r, double &u_lon, double &u_lat, const double u_x, const double u_y, const double u_z, const double lon, const double lat)
Convert single Cartesian velocity to spherical velocity.
Definition: vel_Cart_to_Spher_at_point.cpp:28
void get_lon_bounds(int &LON_lb, int &LON_ub, const std::vector< double > &longitude, const int Ilon, const double centre_lat, const double curr_lat, const double scale)
Get longitude integratation bounds for a specific latitude.
Definition: get_lon_bounds.cpp:22
void compute_Pi_shift_deriv(std::vector< double > &energy_transfer, const dataset &source_data, const std::vector< double > &ux, const std::vector< double > &uy, const std::vector< double > &uz, const std::vector< double > &uxux, const std::vector< double > &uxuy, const std::vector< double > &uxuz, const std::vector< double > &uyuy, const std::vector< double > &uyuz, const std::vector< double > &uzuz, const MPI_Comm comm=MPI_COMM_WORLD)
Compute the energy transfer through the current filter scale.
Definition: compute_Pi_shift_deriv.cpp:21
void compute_Z(std::vector< double > &enstrophy_transfer, const dataset &source_data, const std::vector< double > &ux, const std::vector< double > &uy, const std::vector< double > &uz, const std::vector< double > &coarse_vort_r, const std::vector< double > &vort_ux, const std::vector< double > &vort_uy, const std::vector< double > &vort_uz, const MPI_Comm comm=MPI_COMM_WORLD)
Compute the enstrophy transfer through the current filter scale.
Definition: compute_Z.cpp:25
size_t Index(const int Itime, const int Idepth, const int Ilat, const int Ilon, const int Ntime, const int Ndepth, const int Nlat, const int Nlon)
Convenience tool to convert physical index (time, depth, lat, lon) to a logical index.
Definition: Index.cpp:19
void compute_vorticity(std::vector< double > &vort_r, std::vector< double > &vort_lon, std::vector< double > &vort_lat, std::vector< double > &vel_div, std::vector< double > &OkuboWeiss, const dataset &source_data, const std::vector< double > &u_r, const std::vector< double > &u_lon, const std::vector< double > &u_lat, const MPI_Comm comm=MPI_COMM_WORLD)
Wrapper for computing vorticity.
Definition: compute_vorticity.cpp:22
double depotential_temperature(const double p, const double theta)
Convert potential temperature to actual temperature following equation 1.154a from Vallis (p...
Definition: depotential_temperature.cpp:13
void get_lat_bounds(int &LAT_lb, int &LAT_ub, const std::vector< double > &latitude, const int Ilat, const double scale)
Get latitude bounds for coarse-graining.
Definition: get_lat_bounds.cpp:19
double kernel(const double distance, const double scale)
Primary kernel function coarse-graining procedure (G in publications)
Definition: kernel.cpp:30
void mask_out_pole(const std::vector< double > &latitude, std::vector< bool > &mask, const int Ntime, const int Ndepth, const int Nlat, const int Nlon)
If the grid includes the poles (lat = 90 degrees), then mask it out.
Definition: mask_out_pole.cpp:21
void filtering(const dataset &source_data, const std::vector< double > &scales, const MPI_Comm comm=MPI_COMM_WORLD)
Main filtering driver.
Definition: filtering.cpp:23
void compute_vorticity_at_point(double &vort_r_tmp, double &vort_lon_tmp, double &vort_lat_tmp, double &div_tmp, double &OkuboWeiss_tmp, const dataset &source_data, const std::vector< double > &u_r, const std::vector< double > &u_lon, const std::vector< double > &u_lat, const int Itime, const int Idepth, const int Ilat, const int Ilon)
Compute the vorticity, divergnce, and OkuboWeiss at a point.
Definition: compute_vorticity_at_point.cpp:24
void roll_field(std::vector< double > &field_to_roll, const std::string dimension, const int roll_count, const int Ntime, const int Ndepth, const int Nlat, const int Nlon)
Roll field along dimension.
Definition: roll_field.cpp:19
void vel_Cart_to_Spher(std::vector< double > &u_r, std::vector< double > &u_lon, std::vector< double > &u_lat, const std::vector< double > &u_x, const std::vector< double > &u_y, const std::vector< double > &u_z, const dataset &source_data)
Wrapper that applies vel_Spher_to_Cart_at_point to every point in the domain.
Definition: vel_Cart_to_Spher.cpp:13
Class to store main variables.
Definition: functions.hpp:24
void compute_local_kernel(std::vector< double > &local_kernel, const double scale, const dataset &source_data, const int Ilat, const int Ilon, const int LAT_lb, const int LAT_ub)
Compute an array of the kernel values from a given reference point to every other point in the domain...
Definition: compute_local_kernel.cpp:22
Class to process command-line arguments.
Definition: functions.hpp:537
void convert_coordinates(std::vector< double > &longitude, std::vector< double > &latitude)
Apply degree->radian conversion, if necessary. Applied in-place.
Definition: convert_coordinates.cpp:19
void compute_spatial_average(std::vector< double > &means, const std::vector< double > &field, const std::vector< double > &areas, const int Ntime, const int Ndepth, const int Nlat, const int Nlon, const std::vector< bool > &mask)
Given a field, compute the horizontal average.
Definition: compute_spatial_average.cpp:21
void filtering_helmholtz(const dataset &source_data, const std::vector< double > &scales, const MPI_Comm comm=MPI_COMM_WORLD)
Main filtering driver for Helmholtz decomposed data.
Definition: filtering_helmholtz.cpp:24
double kernel_alpha(void)
Compute alpha value for kernel (for baroclinic transfer)
Definition: kernel_alpha.cpp:12
void apply_filter_at_point(std::vector< double *> &coarse_val, const std::vector< const std::vector< double > *> &fields, const dataset &source_data, const int Itime, const int Idepth, const int Ilat, const int Ilon, const int LAT_lb, const int LAT_ub, const double scale, const std::vector< bool > &use_mask, const std::vector< double > &local_kernel, const std::vector< double > *weight=NULL)
Compute filtered field at a single point.
Definition: apply_filter_at_point.cpp:25
Provide namespace for global constants (physical and computational).
void compute_Pi_Helmholtz(std::vector< double > &energy_transfer, const dataset &source_data, const std::vector< double > &ulon, const std::vector< double > &ulat, const std::vector< double > &ulon_ulon, const std::vector< double > &ulon_ulat, const std::vector< double > &ulat_ulat, const MPI_Comm comm=MPI_COMM_WORLD)
Compute the energy transfer through the current filter scale.
Definition: compute_Pi_Helmholtz.cpp:22
Class for storing internal timings.
Definition: functions.hpp:499
double equation_of_state(const double T, const double S, const double p)
UNESCO 1981 equation of state.
Definition: equation_of_state.cpp:18
int get_omp_chunksize(const int Nlat, const int Nlon)
Compute openmp chunk size for OMP for loops.
Definition: get_omp_chunksize.cpp:18
void vel_Spher_to_Cart(std::vector< double > &u_x, std::vector< double > &u_y, std::vector< double > &u_z, const std::vector< double > &u_r, const std::vector< double > &u_lon, const std::vector< double > &u_lat, const dataset &source_data)
Wrapper that applies vel_Spher_to_Cart_at_point to every point in the domain.
Definition: vel_Spher_to_Cart.cpp:13
void vel_Spher_to_Cart_at_point(double &u_x, double &u_y, double &u_z, const double u_r, const double u_lon, const double u_lat, const double lon, const double lat)
Convert single spherical velocity to Cartesian velocity.
Definition: vel_Spher_to_Cart_at_point.cpp:28
bool string_to_bool(std::string str)
Convert string to boolean.
Definition: string_to_bool.cpp:12
double distance(const double lon1, const double lat1, const double lon2, const double lat2, const double Llon=0, const double Llat=0)
Compute the distance (in metres) between two points in the domain.
Definition: distance.cpp:25
const bool FILTER_OVER_LAND
Boolean to indicate whether or not land values should be filled in with coarse-grained results...
Definition: constants.hpp:127
void apply_filter_at_point_for_quadratics(double &uxux_tmp, double &uxuy_tmp, double &uxuz_tmp, double &uyuy_tmp, double &uyuz_tmp, double &uzuz_tmp, double &vort_ux_tmp, double &vort_uy_tmp, double &vort_uz_tmp, const std::vector< double > &u_x, const std::vector< double > &u_y, const std::vector< double > &u_z, const std::vector< double > &vort_r, const dataset &source_data, const int Itime, const int Idepth, const int Ilat, const int Ilon, const int LAT_lb, const int LAT_ub, const double scale, const std::vector< double > &local_kernel)
Compute filtered quadratic velocities at a single point.
Definition: apply_filter_at_point_for_quadratics.cpp:34
void print_compile_info(const std::vector< double > *scales=NULL)
Print summary of compile-time variables.
Definition: print_compile_info.cpp:16
void compute_Pi(std::vector< double > &energy_transfer, const dataset &source_data, const std::vector< double > &ux, const std::vector< double > &uy, const std::vector< double > &uz, const std::vector< double > &uxux, const std::vector< double > &uxuy, const std::vector< double > &uxuz, const std::vector< double > &uyuy, const std::vector< double > &uyuz, const std::vector< double > &uzuz, const MPI_Comm comm=MPI_COMM_WORLD)
Compute the energy transfer through the current filter scale.
Definition: compute_Pi.cpp:21
void compute_areas(std::vector< double > &areas, const std::vector< double > &longitude, const std::vector< double > &latitude)
Compute the area of each computational cell.
Definition: compute_areas.cpp:19