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

Program terminating unexpectedly when atmospheric drag is off #108

Closed
aleixpinardell opened this issue Dec 14, 2016 · 4 comments
Closed

Comments

@aleixpinardell
Copy link
Member

If I "turn off" atmospheric drag by commenting out this line:

accelerationsOfRocket[ "Earth" ].push_back( boost::make_shared< AccelerationSettings >( basic_astrodynamics::aerodynamic ) );

the program ends unexpectedly without printing any warning or error massage.

Apparently it may have something to do with the limit on the altitude for the termination settings. These are my termination conditions:

        // Hybrid termination conditions
        std::vector< boost::shared_ptr< propagators::PropagationTerminationSettings > > constituentSettings;

        // Time limit
        constituentSettings.push_back( boost::make_shared< propagators::PropagationTimeTerminationSettings >( simulationEndEpoch ) );

        // Altitude limit
        boost::shared_ptr< PropagationTerminationSettings > altitudeTerminationSettings = boost::make_shared< propagators::PropagationDependentVariableTerminationSettings >( boost::make_shared< propagators::SingleDependentVariableSaveSettings >( propagators::altitude_dependent_variable, "Rocket" ), 100.0E3, 1 );
        constituentSettings.push_back( altitudeTerminationSettings );

        // Stop if ANY of the two is met
        boost::shared_ptr< PropagationTerminationSettings > terminationSettings = boost::make_shared< propagators::PropagationHybridTerminationSettings >( constituentSettings, 1 );

@DominicDirkx I don't think it is related to the save settings because the line for the altitude is actually commented out:

        std::vector< boost::shared_ptr< SingleDependentVariableSaveSettings > > dependentVariablesToSave;
        // dependentVariablesToSave.push_back( boost::make_shared< SingleDependentVariableSaveSettings >( altitude_dependent_variable, "Rocket" ) );
        // dependentVariablesToSave.push_back( boost::make_shared< SingleDependentVariableSaveSettings >( aerodynamic_moment_coefficients_dependent_variable, "Rocket" ) );
        // dependentVariablesToSave.push_back( boost::make_shared< SingleAccelerationDependentVariableSaveSettings >( spherical_harmonic_gravity, "Rocket", "Earth", 0 ) );
        // dependentVariablesToSave.push_back( boost::make_shared< SingleAccelerationDependentVariableSaveSettings >( third_body_central_gravity, "Rocket", "Sun", 0 ) );
        // dependentVariablesToSave.push_back( boost::make_shared< SingleAccelerationDependentVariableSaveSettings >( third_body_central_gravity, "Rocket", "Moon", 0 ) );

        dependentVariablesToSave.push_back( boost::make_shared< SingleDependentVariableSaveSettings >( relative_position_dependent_variable, "Rocket", "Earth" ) );
        dependentVariablesToSave.push_back( boost::make_shared< SingleDependentVariableSaveSettings >( relative_position_dependent_variable, "Sun", "Earth" ) );

        boost::shared_ptr< DependentVariableSaveSettings > dependentVariableSaveSettings = boost::make_shared< DependentVariableSaveSettings >( dependentVariablesToSave, 0 ) ;

@DominicDirkx
Copy link
Member

The source of the error is in your termination conditions, I think. It uses the altitude, which is normally retrieved from the flight conditions. Flight conditions are created when an aerodynamic acceleratoon is created. If the aerodynamic acceleration is turnednoff, there are no flight conditions and 'no altitude'.

This is a bug that should be resolved. In the mean time, you can cheat by setting the aerodynamic coefficients to zero.

@DominicDirkx
Copy link
Member

I've added an error message to the code that lets the user know why the program is terminating.

The fix I'd like to propose for this is the following:

  • When the altitude (or any other dependent variable that requires FlightConditions) is requested and not FlightConditions are available in the body, the code will create this object on the fly. Also, this will require the EnvironmentUpdater to be passed the information that the FlightConditions are to be updated at each time step. All functionality required for this is in place, it's just a matter of switching some things around and linking stuff together.

However, this could be a significant overhead in terms of computations: updating the FlightConditions is not a trivial operation in terms of computation time.(compared to e.g. computing a central body gravitational acceleration). Therefore, I propose to add a warning when the FlightConditions is created that this could incur a significant performance overhead. The flight conditions are being overhauled to allow greater flexibility (#91). In a next iteration, we could try to find a way to only have to compute the altitude if nothing else is computed.

What do you think?

@aleixpinardell
Copy link
Member Author

I think the ideal solution would be to compute the altitude from the current state vector of the orbiting body (and the shape model of the central body) when no FlightConditions are available. Although I don't know if this is easy to implement.

@DominicDirkx
Copy link
Member

If the issue were only the altitude, I would tend to agree, but since there is a whole host of dependent variables that require the FlightConditions, the problem is not an isolated one. However, it may be more efficient to compute those dependent variables for which it is feasible outside of the FlightConditions, only creating a FlightConditions if it is really necessary..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants