Tudat/Astrodynamics/Aerodynamics/UnitTests/unitTestNRLMSISE00Atmosphere.cpp
//! Perform NRLMSISE-00 test 18
// Check computation of speed of sound
Perform NRLMSISE-00 test 18
Check computation of speed of sound
Perform NRLMSISE - 00 test 18 Check computation of speed of sound
BOOST_AUTO_TEST_CASE( testSpeedOfSound )
{
    NRLMSISE00Atmosphere model( std::bind( &function, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, false, false ) );
    double altitude = 0.0 ;
    double longitude = 0.0 ;
    double latitude = 0.0 ;
    double time = 0.0 ;
    BOOST_CHECK_CLOSE_FRACTION( model.getSpeedOfSound(altitude,longitude,latitude,time) , 343.21 , 2E-2 ); 
    BOOST_CHECK_CLOSE_FRACTION( model.getSpeedOfSound(altitude,longitude,latitude,time) , 340.9 , 1.8E-2 ); 
    std::string atmosphereTableFile = tudat::input_output::getAtmosphereTablesPath( ) + "USSA1976Until100kmPer100mUntil1000kmPer1000m.dat";
    tudat::aerodynamics::TabulatedAtmosphere US76model( atmosphereTableFile );
    BOOST_CHECK_CLOSE_FRACTION( model.getSpeedOfSound(altitude,longitude,latitude,time) , US76model.getSpeedOfSound(altitude) , 2E-2 ); 
    altitude = 10.0E3 ;
    BOOST_CHECK_CLOSE_FRACTION( model.getSpeedOfSound(altitude,longitude,latitude,time) , US76model.getSpeedOfSound(altitude) , 3.5E-2 ); 
    altitude = 40.0E3 ;
    BOOST_CHECK_CLOSE_FRACTION( model.getSpeedOfSound(altitude,longitude,latitude,time) , US76model.getSpeedOfSound(altitude) , 6.5E-2 ); 
    altitude = 80.0E3 ;
    BOOST_CHECK_CLOSE_FRACTION( model.getSpeedOfSound(altitude,longitude,latitude,time) , US76model.getSpeedOfSound(altitude) , 5E-2 ); 
    double speedOfSound = std::sqrt( 1.4 * 8.3144598 * model.getTemperature(altitude,longitude,latitude,time) / model.getMeanMolarMass(altitude,longitude,latitude,time) ) ;
    BOOST_CHECK_CLOSE_FRACTION( speedOfSound , model.getSpeedOfSound(altitude,longitude,latitude,time), 1E-15 );
}
BOOST_AUTO_TEST_CASE ( testSpeedOfSound ) { NRLMSISE00Atmosphere model ( std :: bind ( & function , std :: placeholders :: _1 , std :: placeholders :: _2 , std :: placeholders :: _3 , std :: placeholders :: _4 , false , false ) ) ; double altitude = 0.0 ; double longitude = 0.0 ; double latitude = 0.0 ; double time = 0.0 ; BOOST_CHECK_CLOSE_FRACTION ( model . getSpeedOfSound ( altitude , longitude , latitude , time ) , 343.21 , 2E-2 ) ; BOOST_CHECK_CLOSE_FRACTION ( model . getSpeedOfSound ( altitude , longitude , latitude , time ) , 340.9 , 1.8E-2 ) ; std :: string atmosphereTableFile = tudat :: input_output :: getAtmosphereTablesPath ( ) + " " ; tudat :: aerodynamics :: TabulatedAtmosphere US76model ( atmosphereTableFile ) ; BOOST_CHECK_CLOSE_FRACTION ( model . getSpeedOfSound ( altitude , longitude , latitude , time ) , US76model . getSpeedOfSound ( altitude ) , 2E-2 ) ; altitude = 10.0E3 ; BOOST_CHECK_CLOSE_FRACTION ( model . getSpeedOfSound ( altitude , longitude , latitude , time ) , US76model . getSpeedOfSound ( altitude ) , 3.5E-2 ) ; altitude = 40.0E3 ; BOOST_CHECK_CLOSE_FRACTION ( model . getSpeedOfSound ( altitude , longitude , latitude , time ) , US76model . getSpeedOfSound ( altitude ) , 6.5E-2 ) ; altitude = 80.0E3 ; BOOST_CHECK_CLOSE_FRACTION ( model . getSpeedOfSound ( altitude , longitude , latitude , time ) , US76model . getSpeedOfSound ( altitude ) , 5E-2 ) ; double speedOfSound = std :: sqrt ( 1.4 * 8.3144598 * model . getTemperature ( altitude , longitude , latitude , time ) / model . getMeanMolarMass ( altitude , longitude , latitude , time ) ) ; BOOST_CHECK_CLOSE_FRACTION ( speedOfSound , model . getSpeedOfSound ( altitude , longitude , latitude , time ) , 1E-15 ) ; }
Perform NRLMSISE-00 test 18
Check computation of speed of sound
Perform NRLMSISE - 00 test 18 Check computation of speed of sound
// Construct model with default properties // Check speed of sound : (https://en.wikipedia.org/wiki/Speed_of_sound  (at 20 deg celcius) ) // 340.9 at sealevel (anderson, fundamentals of aerodynamics) // < 2% // < 1.8% // US Standard Atmosphere Model 1976 // Test wist US76 table (NRLMSISE should provide approximately the same results) // < 2% // < 3.5% // < 6.5% // < 5% // Verify calculation