diff --git a/Tudat/Astrodynamics/Aerodynamics/aerodynamics.cpp b/Tudat/Astrodynamics/Aerodynamics/aerodynamics.cpp index fd5d718918..14577e6a3d 100644 --- a/Tudat/Astrodynamics/Aerodynamics/aerodynamics.cpp +++ b/Tudat/Astrodynamics/Aerodynamics/aerodynamics.cpp @@ -500,12 +500,14 @@ double computeShockDeflectionAngle( double shockAngle, double machNumber, return atan( tangentOfDeflectionAngle_ ); } +//! Function to compute the speed of sound in a gas double computeSpeedOfSound( const double temperature, const double ratioOfSpecificHeats, const double specificGasConstant ) { return std::sqrt( temperature * ratioOfSpecificHeats * specificGasConstant ); } +//! Function to compute the mean free path of a particle. double computeMeanFreePath( const double weightedAverageCollisionDiameter, const double averageNumberDensity ) { return 1.0 / ( std::sqrt( 2.0 ) * tudat::mathematical_constants::PI * weightedAverageCollisionDiameter * diff --git a/Tudat/Astrodynamics/Aerodynamics/aerodynamics.h b/Tudat/Astrodynamics/Aerodynamics/aerodynamics.h index 6f9e56a074..65830305a1 100644 --- a/Tudat/Astrodynamics/Aerodynamics/aerodynamics.h +++ b/Tudat/Astrodynamics/Aerodynamics/aerodynamics.h @@ -342,10 +342,26 @@ double computeShockTotalPressureRatio( double normalMachNumber, double computeShockDeflectionAngle( double shockAngle, double machNumber, double ratioOfSpecificHeats ); +//! Function to compute the speed of sound in a gas +/*! + * Function to compute the speed of sound in a gas + * \param temperature Gas temperature + * \param ratioOfSpecificHeats Ratio of specific heats aat constant pressure and constant volume + * \param specificGasConstant Specific gas constant of the gas + * \return Speed of sound in the gas. + */ double computeSpeedOfSound( const double temperature, const double ratioOfSpecificHeats, const double specificGasConstant ); -// (Chapman, S. & Cowling, T. The mathematical theory of nonuniform gases Cambridge University Press, 1970) +//! Function to compute the mean free path of a particle. +/*! + * Function to compute the mean free path of a particle from e.g. (Chapman, S. & Cowling, T. The mathematical theory of + * nonuniform gases Cambridge University Press, 1970) + * \param weightedAverageCollisionDiameter Weighted (using specie number density) average collision diameter of the + * particles in the gas. + * \param averageNumberDensity Average number density of the gas. + * \return Mean free path of a particle in the gas. + */ double computeMeanFreePath( const double weightedAverageCollisionDiameter, const double averageNumberDensity ); diff --git a/Tudat/Astrodynamics/Aerodynamics/nrlmsise00Atmosphere.cpp b/Tudat/Astrodynamics/Aerodynamics/nrlmsise00Atmosphere.cpp index a3d061fb18..bc53337ce4 100644 --- a/Tudat/Astrodynamics/Aerodynamics/nrlmsise00Atmosphere.cpp +++ b/Tudat/Astrodynamics/Aerodynamics/nrlmsise00Atmosphere.cpp @@ -153,12 +153,12 @@ std::ostream& operator<<( std::ostream& stream, stream << "f107a = " << nrlmsiseInput.f107a << std::endl; stream << "apDaily = " << nrlmsiseInput.apDaily << std::endl; - for( unsigned int i = 0 ; i < nrlmsiseInput.apVector.size() ; i++ ) + for( unsigned int i = 0 ; i < nrlmsiseInput.apVector.size( ) ; i++ ) { stream << "apVector[ " << i << " ] = " << nrlmsiseInput.apVector[i] << std::endl; } - for( unsigned int i = 0 ; i < nrlmsiseInput.switches.size() ; i++ ) + for( unsigned int i = 0 ; i < nrlmsiseInput.switches.size( ) ; i++ ) { stream << "switches[ " << i << " ] = " << nrlmsiseInput.switches[i] << std::endl; } diff --git a/Tudat/Astrodynamics/Aerodynamics/nrlmsise00Atmosphere.h b/Tudat/Astrodynamics/Aerodynamics/nrlmsise00Atmosphere.h index 78f518f4a4..f20d22a336 100644 --- a/Tudat/Astrodynamics/Aerodynamics/nrlmsise00Atmosphere.h +++ b/Tudat/Astrodynamics/Aerodynamics/nrlmsise00Atmosphere.h @@ -68,7 +68,7 @@ struct GasComponentProperties * Data to be verified * */ - GasComponentProperties(): + GasComponentProperties( ): diameterArgon(340E-12), diameterAtomicHydrogen(260E-12), diameterHelium(256E-12), diameterNitrogen(370E-12), diameterOxygen(358E-12), diameterAtomicNitrogen(290E-12), diameterAtomicOxygen(280E-12), molarMassArgon(39.948E-3), molarMassAtomicHydrogen(1.008E-3), @@ -213,12 +213,12 @@ class NRLMSISE00Atmosphere : public AtmosphereModel * \param useIdealGasLaw Variable denoting whether to use the ideal gas law for computation of pressure. */ NRLMSISE00Atmosphere( const NRLMSISE00InputFunction nrlmsise00InputFunction, - const bool useIdealGasLaw = true) - : nrlmsise00InputFunction_(nrlmsise00InputFunction) + const bool useIdealGasLaw = true ) + :nrlmsise00InputFunction_(nrlmsise00InputFunction) { - resetHashKey(); + resetHashKey( ); molarGasConstant_ = tudat::physical_constants::MOLAR_GAS_CONSTANT; - specificHeatRatio_ = 1.4 ; + specificHeatRatio_ = 1.4; GasComponentProperties gasProperties; gasComponentProperties_ = gasProperties; // Default gas properties useIdealGasLaw_ = useIdealGasLaw; @@ -239,11 +239,11 @@ class NRLMSISE00Atmosphere : public AtmosphereModel const bool useIdealGasLaw = true) : nrlmsise00InputFunction_(nrlmsise00InputFunction) { - resetHashKey(); + resetHashKey( ); molarGasConstant_ = tudat::physical_constants::MOLAR_GAS_CONSTANT; - specificHeatRatio_ = specificHeatRatio ; + specificHeatRatio_ = specificHeatRatio; gasComponentProperties_ = gasProperties; - useIdealGasLaw_ = useIdealGasLaw ; + useIdealGasLaw_ = useIdealGasLaw; } //! Set gas component properties. diff --git a/Tudat/Astrodynamics/Aerodynamics/nrlmsise00InputFunctions.cpp b/Tudat/Astrodynamics/Aerodynamics/nrlmsise00InputFunctions.cpp index 23d2bce042..11358736eb 100644 --- a/Tudat/Astrodynamics/Aerodynamics/nrlmsise00InputFunctions.cpp +++ b/Tudat/Astrodynamics/Aerodynamics/nrlmsise00InputFunctions.cpp @@ -71,11 +71,7 @@ NRLMSISE00Input nrlmsiseInputFunction( const double altitude, const double longi time, basic_astrodynamics::JULIAN_DAY_ON_J2000 ); double julianDay = std::floor( julianDate - 0.5 ) + 0.5; - // Move not always find, only if day changes - // Only use datamap with this day + some extra days.. - // Find solar activity data for current date - - + // Check if solar activity is found for current day. if( solarActivityMap.count( julianDay ) == 0 ) { std::cerr << "Solar activity data could not be found for this date.." << std::endl; @@ -104,7 +100,7 @@ NRLMSISE00Input nrlmsiseInputFunction( const double altitude, const double longi nrlmsiseInputData.f107a = solarActivity->centered81DaySolarRadioFlux107Observed; } nrlmsiseInputData.apDaily = solarActivity->planetaryEquivalentAmplitudeAverage; - nrlmsiseInputData.apVector = eigenToStlVector( solarActivity->planetaryEquivalentAmplitudeVector ); // std vector + nrlmsiseInputData.apVector = eigenToStlVector( solarActivity->planetaryEquivalentAmplitudeVector ); // Compute local solar time // Hrs since begin of the day at longitude 0 (GMT) + Hrs passed at current longitude diff --git a/Tudat/Mathematics/Interpolators/UnitTests/unitTestHermiteCubicSplineInterpolator.cpp b/Tudat/Mathematics/Interpolators/UnitTests/unitTestHermiteCubicSplineInterpolator.cpp index 3f955502e5..6e7822aac2 100644 --- a/Tudat/Mathematics/Interpolators/UnitTests/unitTestHermiteCubicSplineInterpolator.cpp +++ b/Tudat/Mathematics/Interpolators/UnitTests/unitTestHermiteCubicSplineInterpolator.cpp @@ -1,42 +1,11 @@ -/* Copyright (c) 2010-2015, Delft University of Technology - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - Neither the name of the Delft University of Technology nor the names of its contributors - * may be used to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Changelog - * YYMMDD Author Comment - * 110621 F.M. Engelen File created. - * 110707 E.A.G. Heeren Minor spelling/lay-out corrections. - * 110714 E.A.G. Heeren Minor spelling/lay-out corrections. - * 110905 S. Billemont Reorganized includes. - * Moved (con/de)structors and getter/setters to header. - * 120529 E.A.G. Heeren Boostified unit test. - * 120615 T. Secretin Added check for exception handling. - * 120716 D. Dirkx Updated with interpolator architecture. - * - * References - * - * Notes +/* Copyright (c) 2010-2016, Delft University of Technology + * All rigths reserved * + * This file is part of the Tudat. Redistribution and use in source and + * binary forms, with or without modification, are permitted exclusively + * under the terms of the Modified BSD license. You should have received + * a copy of the license with this file. If not, please or visit: + * http://tudat.tudelft.nl/LICENSE. */ #define BOOST_TEST_MAIN diff --git a/Tudat/Mathematics/Interpolators/hermiteCubicSplineInterpolator.h b/Tudat/Mathematics/Interpolators/hermiteCubicSplineInterpolator.h index 696f987b7a..78418ae2f5 100644 --- a/Tudat/Mathematics/Interpolators/hermiteCubicSplineInterpolator.h +++ b/Tudat/Mathematics/Interpolators/hermiteCubicSplineInterpolator.h @@ -1,3 +1,14 @@ +/* Copyright (c) 2010-2016, Delft University of Technology + * All rigths reserved + * + * This file is part of the Tudat. Redistribution and use in source and + * binary forms, with or without modification, are permitted exclusively + * under the terms of the Modified BSD license. You should have received + * a copy of the license with this file. If not, please or visit: + * http://tudat.tudelft.nl/LICENSE. + */ + + #ifndef TUDAT_HERMITE_CUBIC_SPLINE_INTERPOLATOR_H #define TUDAT_HERMITE_CUBIC_SPLINE_INTERPOLATOR_H @@ -113,7 +124,7 @@ class HermiteCubicSplineInterpolator : int lowerEntry_ = lookUpScheme_->findNearestLowerNeighbour( targetIndependentVariableValue ); - // Compute Hermite spline: p(x) = a((x-x0)/(x1-x0))^3 + b((x-x0)/(x1-x0))^2 + c((x-x0)/(x1-x0)) + d + // Compute Hermite spline IndependentVariableType factor = ( targetIndependentVariableValue - independentValues_[ lowerEntry_ ] ) /( independentValues_[ lowerEntry_ + 1 ] - independentValues_[ lowerEntry_ ] ); DependentVariableType targetValue = @@ -128,7 +139,7 @@ class HermiteCubicSplineInterpolator : protected: //! Compute coefficients of the splines - void computeCoefficients() + void computeCoefficients( ) { // Initialize vector std::vector< DependentVariableType > zeroVect( independentValues_.size( ) - 1 ); @@ -138,24 +149,25 @@ class HermiteCubicSplineInterpolator : coefficients_.push_back( zeroVect ); } - // Compute coefficients for polynomials. + // Compute coefficients for polynomials a, b, c and d so that interpolant p is: + // p(x) = a((x-x0)/(x1-x0))^3 + b((x-x0)/(x1-x0))^2 + c((x-x0)/(x1-x0)) + d. for( unsigned int i = 0 ; i < ( independentValues_.size() - 1 ) ; i++ ) { - // p(x) = a((x-x0)/(x1-x0))^3 + b((x-x0)/(x1-x0))^2 + c((x-x0)/(x1-x0)) + d - // a + + // Compute coefficient a coefficients_[ 0 ][ i ] = 2.0 * dependentValues_[ i ] - 2.0 * dependentValues_[ i + 1 ] + derivativeValues_[ i ]*(independentValues_[ i + 1 ]-independentValues_[ i ] ) + derivativeValues_[ i + 1 ]*(independentValues_[ i + 1 ]-independentValues_[ i ] ); - // b + // Compute coefficient b coefficients_[ 1 ][ i ] = -3.0 * dependentValues_[ i ] + 3.0 * dependentValues_[ i + 1 ] - 2.0 * derivativeValues_[ i ]*(independentValues_[ i + 1 ]-independentValues_[ i ] ) - derivativeValues_[ i + 1 ]*(independentValues_[ i + 1 ]-independentValues_[ i ] ); - // c + // Compute coefficient c coefficients_[ 2 ][ i ] = derivativeValues_[ i ] * ( independentValues_[ i + 1 ]-independentValues_[ i ] ); - // d + // Compute coefficient d coefficients_[ 3 ][ i ] = dependentValues_[ i ] ; } } @@ -170,6 +182,7 @@ class HermiteCubicSplineInterpolator : std::vector< std::vector< DependentVariableType > > coefficients_ ; }; +//! Typede for cubic hermite spline with double (in)dependent variables. typedef HermiteCubicSplineInterpolator< double, double > HermiteCubicSplineInterpolatorDouble; } //namespace tudat diff --git a/Tudat/Mathematics/NumericalQuadrature/CMakeLists.txt b/Tudat/Mathematics/NumericalQuadrature/CMakeLists.txt index 47c292350c..5c374bccd2 100644 --- a/Tudat/Mathematics/NumericalQuadrature/CMakeLists.txt +++ b/Tudat/Mathematics/NumericalQuadrature/CMakeLists.txt @@ -1,37 +1,12 @@ - # Copyright (c) 2010-2015, Delft University of Technology - # All rights reserved. - # - # Redistribution and use in source and binary forms, with or without modification, are - # permitted provided that the following conditions are met: - # - Redistributions of source code must retain the above copyright notice, this list of - # conditions and the following disclaimer. - # - Redistributions in binary form must reproduce the above copyright notice, this list of - # conditions and the following disclaimer in the documentation and/or other materials - # provided with the distribution. - # - Neither the name of the Delft University of Technology nor the names of its contributors - # may be used to endorse or promote products derived from this software without specific - # prior written permission. - # - # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS - # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - # OF THE POSSIBILITY OF SUCH DAMAGE. - # - # Changelog - # YYMMDD Author Comment - # 110820 S.M. Persson File created. - # 111025 K. Kumar Adapted file to work with Revision 194. - # 111026 K. Kumar Adapted file so all headers show in project tree in Qt Creator. - # - # References - # - # Notes - # +# Copyright (c) 2010-2016, Delft University of Technology +# All rigths reserved +# +# This file is part of the Tudat. Redistribution and use in source and +# binary forms, with or without modification, are permitted exclusively +# under the terms of the Modified BSD license. You should have received +# a copy of the license with this file. If not, please or visit: +# http://tudat.tudelft.nl/LICENSE. +# # Add source files. set(NUMERICAL_QUADRATURE_SOURCES diff --git a/Tudat/Mathematics/NumericalQuadrature/trapezoidQuadrature.h b/Tudat/Mathematics/NumericalQuadrature/trapezoidQuadrature.h index 7e52cf56d8..23f95a52c7 100644 --- a/Tudat/Mathematics/NumericalQuadrature/trapezoidQuadrature.h +++ b/Tudat/Mathematics/NumericalQuadrature/trapezoidQuadrature.h @@ -123,6 +123,7 @@ class TrapezoidNumericalQuadrature : public NumericalQuadrature< IndependentVari }; +//! Typede for trapezoidal quadrature with double (in)dependent variables. typedef boost::shared_ptr< TrapezoidNumericalQuadrature< double, double > > TrapezoidNumericalIntegratorPointerd; } // namespace numerical_quadrature