Skip to content

Commit

Permalink
Merge branch 'develop' into feature/issues_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
DominicDirkx committed Sep 26, 2023
2 parents bfbc29b + a85c3e1 commit 17aa561
Show file tree
Hide file tree
Showing 25 changed files with 1,188 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 2.12.1.dev29
current_version = 2.12.1.dev30
commit = True
tag = True
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.(?P<release>[a-z]+)(?P<dev>\d+))?
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ Tudat/interface/spice/Kernels/
/.idea/*
/cmake-build-debug/*
/cmake-build*
*.vscode


# Rever
Expand Down
4 changes: 3 additions & 1 deletion include/tudat/astro/basic_astro/accelerationModelTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "tudat/astro/basic_astro/empiricalAcceleration.h"
#include "tudat/astro/propulsion/massRateFromThrust.h"
#include "tudat/astro/electromagnetism/solarSailAcceleration.h"
#include "tudat/astro/electromagnetism/yarkovskyAcceleration.h"

namespace tudat
{
Expand Down Expand Up @@ -65,7 +66,8 @@ enum AvailableAcceleration
panelled_radiation_pressure_acceleration,
momentum_wheel_desaturation_acceleration,
solar_sail_acceleration,
custom_acceleration
custom_acceleration,
yarkovsky_acceleration
};

// Function to get a string representing a 'named identification' of an acceleration type
Expand Down
133 changes: 133 additions & 0 deletions include/tudat/astro/electromagnetism/yarkovskyAcceleration.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
/* Copyright (c) 2010-2023, 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.
*
* References
* Pérez-Hernández, J. A., & Benet, L. (2022). Non-zero Yarkovsky acceleration for near-Earth
* asteroid (99942) Apophis. Communications Earth & Environment, 3(1), Article 1.
* DOI: https://doi.org/10.1038/s43247-021-00337-x
*/


#ifndef TUDAT_YARKOVSKYACCELERATION_H
#define TUDAT_YARKOVSKYACCELERATION_H

#include <functional>
#include <boost/lambda/lambda.hpp>
#include "tudat/astro/basic_astro/accelerationModel.h"
#include "tudat/astro/basic_astro/physicalConstants.h"
#include "tudat/basics/basicTypedefs.h"


namespace tudat
{
namespace electromagnetism
{

//! Compute Yarkovsky Acceleration using a simplified tangential model.
/*!
* \param yarkovskyParameter Yarkovsky Parameter N2 [m/s^2]
* \param stateVector is the state vector pointing from the source to the body
* undergoing the acceleration [m]
* \return Acceleration due to Yarkovsky effect. [m/s^2]
*/
Eigen::Vector3d computeYarkovskyAcceleration( double yarkovskyParameter, const Eigen::Vector6d& stateVector );

//! Class for calculating an Yarkovsky acceleration, based on (Pérez-Hernández & Benet, 2022).
/*!
* Class for calculating an Yarkovsky acceleration, based on (Pérez-Hernández & Benet, 2022).
* The acceleration is only considered in the tangential direction and is proportional to
* a = A2 * (r0/rS)^2, where A2 is the Yarkovsky parameter, r0 = 1AU and rS is the heliocentric
* distance in AU.
*/
class YarkovskyAcceleration: public basic_astrodynamics::AccelerationModel< Eigen::Vector3d >
{
public:

//! Constructor
/*!
* Constructor
* \param yarkovskyParameter Yarkovsky parameter
* \param bodyGravitationalParameterFunction Function that returns the state of the body.
* \param centralBodyStateFunction Functon that returns the state of central body.
*/
YarkovskyAcceleration( const double yarkovskyParameter,
const std::function< Eigen::Vector6d( ) >& bodyStateFunction,
const std::function< Eigen::Vector6d( ) >& centralBodyStateFunction = []( ) { return Eigen::Vector6d::Zero( ); } )
: yarkovskyParameter_( yarkovskyParameter ), bodyStateFunction_( bodyStateFunction ),
centralBodyStateFunction_( centralBodyStateFunction )
{
}

//! Destructor
~YarkovskyAcceleration( ) override = default;

//! Function to update constituent elements of Yarkovsky acceleration to current time
/*!
* Function to update constituent elements of Yarkovsky acceleration to current time
* \param currentTime Time to which Yarkovsky acceleration elements are to be updated.
*/
void updateMembers( const double currentTime ) override
{
if ( this->currentTime_ != currentTime ) {
// Calculate current relative state of accelerated body
currentState_ = bodyStateFunction_( ) - centralBodyStateFunction_( );

// Update
this->currentAcceleration_ = computeYarkovskyAcceleration( yarkovskyParameter_, currentState_ );
this->currentTime_ = currentTime;
}
}

//! Function to retrieve current state of the body that is undergoing the Yarkovsky acceleration, relative to central body
/*!
* Function to retrieve Current state of the body that is undergoing the Yarkovsky acceleration, relative to central body,
* in propagation frame.
* \return Current state of the body that is undergoing the Yarkovsky acceleration, relative to central body, in global frame.
*/
Eigen::Vector6d getCurrentState( )
{
return currentState_;
}

Eigen::Vector6d& getCurrentStateReference( )
{
return currentState_;
}

double getYarkovskyParameter( )
{
return yarkovskyParameter_;
}

void setYarkovskyParameter( const double yarkovskyParameter )
{
yarkovskyParameter_ = yarkovskyParameter;
}

private:
//! Yarkovsky Parameter
double yarkovskyParameter_;

//! State function of the body that is undergoing the Yarkovsky acceleration.
std::function< Eigen::Vector6d( ) > bodyStateFunction_;

//! State function of the body that is being orbited
std::function< Eigen::Vector6d( ) > centralBodyStateFunction_;

//! Current state of the body that is undergoing the Yarkovsky acceleration, relative to central body, in global frame.
Eigen::Vector6d currentState_;
};


//! Typedef for shared-pointer to YarkovskyAcceleration.
typedef std::shared_ptr< YarkovskyAcceleration > YarkovskyAccelerationPointer;

}
}
#endif // TUDAT_YARKOVSKYACCELERATION_H
Loading

0 comments on commit 17aa561

Please sign in to comment.