Tudat/Astrodynamics/BasicAstrodynamics/UnitTests/unitTestClohessyWiltshirePropagator.cpp
// Testcase 2: pure harmonic relative motion in low-Earth orbit.
//   According to Wakker [2007] pure harmonic relative motion occurs if two conditions are met:
//   (1) initialRadialVelocity = 0.5 * meanAngularMotion * initialAlongTrackPosition.
//   (2) initialAlongTrackVelocity = -2.0 * meanAngularMotion * initialRadialPosition.
//   Therefore the final state after one orbital revolution must be exactly equal to the initial
//   state. This testcase verifies this.

Testcase 2: pure harmonic relative motion in low-Earth orbit.
According to Wakker [2007] pure harmonic relative motion occurs if two conditions are met:
(1) initialRadialVelocity = 0.5 * meanAngularMotion * initialAlongTrackPosition.
Testcase 2 : pure harmonic relative motion in low - Earth orbit . According to Wakker [ 2007 ] pure harmonic relative motion occurs if two conditions are met : ( 1 ) initialRadialVelocity = 0 . 5 * meanAngularMotion * initialAlongTrackPosition .
BOOST_AUTO_TEST_CASE( test_ClohessyWiltshirePropagation_harmonicMotion )
{
    const double centralBodyGravitationalParameter2 = 3.986004418e14;
    const double referenceOrbitRadius2 = 6.778137e6;
    const double meanAngularMotion =
            std::sqrt( centralBodyGravitationalParameter2
                       / ( referenceOrbitRadius2 * referenceOrbitRadius2
                           * referenceOrbitRadius2 ) );
    const double propagationDuration2 = 2.0 * mathematical_constants::PI
            / meanAngularMotion;
    const Eigen::Vector6d initialState2 =
            ( Eigen::Vector6d( )
              << 34.0, 49.0 , 17.0,
              0.5 * meanAngularMotion * 49.0,
              -2.0 * meanAngularMotion * 34.0, 0.04 ).finished( );
    const Eigen::Vector6d computedFinalState2
            = basic_astrodynamics::propagateClohessyWiltshire(
                initialState2,
                propagationDuration2,
                centralBodyGravitationalParameter2,
                referenceOrbitRadius2 );
    TUDAT_CHECK_MATRIX_CLOSE_FRACTION( initialState2, computedFinalState2, 1.0e-14 );
}
BOOST_AUTO_TEST_CASE ( test_ClohessyWiltshirePropagation_harmonicMotion ) { const double centralBodyGravitationalParameter2 = 3.986004418e14 ; const double referenceOrbitRadius2 = 6.778137e6 ; const double meanAngularMotion = std :: sqrt ( centralBodyGravitationalParameter2 / ( referenceOrbitRadius2 * referenceOrbitRadius2 * referenceOrbitRadius2 ) ) ; const double propagationDuration2 = 2.0 * mathematical_constants :: PI / meanAngularMotion ; const Eigen :: Vector6d initialState2 = ( Eigen :: Vector6d ( ) << 34.0 , 49.0 , 17.0 , 0.5 * meanAngularMotion * 49.0 , -2.0 * meanAngularMotion * 34.0 , 0.04 ) . finished ( ) ; const Eigen :: Vector6d computedFinalState2 = basic_astrodynamics :: propagateClohessyWiltshire ( initialState2 , propagationDuration2 , centralBodyGravitationalParameter2 , referenceOrbitRadius2 ) ; TUDAT_CHECK_MATRIX_CLOSE_FRACTION ( initialState2 , computedFinalState2 , 1.0e-14 ) ; }
Testcase 2: pure harmonic relative motion in low-Earth orbit.
Testcase 2 : pure harmonic relative motion in low - Earth orbit .
// Set central body gravitational parameter [m^3 s^-2].
 // In this case: central body is Earth.
 // Set reference orbit radius [m].
 // In this case: reference orbit is at 400 km altitude above Earth.
 // Calculate mean angular motion of reference orbit [rad].
 // Set propagation duration [s].
 // In this case: orbital period of the reference orbit.
 // Set initial state [m], [m], [m], [m/s], [m,s], [m/s].
 // In this case: arbitrary values for initial positions and initialCrossTrackVelocity. The
 // initialRadialVelocity and initialAlongTrackVelocity are set to achieve harmonic motion.
 // Calculate final state according to Tudat function.
 // Check if computed final state matches the initial state.
