The FARGO_THORIN code developer's guide
 All Data Structures Files Functions Variables Typedefs Macros
Functions | Variables
ReboundInterface.c File Reference

Contains the functions interfacing FARGO with the REBOUND package. More...

#include "fargo.h"
Include dependency graph for ReboundInterface.c:

Go to the source code of this file.

Functions

int ResolveCollisions (struct reb_simulation *rsim, struct reb_collision coll)
 If the REBOUND collision search is successful, this function merges the bodies, outputs information about the merger event and reorganises the particle list. More...
 
void DiscardParticlesDist (struct reb_simulation *rsim, real dt)
 A simple discard routine which looks for planets that were scattered/migrated away from the FARGO grid. More...
 
void SetupIntegratorParams (struct reb_simulation *rsim)
 Fills the rebound simulation structure with parameters inherited from FARGO. More...
 
struct reb_simulation * SetupReboundSimulation (PlanetarySystem *sys, char *plfile)
 Initialises a rebound simulation coupled with FARGO. More...
 
void AdvanceSystemRebound (PlanetarySystem *sys, struct reb_simulation *rsim, real dt)
 Performs an integration step of the N-body problem. More...
 
void SynchronizeFargoRebound (PlanetarySystem *sys, struct reb_simulation *rsim)
 Synchronises the planetary system between the REBOUND integration and the FARGO simulation. More...
 
void MinStepForRebound (struct reb_simulation *rsim)
 A simple time step restriction in order not to miss a collision. More...
 
void OutputElements (struct reb_simulation *rsim)
 Calculates and outputs the orbital elements. More...
 
void OutputNbodySimulation (int nout, struct reb_simulation *rsim)
 Stores the entire Rebound simulation in a binary file. More...
 
struct reb_simulation * RestartReboundSimulation (PlanetarySystem *sys, int nrestart)
 Part of the restart process. More...
 

Variables

real OmegaFrame
 
boolean Corotating
 

Detailed Description

Contains the functions interfacing FARGO with the REBOUND package.

Author
Ondřej Chrenko chren.nosp@m.ko@s.nosp@m.irrah.nosp@m..tro.nosp@m.ja.mf.nosp@m.f.cu.nosp@m.ni.cz

The default setup uses the IAS15 integrator to propagate the planets in time and employs the direct collision search with merging, if turned on. This can be easily reprogrammed if needed.

Note: This version has no test particles, rsim->N could be used directly as the loop limit. But rsim->N_active is used instead so that test particles could be easily implemented. If rsim->N is used, it indicates that a loop would in principle handle test particles as well.

LICENSE

Copyright (c) 2017 Ondřej Chrenko. See the LICENSE file of the distribution.

Definition in file ReboundInterface.c.

Function Documentation

void AdvanceSystemRebound ( PlanetarySystem sys,
struct reb_simulation *  rsim,
real  dt 
)

Performs an integration step of the N-body problem.

Definition at line 197 of file ReboundInterface.c.

References DiscardParticlesDist(), planetary_system::mass, and PhysicalTime.

Here is the call graph for this function:

void DiscardParticlesDist ( struct reb_simulation *  rsim,
real  dt 
)

A simple discard routine which looks for planets that were scattered/migrated away from the FARGO grid.

Must be called from the heliocentric frame.

Definition at line 75 of file ReboundInterface.c.

References CPU_Master, discard, masterprint(), NO, PhysicalTime, RMAX, and YES.

Referenced by AdvanceSystemRebound().

Here is the call graph for this function:

Here is the caller graph for this function:

void MinStepForRebound ( struct reb_simulation *  rsim)

A simple time step restriction in order not to miss a collision.

This should be in principle always be overridden by the IAS15 time step division.

Definition at line 281 of file ReboundInterface.c.

References invdtreb_sq.

void OutputElements ( struct reb_simulation *  rsim)

Calculates and outputs the orbital elements.

Definition at line 309 of file ReboundInterface.c.

References CPU_Number, CPU_Rank, G, PhysicalTime, and plout.

void OutputNbodySimulation ( int  nout,
struct reb_simulation *  rsim 
)

Stores the entire Rebound simulation in a binary file.

Useful for restarts.

Definition at line 328 of file ReboundInterface.c.

References CPU_Master, and OUTPUTDIR.

int ResolveCollisions ( struct reb_simulation *  rsim,
struct reb_collision  coll 
)

If the REBOUND collision search is successful, this function merges the bodies, outputs information about the merger event and reorganises the particle list.

Definition at line 33 of file ReboundInterface.c.

References CPU_Master, masterprint(), and mergers.

Referenced by SetupIntegratorParams().

Here is the call graph for this function:

Here is the caller graph for this function:

struct reb_simulation* RestartReboundSimulation ( PlanetarySystem sys,
int  nrestart 
)

Part of the restart process.

Definition at line 343 of file ReboundInterface.c.

References ACCRETIONRATE, Collisions, CPU_Master, discard, FeelDisk, fopenp(), mergers, OUTPUTDIR, PhysicalTime, plout, SetupIntegratorParams(), and YES.

Here is the call graph for this function:

void SetupIntegratorParams ( struct reb_simulation *  rsim)

Fills the rebound simulation structure with parameters inherited from FARGO.

The integrator type can be easily changed from here.

Definition at line 111 of file ReboundInterface.c.

References Collisions, IAS15MINDT, IAS15PRECISSION, ResolveCollisions(), and YES.

Referenced by RestartReboundSimulation(), and SetupReboundSimulation().

Here is the call graph for this function:

Here is the caller graph for this function:

struct reb_simulation* SetupReboundSimulation ( PlanetarySystem sys,
char *  plfile 
)

Initialises a rebound simulation coupled with FARGO.

Definition at line 127 of file ReboundInterface.c.

References a, ACCRETIONRATE, Collisions, discard, FeelDisk, fopenp(), G, masterprint(), mergers, OUTPUTDIR, PI, PLANETARYDENSITY, plout, prs_exit(), RHO2CGS, SetupIntegratorParams(), and YES.

Here is the call graph for this function:

void SynchronizeFargoRebound ( PlanetarySystem sys,
struct reb_simulation *  rsim 
)

Synchronises the planetary system between the REBOUND integration and the FARGO simulation.

Definition at line 250 of file ReboundInterface.c.

References NO, prs_exit(), and YES.

Here is the call graph for this function:

Variable Documentation

boolean Corotating

Definition at line 30 of file Interpret.c.

real OmegaFrame

Definition at line 20 of file global.h.