Output Functions

group OutputRebFunctions

List of the built-in output functions for REBOUND

Functions

int reb_output_check(struct reb_simulation *r, double interval)

This function checks if a new output is required at this time.

This is typically used within the heartbeat function to generate equally spaced outputs.

Return

The return value is 1 if an output is required and 0 otherwise.

Parameters
  • interval: Output interval.

  • r: The rebound simulation to be considered

void reb_output_timing(struct reb_simulation *r, const double tmax)

Output status information on the screen.

Outputs the current number of particles, the time and the time difference since the last output to the screen.

Parameters
  • r: The rebound simulation to be considered

  • tmax: The maximum integration time (used to calculate the progress in percent)

void reb_output_orbits(struct reb_simulation *r, char *filename)

Append an ASCII file with orbital paramters of all particles.

The orbital parameters are calculated in Jacobi coordinates. Particles are assumed to be sorted from the inside out, the central object having index 0. Each time the function is called N-1 rows are appended to the file with name filename. Each row in the file corresponds to one particle and contains the following columns (tab separated): time, semi-major axis, eccentricity, inclination, Omega (longitude ascending node), omega (argument of pericenter), lambda (mean longitude), period, f (true anomaly).

Parameters
  • r: The rebound simulation to be considered

  • filename: Output filename.

void reb_output_binary(struct reb_simulation *r, const char *filename)

Save the reb_simualtion structure as a binary.

This function can be used to save the current status of a REBOUND simualtion and later restart the simualtion.

Parameters
  • r: The rebound simulation to be considered

  • filename: Output filename.

void reb_binary_diff(char *buf1, size_t size1, char *buf2, size_t size2, char **bufp, size_t *sizep)

This function compares two REBOUND simulations and records the difference in a buffer.

This is used for taking a SimulationArchive Snapshot.

Parameters
  • buf1: The buffer corresponding to the first rebound simulation to be compared

  • buf2: The buffer corresponding to the second rebound simulation to be compared

  • bufp: The buffer which will contain the differences.

int reb_binary_diff_with_options(char *buf1, size_t size1, char *buf2, size_t size2, char **bufp, size_t *sizep, int output_option)

Same as reb_binary_diff but with more options.

Return

0 is returned if the simulations do not differ (are equal). 1 is return if they differ.

Parameters
  • output_option: If set to 0, the differences are written to bufp. If set to 1, printed on the screen. If set to 2, then only the return value indicates any differences.

void reb_output_ascii(struct reb_simulation *r, char *filename)

Append the positions and velocities of all particles to an ASCII file.

Parameters
  • r: The rebound simulation to be considered

  • filename: Output filename.

void reb_output_binary_positions(struct reb_simulation *r, const char *filename)

Write the positions of all particles to a binary file.

Parameters
  • r: The rebound simulation to be considered

  • filename: Output filename.

void reb_output_velocity_dispersion(struct reb_simulation *r, char *filename)

Append the velocity dispersion of the particles to an ASCII file.

Parameters
  • r: The rebound simulation to be considered

  • filename: Output filename.