Tudat/Astrodynamics/Gravitation/basicSolidBodyTideGravityFieldVariations.cpp
//! Function to calculate solid body tide gravity field variations due to single body at a set of degrees and orders
//! from perturbing body's Cartesian state.

Function to calculate solid body tide gravity field variations due to single body at a set of degrees and orders
from perturbing body's Cartesian state.
Function to calculate solid body tide gravity field variations due to single body at a set of degrees and orders from perturbing body ' s Cartesian state .
std::pair< Eigen::MatrixXd, Eigen::MatrixXd > calculateSolidBodyTideSingleCoefficientSetCorrectionFromAmplitude(
        const std::vector< std::vector< std::complex< double > > > loveNumbers, const double massRatio,
        const double referenceRadius, const Eigen::Vector3d& relativeBodyFixedPosition,
        const int maximumDegree, const int maximumOrder )
{
    Eigen::MatrixXd cosineCorrections = Eigen::MatrixXd::Zero( maximumDegree + 1, maximumOrder + 1 );
    Eigen::MatrixXd sineCorrections = Eigen::MatrixXd::Zero( maximumDegree + 1, maximumOrder + 1 );
    std::complex< double > currentCorrections;
    for( int n = 2; n <= maximumDegree; n++ )
    {
        for( int m = 0; ( m <= maximumOrder && m <= n ); m++ )
        {
            currentCorrections = calculateSolidBodyTideSingleCoefficientSetCorrectionFromAmplitude(
                       loveNumbers.at( n - 2 ).at( m ), massRatio, referenceRadius, relativeBodyFixedPosition, n, m );
            cosineCorrections( n, m ) = currentCorrections.real( );
            if( m > 0 )
            {
                sineCorrections( n, m ) = -currentCorrections.imag( );
            }
        }
    }
    return std::make_pair( cosineCorrections, sineCorrections );
}
std :: pair < Eigen :: MatrixXd , Eigen :: MatrixXd > calculateSolidBodyTideSingleCoefficientSetCorrectionFromAmplitude ( const std :: vector < std :: vector < std :: complex < double > > > loveNumbers , const double massRatio , const double referenceRadius , const Eigen :: Vector3d & relativeBodyFixedPosition , const int maximumDegree , const int maximumOrder ) { Eigen :: MatrixXd cosineCorrections = Eigen :: MatrixXd :: Zero ( maximumDegree + 1 , maximumOrder + 1 ) ; Eigen :: MatrixXd sineCorrections = Eigen :: MatrixXd :: Zero ( maximumDegree + 1 , maximumOrder + 1 ) ; std :: complex < double > currentCorrections ; for ( int n = 2 ; n <= maximumDegree ; n ++ ) { for ( int m = 0 ; ( m <= maximumOrder && m <= n ) ; m ++ ) { currentCorrections = calculateSolidBodyTideSingleCoefficientSetCorrectionFromAmplitude ( loveNumbers . at ( n - 2 ) . at ( m ) , massRatio , referenceRadius , relativeBodyFixedPosition , n , m ) ; cosineCorrections ( n , m ) = currentCorrections . real ( ) ; if ( m > 0 ) { sineCorrections ( n , m ) = - currentCorrections . imag ( ) ; } } } return std :: make_pair ( cosineCorrections , sineCorrections ) ; }
Function to calculate solid body tide gravity field variations due to single body at a set of degrees and orders
from perturbing body's Cartesian state.
Function to calculate solid body tide gravity field variations due to single body at a set of degrees and orders from perturbing body ' s Cartesian state .
// Initialize results.
 // Iterate over all requested degrees and orders
 // Calculate and set corrections at current degree and order.
