USML
data_grid_mackenzie.h
1 
5 #ifndef USML_OCEAN_DATA_GRID_MACKENZIE_H
6 #define USML_OCEAN_DATA_GRID_MACKENZIE_H
7 
8 #include <usml/types/data_grid.h>
9 
10 namespace usml {
11 namespace ocean {
12 
15 
59 
60  public:
61 
62  //**************************************************
63  // initialization
64 
73  const data_grid<double,3>* temperature,
74  const data_grid<double,3>* salinity )
75  {
76  data_grid<double,3>* ssp = new data_grid<double,3>(*temperature,false) ;
80 
81  unsigned index[3] ;
82  for ( index[0]=0 ; index[0] < temperature->axis(0)->size() ; ++index[0] ) {
83  for ( index[1]=0 ; index[1] < temperature->axis(1)->size() ; ++index[1] ) {
84  for ( index[2]=0 ; index[2] < temperature->axis(2)->size() ; ++index[2] ) {
85 
86  // extract depth, temperature, and salinity at this point
87 
88  double D = wposition::earth_radius -
89  (*temperature->axis(0))[ index[0] ] ;
90  double T = temperature->data( index ) ;
91  double S = salinity->data( index ) ;
92 
93  // compute sound speed
94 
95  double c = 1448.96 + 4.591 * T - 5.304e-2 * T*T
96  + 2.374e-4 * T*T*T
97  + ( 1.340 - 1.025e-2 * T ) * ( S - 35.0 )
98  + 1.630e-2 * D + 1.675e-7 * D*D
99  - 7.139e-13 * T * D*D*D ;
100 
101  ssp->data( index, c ) ;
102  }
103  }
104  }
105  delete temperature ;
106  delete salinity ;
107  return ssp ;
108  }
109 
110 };
111 
113 } // end of namespace ocean
114 } // end of namespace usml
115 
116 #endif
static double earth_radius
Local radius of curvature in the area of operations.
Definition: wposition.h:100
const seq_vector * axis(int unsigned dim) const
Extract a reference to one of the axes.
Definition: data_grid.h:92
static data_grid< double, 3 > * construct(const data_grid< double, 3 > *temperature, const data_grid< double, 3 > *salinity)
Define sound speed profile using temperature and salinity.
Definition: data_grid_mackenzie.h:72
enum GRID_INTERP_TYPE interp_type(int unsigned dimension) const
Retrieve the type of interpolation for one of the axes.
Definition: data_grid.h:135
Definition: data_grid.h:23
Implements the Mackenzie model for estimating the speed of sound from the ocean's temperature and sal...
Definition: data_grid_mackenzie.h:58
size_type size() const
Returns the number of elements in this sequence.
Definition: seq_vector.h:138
Definition: data_grid.h:24
DATA_TYPE data(const unsigned *index) const
Extract a data value at a specific combination of indices.
Definition: data_grid.h:102