# Mass Dynamics

Settings to propagate the mass of a body numerically can be created through the
`mass()`

factory function, described
in detail in the API documentation. In the current page, only the
Tudat-specific aspects of the input will be briefly described.

The mass is typically propagated numerically to account for the influence of thrust on a vehicle’s mass. Unlike other types of dynamics, there are no alternative representations (propagators) for the mass.

## Inputs

In addition to the general propagation settings described here, the definition of rotational dynamics settings requires:

A set of mass models (created via the

`create_mass_rate_models()`

factory function; see below)The initial conditions for the propagation (initial mass and time)

## Mass-rate models

The setup of a mass rate model in Tudat is substantially simpler than for the accelerations and torques. This is, in part, due to the very limited set of options for computing mass rates.

Typically, a mass rate is directly related to a body’s thrust (a user may use thrust without mass propagation, although this will neglect part of the physics of the problem(. An example of this is shown below, where all thrust accelerations acting on a vehicle (which include a definition of specific impulse) are used to compute the mass rate. Note that the acceleration models, created as discussed here, are required as input, to link the thrust acceleration to the mass rate.

Required

Show/Hidefrom tudatpy.kernel.numerical_simulation import propagation_setupmass_rate_settings = dict(Vehicle=[propagation_setup.mass_rate.from_thrust()]) mass_rate_models = propagation_setup.create_mass_rate_models( system_of_bodies, mass_rate_settings, acceleration_models )

- language
cpp

For a full description of available functions, see associated pages of mass-rate models and thrust models in the API documentation. For mass rate models that are not internally associated with thrust (for whatever reason), the user is recommended to use the `custom_mass_rate()`

function.

## Example

In the example below, the body “Spacecraft” will be propagated w.r.t. body “Earth”, using given mass
rate models and a given initial mass. A Runge Kutta 4 integrator is defined with step-size of 2
seconds. The propagation will terminate once the `simulation_end_epoch`

termination condition is
reached. Next to that, the propagator is asked to save the Keplerian state of the spacecraft as
dependent variable. The time and rotational state will be printed on the terminal once every 24
hours (simulation time).

Required

Show/Hidefrom tudatpy.kernel.numerical_simulation import propagation_setup# Create physical environment bodies = environment_setup.create_system_of_bodies( ... ) # Define bodies that are propagated bodies_to_propagate = ["Spacecraft"] # Create mass rate models, note that the model below will only work as part of a # multitype propagation, where mass and translational state are propagated, and # a thrust acceleration is acting on the spacecraft mass_rate_settings = dict(Vehicle=[propagation_setup.mass_rate.from_thrust()]) mass_rate_models = propagation_setup.create_mass_rate_models( bodies, mass_rate_settings, acceleration_models ) # Define initial conditions initial_mass = 3400.0 # kg # Define numerical integrator (RK4; step size 2 seconds) integrator_settings = propagation_setup.integrator.runge_kutta_4( 2.0 ) # Start of simulation simulation_start_epoch = 9120.0 * constants.JULIAN_DAY # Define termination settings simulation_end_epoch = 9140 * constants.JULIAN_DAY termination_settings = propagation_setup.propagator.time_termination( simulation_end_epoch ) # Define dependent variables dependent_variables_to_save = [propagation_setup.dependent_variable.total_mass_rate("Spacecraft")] # Define mass propagator settings mass_propagator_settings = propagation_setup.propagator.mass( mass_rate_models, bodies_to_propagate, initial_mass, simulation_start_epoch, integrator_settings, termination_settings, output_variables=dependent_variables_to_save, print_interval=86400.0)// required include statements #include <tudat/simulation/simulation.h> // required using-declarations using tudat::simulation_setup; using tudat;