Skip to content

Commit

Permalink
refer to user guide, fix plot labels
Browse files Browse the repository at this point in the history
  • Loading branch information
larshinueber committed Aug 27, 2024
1 parent d73702a commit 4fc6fce
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 41 deletions.
46 changes: 25 additions & 21 deletions propagation/solar_system_propagation.ipynb

Large diffs are not rendered by default.

44 changes: 24 additions & 20 deletions propagation/solar_system_propagation.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Solar System Propagation
# Solar System Propagation using Multi-Body Dynamics
"""
Copyright (c) 2010-2022, Delft University of Technology. All rights 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.
Expand All @@ -13,10 +13,11 @@
In order to consistently simulate the evolution of such a system, the equations of motion of all massive bodies have to be propagated concurrently in a multi-body propagation.
The example showcases the versatility with which the propagation_setup module allows for advanced multi-body acceleration models and propagators.
Via the selected_acceleration_per_body argument of the `propagation_setup.create_acceleration_models()` function, acceleration model settings can be defined for an arbitrary amount of bodies in the system.
Via the `selected_acceleration_per_body` argument of the `propagation_setup.create_acceleration_models()` function, acceleration model settings can be defined for an arbitrary amount of bodies in the system.
The central_bodies argument gives the option specify the centre of propagation for each propagated body individually.
In this script, this feature is used to implement a hierarchical propagation scheme.
The `central_bodies` argument gives the option specify the centre of propagation for each propagated body individually.
In this script, this feature is used to implement a hierarchical propagation scheme along with a barycentric propagation scheme.
For more information on the multi-body dynamics propagation in Tudat, refer to the [user guide](https://docs.tudat.space/en/latest/_src_user_guide/state_propagation/propagation_setup/multi_body.html).
"""

## Import statements
Expand Down Expand Up @@ -45,10 +46,10 @@
"""
NAIF's `SPICE` kernels are first loaded, so that the position of various bodies such as the Earth can be make known to `tudatpy`.
Then, the start and end simulation epochs are setups. In this case, the start epoch is set to `1e7`, corresponding to 10 million seconds ($\approx$ 115.74 days) after the 1st of January 2000. The end epoch is set 5 years later.
Then, the start and end simulation epochs are setups. In this case, the start epoch is set arbitrarily to 25th of April 2000. The end epoch is set 5 years later.
The times should always be specified in seconds since J2000.
Please refer to the API documentation of the `time_conversion module` [here](https://tudatpy.readthedocs.io/en/latest/time_conversion.html) for more information on this.
Please refer to the API documentation of the `time_conversion` module [here](https://tudatpy.readthedocs.io/en/latest/time_conversion.html) for more information on this.
"""

# Load spice kernels
Expand All @@ -71,7 +72,7 @@
The default body settings (such as atmosphere, body shape, rotation model) are taken from `SPICE`.
These settings can be adjusted. Please refer to the [Available Environment Models](https://tudat-space.readthedocs.io/en/latest/_src_user_guide/state_propagation/environment_setup/create_models/available.html#available-environment-models) in the user guide for more details.
These settings can be adjusted. Please refer to the [Available Environment Models](https://docs.tudat.space/en/latest/_src_user_guide/state_propagation/environment_setup/environment_models.html) in the user guide for more details.
Finally, the system of bodies is created using the settings. This system of bodies is stored into the variable `body_system`.
"""
Expand Down Expand Up @@ -221,7 +222,7 @@
Each of the bodies can now be simulated.
This is done by calling the `create_dynamics_simulator()` function of the `numerical_simulation` module.
This function requires the `body_system` and the appropriate `propagator_settings_X` (with X being the propagation varian), that have all been defined earlier.
This function requires the `body_system` and the appropriate `propagator_settings_X` (with X being the propagation variant), that have all been defined earlier.
In the same step, the history of the propagated states over time, containing both the position and velocity history, is extracted.
This history takes the form of a dictionary. The keys are the simulated epochs, and the values are an array containing the states of all of the bodies one after another.
Expand Down Expand Up @@ -290,17 +291,17 @@
hierarchical_system_state_array = result2array(results_hierarchical)

fig1 = plt.figure(figsize=(8, 20))
ax1 = fig1.add_subplot(311, projection='3d')
ax1.set_title(f'Trajectory of the Sun w.r.t SSB')
ax1.scatter(0, 0, 0, marker='x', label="Sun")
ax1 = fig1.add_subplot(311, projection="3d")
ax1.set_title(f"Trajectory of the Sun w.r.t SSB")
ax1.scatter(0, 0, 0, marker="x", label="SSB")

ax2 = fig1.add_subplot(312, projection='3d')
ax2.set_title(f'System state evolution w.r.t Sun')
ax2.scatter(0, 0, 0, marker='x', label="SSB")
ax2 = fig1.add_subplot(312, projection="3d")
ax2.set_title(f"System state evolution w.r.t Sun")
ax2.scatter(0, 0, 0, marker="x", label="Sun")

ax3 = fig1.add_subplot(313, projection='3d')
ax3.set_title(f'Trajectory of the Moon w.r.t Earth')
ax3.scatter(0, 0, 0, marker='x', label="Earth")
ax3 = fig1.add_subplot(313, projection="3d")
ax3.set_title(f"Trajectory of the Moon w.r.t Earth")
ax3.scatter(0, 0, 0, marker="x", label="Earth")

for i, body in enumerate(bodies_to_propagate):

Expand All @@ -315,9 +316,12 @@
label=body)

elif body == "Moon":
ax3.plot(hierarchical_system_state_array[:, 6 * i + 1], hierarchical_system_state_array[:, 6 * i + 2],
hierarchical_system_state_array[:, 6 * i + 3],
label=body)
ax3.plot(
hierarchical_system_state_array[:, 6 * i + 1],
hierarchical_system_state_array[:, 6 * i + 2],
hierarchical_system_state_array[:, 6 * i + 3],
label=body,
)

axs = [ax1, ax2, ax3]
ax_lims = [[-2.0E9, 2.0E9], [-2.5E11, 2.5E11], [-4.0E8, 4.0E8]] # equal axis limit per subplot, [m]
Expand Down

0 comments on commit 4fc6fce

Please sign in to comment.