Tudat/Astrodynamics/OrbitDetermination/AccelerationPartials/sphericalHarmonicAccelerationPartial.cpp
//! Function for updating the partial object to current state and time.
Function for updating the partial object to current state and time.
Function for updating the partial object to current state and time .
void SphericalHarmonicsGravityPartial::update( const double currentTime )
{
    using namespace tudat::coordinate_conversions;
    if( !( currentTime_ == currentTime ) )
    {
        updateFunction_( currentTime );
        Eigen::Matrix3d currentRotationToBodyFixedFrame_ = fromBodyFixedToIntegrationFrameRotation_( ).inverse( );
        bodyFixedPosition_ = currentRotationToBodyFixedFrame_ *
                ( positionFunctionOfAcceleratedBody_( ) - positionFunctionOfAcceleratingBody_( ) );
        bodyFixedSphericalPosition_ = convertCartesianToSpherical( bodyFixedPosition_ );
        bodyFixedSphericalPosition_( 1 ) = mathematical_constants::PI / 2.0 - bodyFixedSphericalPosition_( 1 );
        currentCosineCoefficients_ = cosineCoefficients_( );
        currentSineCoefficients_ = sineCoefficients_( );
        sphericalHarmonicCache_->update(
                    bodyFixedSphericalPosition_( 0 ), std::sin( bodyFixedSphericalPosition_( 1 ) ),
                    bodyFixedSphericalPosition_( 2 ), bodyReferenceRadius_( ) );
        currentBodyFixedPartialWrtPosition_ = computePartialDerivativeOfBodyFixedSphericalHarmonicAcceleration(
                    bodyFixedPosition_, bodyReferenceRadius_( ), gravitationalParameterFunction_( ),
                    currentCosineCoefficients_, currentSineCoefficients_, sphericalHarmonicCache_ );
        currentPartialWrtVelocity_.setZero( );
        currentPartialWrtPosition_ =
                currentRotationToBodyFixedFrame_.inverse( ) * currentBodyFixedPartialWrtPosition_ *
                currentRotationToBodyFixedFrame_;
        currentTime_ = currentTime;
        for( unsigned int i = 0; i < tidalLoveNumberPartialInterfaces_.size( ); i++ )
        {
            tidalLoveNumberPartialInterfaces_.at( i )->update( currentTime );
        }
    }
}
void SphericalHarmonicsGravityPartial :: update ( const double currentTime ) { using namespace tudat :: coordinate_conversions ; if ( ! ( currentTime_ == currentTime ) ) { updateFunction_ ( currentTime ) ; Eigen :: Matrix3d currentRotationToBodyFixedFrame_ = fromBodyFixedToIntegrationFrameRotation_ ( ) . inverse ( ) ; bodyFixedPosition_ = currentRotationToBodyFixedFrame_ * ( positionFunctionOfAcceleratedBody_ ( ) - positionFunctionOfAcceleratingBody_ ( ) ) ; bodyFixedSphericalPosition_ = convertCartesianToSpherical ( bodyFixedPosition_ ) ; bodyFixedSphericalPosition_ ( 1 ) = mathematical_constants :: PI / 2.0 - bodyFixedSphericalPosition_ ( 1 ) ; currentCosineCoefficients_ = cosineCoefficients_ ( ) ; currentSineCoefficients_ = sineCoefficients_ ( ) ; sphericalHarmonicCache_ -> update ( bodyFixedSphericalPosition_ ( 0 ) , std :: sin ( bodyFixedSphericalPosition_ ( 1 ) ) , bodyFixedSphericalPosition_ ( 2 ) , bodyReferenceRadius_ ( ) ) ; currentBodyFixedPartialWrtPosition_ = computePartialDerivativeOfBodyFixedSphericalHarmonicAcceleration ( bodyFixedPosition_ , bodyReferenceRadius_ ( ) , gravitationalParameterFunction_ ( ) , currentCosineCoefficients_ , currentSineCoefficients_ , sphericalHarmonicCache_ ) ; currentPartialWrtVelocity_ . setZero ( ) ; currentPartialWrtPosition_ = currentRotationToBodyFixedFrame_ . inverse ( ) * currentBodyFixedPartialWrtPosition_ * currentRotationToBodyFixedFrame_ ; currentTime_ = currentTime ; for ( unsigned int i = 0 ; i < tidalLoveNumberPartialInterfaces_ . size ( ) ; i ++ ) { tidalLoveNumberPartialInterfaces_ . at ( i ) -> update ( currentTime ) ; } } }
Function for updating the partial object to current state and time.
Function for updating the partial object to current state and time .
// Update acceleration model // Calculate Cartesian position in frame fixed to body exerting acceleration // Calculate spherical position in frame fixed to body exerting acceleration // Get spherical harmonic coefficients // Update trogonometric functions of multiples of longitude. // Calculate partial of acceleration wrt position of body undergoing acceleration. // Update tidal interfaces