Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New aerodynamic coefficient interface code #8

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions Tudat/Astrodynamics/Aerodynamics/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,30 @@
# Set the source files.
set(AERODYNAMICS_SOURCES
"${SRCROOT}${AERODYNAMICSDIR}/aerodynamicMoment.cpp"
"${SRCROOT}${AERODYNAMICSDIR}/aerodynamicAcceleration.cpp"
"${SRCROOT}${AERODYNAMICSDIR}/aerodynamicForce.cpp"
"${SRCROOT}${AERODYNAMICSDIR}/aerodynamics.cpp"
"${SRCROOT}${AERODYNAMICSDIR}/exponentialAtmosphere.cpp"
"${SRCROOT}${AERODYNAMICSDIR}/hypersonicLocalInclinationAnalysis.cpp"
"${SRCROOT}${AERODYNAMICSDIR}/tabulatedAtmosphere.cpp"
"${SRCROOT}${AERODYNAMICSDIR}/customAerodynamicCoefficientInterface.cpp"
)

# Set the header files.
set(AERODYNAMICS_HEADERS
"${SRCROOT}${AERODYNAMICSDIR}/aerodynamicAcceleration.h"
set(AERODYNAMICS_HEADERS
"${SRCROOT}${AERODYNAMICSDIR}/aerodynamicCoefficientGenerator.h"
"${SRCROOT}${AERODYNAMICSDIR}/aerodynamicCoefficientInterface.h"
"${SRCROOT}${AERODYNAMICSDIR}/aerodynamicForce.h"
"${SRCROOT}${AERODYNAMICSDIR}/aerodynamicMoment.h"
"${SRCROOT}${AERODYNAMICSDIR}/aerodynamicAcceleration.h"
"${SRCROOT}${AERODYNAMICSDIR}/aerodynamicForce.h"
"${SRCROOT}${AERODYNAMICSDIR}/aerodynamicRotationalAcceleration.h"
"${SRCROOT}${AERODYNAMICSDIR}/aerodynamics.h"
"${SRCROOT}${AERODYNAMICSDIR}/atmosphereModel.h"
"${SRCROOT}${AERODYNAMICSDIR}/exponentialAtmosphere.h"
"${SRCROOT}${AERODYNAMICSDIR}/hypersonicLocalInclinationAnalysis.h"
"${SRCROOT}${AERODYNAMICSDIR}/tabulatedAtmosphere.h"
"${SRCROOT}${AERODYNAMICSDIR}/standardAtmosphere.h"
"${SRCROOT}${AERODYNAMICSDIR}/customAerodynamicCoefficientInterface.h"
)

# Add static libraries.
Expand All @@ -71,9 +75,9 @@ add_executable(test_AerodynamicsNamespace "${SRCROOT}${AERODYNAMICSDIR}/UnitTest
setup_custom_test_program(test_AerodynamicsNamespace "${SRCROOT}${AERODYNAMICSDIR}")
target_link_libraries(test_AerodynamicsNamespace tudat_aerodynamics ${Boost_LIBRARIES})

add_executable(test_CoefficientGenerator "${SRCROOT}${AERODYNAMICSDIR}/UnitTests/unitTestCoefficientGenerator.cpp")
setup_custom_test_program(test_CoefficientGenerator "${SRCROOT}${AERODYNAMICSDIR}")
target_link_libraries(test_CoefficientGenerator tudat_aerodynamics tudat_geometric_shapes tudat_basic_mathematics ${Boost_LIBRARIES})
add_executable(test_AerodynamicCoefficientGenerator "${SRCROOT}${AERODYNAMICSDIR}/UnitTests/unitTestCoefficientGenerator.cpp")
setup_custom_test_program(test_AerodynamicCoefficientGenerator "${SRCROOT}${AERODYNAMICSDIR}")
target_link_libraries(test_AerodynamicCoefficientGenerator tudat_aerodynamics tudat_geometric_shapes tudat_basic_mathematics ${Boost_LIBRARIES})

add_executable(test_ExponentialAtmosphere "${SRCROOT}${AERODYNAMICSDIR}/UnitTests/unitTestExponentialAtmosphere.cpp")
setup_custom_test_program(test_ExponentialAtmosphere "${SRCROOT}${AERODYNAMICSDIR}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@
#include <Eigen/Geometry>

#include "Tudat/Basics/testMacros.h"

#include "Tudat/Astrodynamics/Aerodynamics/aerodynamicCoefficientInterface.h"
#include "Tudat/Astrodynamics/Aerodynamics/customAerodynamicCoefficientInterface.h"
#include "Tudat/Astrodynamics/Aerodynamics/aerodynamicAcceleration.h"
#include "Tudat/Astrodynamics/Aerodynamics/aerodynamicRotationalAcceleration.h"

Expand Down Expand Up @@ -113,28 +112,41 @@ BOOST_AUTO_TEST_CASE( testAerodynamicForceAndAcceleration )
{
// Set coefficients and model parameters in aerodynamics coefficient interface object.
AerodynamicCoefficientInterfacePointer aerodynamicCoefficientInterface =
boost::make_shared< AerodynamicCoefficientInterface >( );
aerodynamicCoefficientInterface->setCurrentForceCoefficients( forceCoefficients );
aerodynamicCoefficientInterface->setReferenceArea( referenceArea );
aerodynamicCoefficientInterface->setReferenceLength( referenceLength );
createConstantCoefficientAerodynamicCoefficientInterface(
forceCoefficients, Eigen::Vector3d::Zero( ),
referenceLength, referenceArea, referenceLength, Eigen::Vector3d::Zero( ) );

// Compute aerodynamic force using free function with coefficient interface argument.
Eigen::Vector3d force = computeAerodynamicForce( dynamicPressure,
aerodynamicCoefficientInterface );

// Check if computed force matches expected.
TUDAT_CHECK_MATRIX_CLOSE_FRACTION( expectedForce, force, tolerance );

// Test aerodynamic coefficient interface properties
BOOST_CHECK_EQUAL(
aerodynamicCoefficientInterface->getIndependentVariableNames( ).size( ), 0 );

bool isVariableIndexTooHigh = 0;
try
{
aerodynamicCoefficientInterface->getIndependentVariableName( 0 );
}
catch ( std::runtime_error )
{
isVariableIndexTooHigh = 1;
}
BOOST_CHECK_EQUAL( isVariableIndexTooHigh, 1 );
}

// Test 3: test the acceleration model implemented as free function with primitive arguments,
// based on the force that can be derived from the computed acceleration.
{
// Set coefficients and model parameters in aerodynamics coefficient interface object.
AerodynamicCoefficientInterfacePointer aerodynamicCoefficientInterface =
boost::make_shared< AerodynamicCoefficientInterface >( );
aerodynamicCoefficientInterface->setCurrentForceCoefficients( forceCoefficients );
aerodynamicCoefficientInterface->setReferenceArea( referenceArea );
aerodynamicCoefficientInterface->setReferenceLength( referenceLength );
createConstantCoefficientAerodynamicCoefficientInterface(
forceCoefficients, Eigen::Vector3d::Zero( ),
referenceLength, referenceArea, referenceLength, Eigen::Vector3d::Zero( ) );

// Compute aerodynamic force from aerodynamic acceleration free function with primitive
// arguments.
Expand Down Expand Up @@ -258,11 +270,9 @@ BOOST_AUTO_TEST_CASE( testAerodynamicMomentAndRotationalAcceleration )
{
// Set coefficients and model parameters in aerodynamics coefficient interface object.
AerodynamicCoefficientInterfacePointer aerodynamicCoefficientInterface =
boost::make_shared< AerodynamicCoefficientInterface >( );
aerodynamicCoefficientInterface->setCurrentMomentCoefficients( momentCoefficients );
aerodynamicCoefficientInterface->setReferenceArea( referenceArea );
aerodynamicCoefficientInterface->setReferenceLength( referenceLength );
aerodynamicCoefficientInterface->setReferenceLength( referenceLength );
createConstantCoefficientAerodynamicCoefficientInterface(
Eigen::Vector3d::Zero( ), momentCoefficients,
referenceLength, referenceArea, referenceLength, Eigen::Vector3d::Zero( ) );

// Compute aerodynamic moment using free function with coefficient interface argument.
Eigen::Vector3d moment = computeAerodynamicMoment( dynamicPressure,
Expand All @@ -278,11 +288,9 @@ BOOST_AUTO_TEST_CASE( testAerodynamicMomentAndRotationalAcceleration )
{
// Set coefficients and model parameters in aerodynamics coefficient interface object.
AerodynamicCoefficientInterfacePointer aerodynamicCoefficientInterface =
boost::make_shared< AerodynamicCoefficientInterface >( );
aerodynamicCoefficientInterface->setCurrentMomentCoefficients( momentCoefficients );
aerodynamicCoefficientInterface->setReferenceArea( referenceArea );
aerodynamicCoefficientInterface->setReferenceLength( referenceLength );
aerodynamicCoefficientInterface->setReferenceLength( referenceLength );
createConstantCoefficientAerodynamicCoefficientInterface(
Eigen::Vector3d::Zero( ), momentCoefficients,
referenceLength, referenceArea, referenceLength, Eigen::Vector3d::Zero( ) );

// Compute aerodynamic moment from aerodynamic rotational acceleration free function with
// primitive arguments.
Expand Down
Loading