Skip to content

Commit

Permalink
Working on partials of panelled source radiation pressure
Browse files Browse the repository at this point in the history
  • Loading branch information
DominicDirkx committed Oct 23, 2023
1 parent 4ccc1d9 commit f781174
Show file tree
Hide file tree
Showing 8 changed files with 1,652 additions and 1,472 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,7 @@ class RadiationPressureAccelerationPartial: public AccelerationPartial
const std::string acceleratedBody,
const std::string acceleratingBody,
const std::shared_ptr< electromagnetism::PaneledSourceRadiationPressureAcceleration > radiationPressureAcceleration,
const std::shared_ptr< estimatable_parameters::CustomSingleAccelerationPartialCalculatorSet > customAccelerationPartialSet = nullptr ):
AccelerationPartial( acceleratedBody, acceleratingBody, basic_astrodynamics::custom_acceleration ),
radiationPressureAcceleration_( radiationPressureAcceleration ),
customAccelerationPartialSet_( customAccelerationPartialSet )
{
currentPartialWrtUndergoingState_.setZero( );
currentPartialWrtExertingState_.setZero( );

estimatable_parameters::EstimatebleParameterIdentifier undergoingBodyIdentifier =
std::make_pair( estimatable_parameters::initial_body_state, std::make_pair( acceleratedBody, "" ) );
if( customAccelerationPartialSet->customInitialStatePartials_.count( undergoingBodyIdentifier ) > 0 )
{
bodyUndergoingPositionPartial_ = customAccelerationPartialSet->customInitialStatePartials_.at( undergoingBodyIdentifier );
}

estimatable_parameters::EstimatebleParameterIdentifier exertingBodyIdentifier =
std::make_pair( estimatable_parameters::initial_body_state, std::make_pair( acceleratingBody, "" ) );
if( customAccelerationPartialSet->customInitialStatePartials_.count( exertingBodyIdentifier ) > 0 && ( exertingBodyIdentifier != undergoingBodyIdentifier ) )
{
bodyExertingPositionPartial_ = customAccelerationPartialSet->customInitialStatePartials_.at( exertingBodyIdentifier );
}
}
const std::shared_ptr< estimatable_parameters::CustomSingleAccelerationPartialCalculatorSet > customAccelerationPartialSet = nullptr );

//! Function for calculating the partial of the acceleration w.r.t. the position of body undergoing acceleration..
/*!
Expand Down Expand Up @@ -224,27 +203,7 @@ class RadiationPressureAccelerationPartial: public AccelerationPartial
* position partial is computed and set.
* \param currentTime Time at which partials are to be calculated
*/
void update( const double currentTime = TUDAT_NAN )
{
radiationPressureAcceleration_->updateMembers( currentTime );

if( !( currentTime_ == currentTime ) )
{
if( bodyUndergoingPositionPartial_ != nullptr )
{
currentPartialWrtUndergoingState_ = bodyUndergoingPositionPartial_->computePartial(
currentTime, radiationPressureAcceleration_->getAcceleration( ), radiationPressureAcceleration_ );
}

if( bodyExertingPositionPartial_ != nullptr )
{
currentPartialWrtExertingState_ = bodyExertingPositionPartial_->computePartial(
currentTime, radiationPressureAcceleration_->getAcceleration( ), radiationPressureAcceleration_ );
}

currentTime_ = currentTime;
}
}
void update( const double currentTime = TUDAT_NAN );

protected:

Expand Down
2 changes: 2 additions & 0 deletions include/tudat/simulation/environment_setup/defaultBodies.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ std::shared_ptr< AtmosphereSettings > getDefaultAtmosphereModelSettings(
const double initialTime,
const double finalTime );

std::shared_ptr<RadiationSourceModelSettings> getKnockeEarthRadiationPressureSettings( );

//! Function to create default settings for a body's radiation source model.
/*!
* Function to create default settings for a body's radiation source model. Currently set to no
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Eigen::Vector3d IsotropicPointSourceRadiationPressureAcceleration::calculateAcce
// No rotation to source frame is necessary because isotropic sources are rotation-invariant
sourceToTargetReceivedFraction = sourceToTargetOccultationModel_->evaluateReceivedFractionFromExtendedSource(
sourceCenterPositionInGlobalFrame_, sourceBodyShapeModel_, targetCenterPositionInGlobalFrame_ );

receivedIrradiance =
sourceModel_->evaluateIrradianceAtPosition( targetCenterPositionInSourceFrame_).front().first * sourceToTargetReceivedFraction;
// std::cout<<"Irradiance "<<receivedIrradiance<<std::endl;
Expand Down
4 changes: 4 additions & 0 deletions src/astro/electromagnetism/radiationSourceModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ DynamicallyPaneledRadiationSourceModel::DynamicallyPaneledRadiationSourceModel(
PaneledRadiationSourceModel(sourceBodyShapeModel, std::move(sourcePanelRadiosityModelUpdater)),
numberOfPanelsPerRing_(numberOfPanelsPerRing)
{
if( sourceBodyShapeModel == nullptr )
{
throw std::runtime_error( "Error when creating dynamically panelled radiation source model; no shape model defined" );
}
numberOfPanels = 1;
for (const auto& numberOfPanelsInCurrentRing : numberOfPanelsPerRing)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ set(acceleration_partials_SOURCES
"polyhedronAccelerationPartial.cpp"
"ringAccelerationPartial.cpp"
"yarkovskyAccelerationPartial.cpp"


"fullRadiationPressureAccelerationPartial.cpp"
)

# Set the header files.
Expand All @@ -49,6 +48,7 @@ set(acceleration_partials_HEADERS
"polyhedronAccelerationPartial.h"
"ringAccelerationPartial.h"
"yarkovskyAccelerationPartial.h"
"fullRadiationPressureAccelerationPartial.h"
)

TUDAT_ADD_LIBRARY("acceleration_partials"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/* Copyright (c) 2010-2019, 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.
*/

