OceanLoading.cpp
Go to the documentation of this file.
1 //==============================================================================
2 //
3 // This file is part of GNSSTk, the ARL:UT GNSS Toolkit.
4 //
5 // The GNSSTk is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published
7 // by the Free Software Foundation; either version 3.0 of the License, or
8 // any later version.
9 //
10 // The GNSSTk is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with GNSSTk; if not, write to the Free Software Foundation,
17 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
18 //
19 // This software was developed by Applied Research Laboratories at the
20 // University of Texas at Austin.
21 // Copyright 2004-2022, The Board of Regents of The University of Texas System
22 //
23 //==============================================================================
24 
25 //==============================================================================
26 //
27 // This software was developed by Applied Research Laboratories at the
28 // University of Texas at Austin, under contract to an agency or agencies
29 // within the U.S. Department of Defense. The U.S. Government retains all
30 // rights to use, duplicate, distribute, disclose, or release this software.
31 //
32 // Pursuant to DoD Directive 523024
33 //
34 // DISTRIBUTION STATEMENT A: This software has been approved for public
35 // release, distribution is unlimited.
36 //
37 //==============================================================================
38 
45 #include "OceanLoading.hpp"
46 #include "YDSTime.hpp"
47 
48 using namespace std;
49 
50 namespace gnsstk
51 {
52 
53 
54  /* Returns the effect of ocean tides loading (meters) at the given
55  * station and epoch, in the Up-East-North (UEN) reference frame.
56  *
57  * @param name Station name (case is NOT relevant).
58  * @param time Epoch to look up
59  *
60  * @return a Triple with the ocean tidas loading effect, in meters and
61  * in the UEN reference frame.
62  *
63  * @throw InvalidRequest If the request can not be completed for any
64  * reason, this is thrown. The text may have additional information
65  * about the reason the request failed.
66  */
67  Triple OceanLoading::getOceanLoading( const string& name,
68  const CommonTime& t )
69  {
70 
71  const int NUM_COMPONENTS = 3;
72  const int NUM_HARMONICS = 11;
73 
74  Matrix<double> harmonics(6,11,0.0);
75 
76  // Get harmonics data from file
77  harmonics = blqData.getTideHarmonics(name);
78 
79  Vector<double> arguments(11,0.0);
80 
81  // Compute arguments
82  arguments = getArg(t);
83 
84  Triple oLoading;
85 
86  for(int i=0; i<NUM_COMPONENTS; i++)
87  {
88 
89  double temp(0.0);
90  for(int k=0; k<NUM_HARMONICS; k++)
91  {
92 
93  temp += harmonics(i,k) *
94  std::cos( arguments(k) - harmonics( (i+3),k)*DEG_TO_RAD );
95 
96  }
97 
98  // This Triple is in Up, West, South reference frame
99  oLoading[i] = temp;
100 
101  } // End of 'for(int i=0; i<NUM_COMPONENTS; i++)'
102 
103  // Let's change Triple to Up, East, North [UEN] reference frame
104  oLoading[1] = -oLoading[1];
105  oLoading[2] = -oLoading[2];
106 
107  return oLoading;
108 
109  } // End of method 'OceanLoading::getOceanLoading()'
110 
111 
112 
113  /* Sets the name of BLQ file containing ocean tides harmonics data.
114  *
115  * @param name Name of BLQ tides harmonics data file.
116  */
117  OceanLoading& OceanLoading::setFilename(const string& name)
118  {
119 
120  fileData = name;
121 
122  blqData.open(fileData);
123 
124  return (*this);
125 
126  } // End of meters 'OceanLoading::setFilename()'
127 
128 
129 
130  /* Compute the value of the corresponding astronomical arguments,
131  * in radians. This routine is based on IERS routine ARG.f.
132  *
133  * @param time Epoch of interest
134  *
135  * @return A Vector<double> of 11 elements with the corresponding
136  * astronomical arguments to be used in ocean loading model.
137  */
138  Vector<double> OceanLoading::getArg(const CommonTime& time)
139  {
140 
141  const int NUM_HARMONICS = 11;
142 
143  // Let's store some important values
144  Vector<double> sig(NUM_HARMONICS,0.0);
145  sig(0) = 1.40519e-4;
146  sig(1) = 1.45444e-4;
147  sig(2) = 1.37880e-4;
148  sig(3) = 1.45842e-4;
149  sig(4) = 0.72921e-4;
150  sig(5) = 0.67598e-4;
151  sig(6) = 0.72523e-4;
152  sig(7) = 0.64959e-4;
153  sig(8) = 0.053234e-4;
154  sig(9) = 0.026392e-4;
155  sig(10)= 0.003982e-4;
156 
157  Matrix<double> angfac(4,NUM_HARMONICS,0.0);
158  angfac(0,0) = 2.0; angfac(1,0) = -2.0;
159  angfac(2,0) = 0.0; angfac(3,0) = 0.0;
160  angfac(0,1) = 0.0; angfac(1,1) = 0.0;
161  angfac(2,1) = 0.0; angfac(3,1) = 0.0;
162  angfac(0,2) = 2.0; angfac(1,2) = -3.0;
163  angfac(2,2) = 1.0; angfac(3,2) = 0.0;
164  angfac(0,3) = 2.0; angfac(1,3) = 0.0;
165  angfac(2,3) = 0.0; angfac(3,3) = 0.0;
166  angfac(0,4) = 1.0; angfac(1,4) = 0.0;
167  angfac(2,4) = 0.0; angfac(3,4) = 0.25;
168  angfac(0,5) = 1.0; angfac(1,5) = -2.0;
169  angfac(2,5) = 0.0; angfac(3,5) = -0.25;
170  angfac(0,6) = -1.0; angfac(1,6) = 0.0;
171  angfac(2,6) = 0.0; angfac(3,6) = -0.25;
172  angfac(0,7) = 1.0; angfac(1,7) = -3.0;
173  angfac(2,7) = 1.0; angfac(3,7) = -0.25;
174  angfac(0,8) = 0.0; angfac(1,8) = 2.0;
175  angfac(2,8) = 0.0; angfac(3,8) = 0.0;
176  angfac(0,9) = 0.0; angfac(1,9) = 1.0;
177  angfac(2,9) = -1.0; angfac(3,9) = 0.0;
178  angfac(0,10)= 2.0; angfac(1,10)= 0.0;
179  angfac(2,10)= 0.0; angfac(3,10)= 0.0;
180 
181 
182  Vector<double> arguments(NUM_HARMONICS,0.0);
183 
184  // Get day of year
185  int year(static_cast<YDSTime>(time).year);
186 
187  // Fractional part of day, in seconds
188  double fday(static_cast<YDSTime>(time).sod);
189 
190  // Compute time
191  double d(static_cast<YDSTime>(time).doy+365.0*(year-1975.0)+floor((year-1973.0)/4.0));
192  double t((27392.500528+1.000000035*d)/36525.0);
193 
194  // Mean longitude of Sun at beginning of day
195  double H0((279.69668+(36000.768930485+3.03e-4*t)*t)*DEG_TO_RAD);
196 
197  // Mean longitude of Moon at beginning of day
198  double S0( (((1.9e-6*t - 0.001133)*t +
199  481267.88314137)*t + 270.434358)*DEG_TO_RAD );
200 
201  // Mean longitude of lunar perigee at beginning of day
202  double P0( (((-1.2e-5*t - 0.010325)*t +
203  4069.0340329577)*t + 334.329653)*DEG_TO_RAD );
204 
205  for(int k=0; k<NUM_HARMONICS; k++)
206  {
207 
208  double temp( sig(k)*fday + angfac(0,k)*H0 +
209  angfac(1,k)*S0 + angfac(2,k)*P0 + angfac(3,k)*TWO_PI );
210 
211  arguments(k) = fmod(temp,TWO_PI);
212 
213  if (arguments(k) < 0.0)
214  {
215  arguments(k) = arguments(k) + TWO_PI;
216  }
217 
218  } // End of 'for(int k=0; k<NUM_HARMONICS; k++)'
219 
220  return arguments;
221 
222  } // End of method 'OceanLoading::getArg()'
223 
224 
225 
226 } // End of namespace gnsstk
OceanLoading.hpp
YDSTime.hpp
example6.year
year
Definition: example6.py:64
gnsstk::YDSTime
Definition: YDSTime.hpp:58
gnsstk::TWO_PI
const double TWO_PI
GPS value of PI*2.
Definition: GNSSconstants.hpp:68
gnsstk::Triple
Definition: Triple.hpp:68
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
example4.temp
temp
Definition: example4.py:35
gnsstk::Matrix< double >
example4.time
time
Definition: example4.py:103
gnsstk::CommonTime
Definition: CommonTime.hpp:84
std::cos
double cos(gnsstk::Angle x)
Definition: Angle.hpp:146
gnsstk::Vector< double >
example6.sod
sod
Definition: example6.py:103
gnsstk::OceanLoading
Definition: OceanLoading.hpp:92
std
Definition: Angle.hpp:142
gnsstk::DEG_TO_RAD
static const double DEG_TO_RAD
Conversion Factor from degrees to radians (units: degrees^-1)
Definition: GNSSconstants.hpp:76


gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:40