SolidTides.cpp

Go to the documentation of this file.
00001 #pragma ident "$Id: SolidTides.cpp 1161 2008-03-27 17:16:22Z ckiesch $"
00002 
00008 //============================================================================
00009 //
00010 //  This file is part of GPSTk, the GPS Toolkit.
00011 //
00012 //  The GPSTk is free software; you can redistribute it and/or modify
00013 //  it under the terms of the GNU Lesser General Public License as published
00014 //  by the Free Software Foundation; either version 2.1 of the License, or
00015 //  any later version.
00016 //
00017 //  The GPSTk is distributed in the hope that it will be useful,
00018 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020 //  GNU Lesser General Public License for more details.
00021 //
00022 //  You should have received a copy of the GNU Lesser General Public
00023 //  License along with GPSTk; if not, write to the Free Software Foundation,
00024 //  Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025 //  
00026 //  Dagoberto Salazar - gAGE ( http://www.gage.es ). 2007
00027 //
00028 //============================================================================
00029 
00030 
00031 #include "SolidTides.hpp"
00032 
00033 
00034 namespace gpstk
00035 {
00036 
00037 
00038       // Love numbers
00039    const double SolidTides::H_LOVE(0.609), SolidTides::L_LOVE(0.0852);
00040 
00041       // Phase lag. Assumed as zero here because no phase lag has been 
00042       // detected so far.
00043       // const double SolidTides::PH_LAG(0.0);
00044 
00045 
00046       /* Returns the effect of solid Earth tides (meters) at the given
00047        * position and epoch, in the Up-East-Down (UEN) reference frame.
00048        *
00049        * @param[in] t Epoch to look up
00050        * @param[in] p Position of interest
00051        *
00052        * @return a Triple with the solid tidal effect, in meters and in
00053        * the UED reference frame.
00054        *
00055        * @throw InvalidRequest If the request can not be completed for any
00056        * reason, this is thrown. The text may have additional information
00057        * as to why the request failed.
00058        */
00059    Triple SolidTides::getSolidTide(const DayTime& t,
00060                                    const Position& p) const
00061       throw(InvalidRequest)
00062    {
00063 
00064          // We will store here the results
00065       Triple res;
00066 
00067          // Objects to compute Sun and Moon positions
00068       SunPosition  sunPosition;
00069       MoonPosition moonPosition;
00070 
00071 
00072       try
00073       {
00074 
00075             // Variables to hold Sun and Moon positions
00076          Triple sunPos(sunPosition.getPosition(t));
00077          Triple moonPos(moonPosition.getPosition(t));
00078 
00079 
00080             // Compute the factors for the Sun
00081          double rpRs( p.X()*sunPos.theArray[0] + 
00082                       p.Y()*sunPos.theArray[1] + 
00083                       p.Z()*sunPos.theArray[2]);
00084 
00085          double Rs2(sunPos.theArray[0]*sunPos.theArray[0] +
00086                     sunPos.theArray[1]*sunPos.theArray[1] +
00087                     sunPos.theArray[2]*sunPos.theArray[2]);
00088 
00089          double rp2( p.X()*p.X() + p.Y()*p.Y() + p.Z()*p.Z() );
00090 
00091          double xy2p( p.X()*p.X() + p.Y()*p.Y() );
00092          double sqxy2p( std::sqrt(xy2p) );
00093 
00094          double sqRs2(std::sqrt(Rs2));
00095 
00096          double fac_s( 3.0*MU_SUN*rp2/(sqRs2*sqRs2*sqRs2*sqRs2*sqRs2) );
00097 
00098          double g1sun( fac_s*(rpRs*rpRs/2.0 - rp2*Rs2/6.0) );
00099 
00100          double g2sun( fac_s * rpRs * (sunPos.theArray[1]*p.X() -
00101                        sunPos.theArray[0]*p.Y()) * std::sqrt(rp2)/sqxy2p );
00102 
00103          double g3sun( fac_s * rpRs * ( sqxy2p* sunPos.theArray[2] -
00104                        p.Z()/sqxy2p * (p.X()*sunPos.theArray[0] +
00105                        p.Y()*sunPos.theArray[1]) ) );
00106 
00107 
00108             // Compute the factors for the Moon
00109          double rpRm( p.X()*moonPos.theArray[0] + 
00110                       p.Y()*moonPos.theArray[1] + 
00111                       p.Z()*moonPos.theArray[2]);
00112 
00113          double Rm2(moonPos.theArray[0]*moonPos.theArray[0] +
00114                     moonPos.theArray[1]*moonPos.theArray[1] +
00115                     moonPos.theArray[2]*moonPos.theArray[2]);
00116 
00117          double sqRm2(std::sqrt(Rm2));
00118 
00119          double fac_m( 3.0*MU_MOON*rp2/(sqRm2*sqRm2*sqRm2*sqRm2*sqRm2) );
00120 
00121          double g1moon( fac_m*(rpRm*rpRm/2.0 - rp2*Rm2/6.0) );
00122 
00123          double g2moon( fac_m * rpRm * (moonPos.theArray[1]*p.X() -
00124                         moonPos.theArray[0]*p.Y()) * std::sqrt(rp2)/sqxy2p );
00125 
00126          double g3moon( fac_m * rpRm * ( sqxy2p* moonPos.theArray[2] -
00127                         p.Z()/sqxy2p * (p.X()*moonPos.theArray[0] +
00128                         p.Y()*moonPos.theArray[1]) ) );
00129 
00130             // Effects due to the Sun
00131          double delta_sun1(H_LOVE*g1sun);
00132          double delta_sun2(L_LOVE*g2sun);
00133          double delta_sun3(L_LOVE*g3sun);
00134 
00135             // Effects due to the Moon
00136          double delta_moon1(H_LOVE*g1moon);
00137          double delta_moon2(L_LOVE*g2moon);
00138          double delta_moon3(L_LOVE*g3moon);
00139 
00140             // Combined effect
00141          res.theArray[0] = delta_sun1 + delta_moon1;
00142          res.theArray[1] = delta_sun2 + delta_moon2;
00143          res.theArray[2] = delta_sun3 + delta_moon3;
00144 
00145       } // End of try block
00146       catch(InvalidRequest& ir)
00147       {
00148          GPSTK_RETHROW(ir);
00149       }
00150 
00151       return res;
00152 
00153    } // End SolidTides::getSolidTide
00154 
00155 
00156 } // end namespace gpstk

Generated on Wed Feb 8 03:31:02 2012 for GPS ToolKit Software Library by  doxygen 1.3.9.1