#include "tudat/astro/orbit_determination/acceleration_partials/fullRadiationPressureAccelerationPartial.h"

namespace tudat
{

namespace acceleration_partials
{

RadiationPressureAccelerationPartial::RadiationPressureAccelerationPartial(
const std::string acceleratedBody,
const std::string acceleratingBody,
const std::shared_ptr< electromagnetism::PaneledSourceRadiationPressureAcceleration > radiationPressureAcceleration,
const std::shared_ptr< estimatable_parameters::CustomSingleAccelerationPartialCalculatorSet > customAccelerationPartialSet ):
AccelerationPartial( acceleratedBody, acceleratingBody, basic_astrodynamics::custom_acceleration ),
radiationPressureAcceleration_( radiationPressureAcceleration ),
customAccelerationPartialSet_( customAccelerationPartialSet )
{
currentPartialWrtUndergoingState_.setZero( );
currentPartialWrtExertingState_.setZero( );

std::cout<<"Initial state partials "<<std::endl;
for( auto it : customAccelerationPartialSet->customInitialStatePartials_ )
{
std::cout<<"Entries: "<<it.first.first<<" "<<it.first.second.first<<" "<<it.first.second.second<<std::endl;
}
estimatable_parameters::EstimatebleParameterIdentifier undergoingBodyIdentifier =
std::make_pair( estimatable_parameters::initial_body_state, std::make_pair( acceleratedBody, "" ) );
if( customAccelerationPartialSet->customInitialStatePartials_.count( undergoingBodyIdentifier ) > 0 )
{
bodyUndergoingPositionPartial_ = customAccelerationPartialSet->customInitialStatePartials_.at( undergoingBodyIdentifier );
}

estimatable_parameters::EstimatebleParameterIdentifier exertingBodyIdentifier =
std::make_pair( estimatable_parameters::initial_body_state, std::make_pair( acceleratingBody, "" ) );
if( customAccelerationPartialSet->customInitialStatePartials_.count( exertingBodyIdentifier ) > 0 && ( exertingBodyIdentifier != undergoingBodyIdentifier ) )
{
bodyExertingPositionPartial_ = customAccelerationPartialSet->customInitialStatePartials_.at( exertingBodyIdentifier );
}
}

void RadiationPressureAccelerationPartial::update( const double currentTime )
{
radiationPressureAcceleration_->updateMembers( currentTime );

std::cout<<currentTime<<" "<<currentTime_<<std::endl;
if( !( currentTime_ == currentTime ) )
{
std::cout<<"Partials "<<bodyUndergoingPositionPartial_<<" "<<bodyExertingPositionPartial_<<std::endl;
if( bodyUndergoingPositionPartial_ != nullptr )
{
currentPartialWrtUndergoingState_ = bodyUndergoingPositionPartial_->computePartial(
currentTime, radiationPressureAcceleration_->getAcceleration( ), radiationPressureAcceleration_ );
}

if( bodyExertingPositionPartial_ != nullptr )
{
currentPartialWrtExertingState_ = bodyExertingPositionPartial_->computePartial(
currentTime, radiationPressureAcceleration_->getAcceleration( ), radiationPressureAcceleration_ );
}

currentTime_ = currentTime;
}
}

}

}
8 changes: 8 additions & 0 deletions src/simulation/environment_setup/defaultBodies.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ std::shared_ptr< AtmosphereSettings > getDefaultAtmosphereModelSettings(
return atmosphereSettings;
}

std::shared_ptr<RadiationSourceModelSettings> getKnockeEarthRadiationPressureSettings( )
{
// Model from Knocke (1988)
return extendedRadiationSourceModelSettings({
albedoPanelRadiosityModelSettings(SecondDegreeZonalPeriodicSurfacePropertyDistributionModel::albedo_knocke, "Sun"),
delayedThermalPanelRadiosityModelSettings(SecondDegreeZonalPeriodicSurfacePropertyDistributionModel::emissivity_knocke, "Sun")
}, {6, 12});
}
//! Function to create default settings for a body's radiation source model.
std::shared_ptr<RadiationSourceModelSettings> getDefaultRadiationSourceModelSettings(
const std::string &bodyName,
Expand Down
Loading

0 comments on commit f781174

Please sign in to comment.