SMILE
v2.5
Schwarzschild Modelling Interactive expLoratory Environment
|
Class for performing a single orbit integration. More...
#include <orbitint.h>
Public Types | |
enum | ORBITSTATE { OS_INITIALIZED, OS_RUNNING, OS_DONE } |
three stages of orbit integration | |
Public Types inherited from smile::COdeSystem | |
enum | STEPRESULT { SR_CONTINUE, SR_TERMINATE, SR_REINIT } |
result of processing of a timestep More... | |
Public Member Functions | |
template<typename NumT > | |
COrbit (const CConfigOrbit *_configOrbit, const CPotential *_potential, const CPosVelPoint< NumT > &_initCond, const vectorRuntimeFncCreators *creators, double _timeEnd, double _timeMax=0) | |
construct from given initial conditions and optionally list of runtime function creators | |
template<typename NumT > | |
COrbit (const CConfigOrbit *_configOrbit, const CPotential *_potential, const std::vector< CPosVelPoint< NumT > > &_traj, double _timeStep) | |
construct from an existing trajectory in a given potential (for instance, loaded from a file | |
virtual | ~COrbit () |
destructor deletes all associated runtime functions | |
virtual void | initState (OdeStateType *state) |
initializes the working variables of ODE integrator (using InitData as input, assigning values to the output vector "state") | |
virtual void | odeFnc (double t, const OdeStateType &x, OdeStateType *dx) |
provides the time derivative of ODE integration variables (equations of motion) | |
virtual bool | isStdHamiltonian () |
defines whether the ODE variables are canonical and represent a separable hamiltonian system. More... | |
virtual double | getRelErrorToleranceFactor (const OdeStateType &state) const |
allows to tighten error tolerance for ODE integrator near the black hole | |
virtual STEPRESULT | processStep (double timePrev, double timeCurr, OdeStateType *state) |
do some data recording and processing after each integration timestep. More... | |
void | run () |
integrate orbit up to the timeEnd provided in the constructor; if any of runtime functions returns false then continue until all of them return true or timeMax is reached; timeMax=0 means timeMax=timeEnd | |
void | halt () |
called if it is necessary to stop integration immediately; raises internal termination flag | |
double | getPos (unsigned int c, double t) const |
returns c-th coordinate interpolated at time t within currect timestep interval | |
double | getVel (unsigned int c, double t) const |
returns c-th velocity interpolated at time t within currect timestep interval | |
double | getLogDevVec (double t) const |
returns Ln(w) - logarithm of deviation vector at time t within current timestep | |
ORBITSTATE | getState () const |
return current state (unstarted/running/done) | |
double | getIntTime () const |
if the orbit is running, return integration time to which it has already progressed, otherwise return the total integration time if it is finished, or 0 if it hasn't started yet | |
const CPosVelPoint< double > & | getInitCond () const |
return initial conditions | |
const CPosVelPoint< double > & | getEndCond () const |
return end point (after integration is finished) | |
const CPotential * | getPotential () const |
return pointer to potential used in integration | |
double | getTimeUnit () const |
return the period of long-axis orbit with the same energy as this one | |
const CConfigOrbit * | getConfig () const |
return pointer to configuration parameters (may be needed by runtime functions) | |
const CBasicOrbitRuntimeFnc * | getRuntimeFnc (size_t index) const |
return pointer to the runtime function at the given index | |
const CBasicInformation * | getNewInfo (size_t index) const |
convenience function: create and return result information object for the given runtime function index; warning: the returned value may be NULL | |
size_t | getInfoNum () const |
return the total number of runtime functions | |
std::string | toString (bool withRuntimeFncInfo=true) const |
return some textual information about the orbit, optionally with contributions from all runtime function information objects | |
Private Attributes | |
const CPotential * | potential |
pointer to the potential used in integration | |
const CConfigOrbit * | configOrbit |
pointer to the configuration structure keeping various integration and analysis parameters | |
const CPosVelPoint< double > | initCond |
initial conditions for the orbit | |
CPosVelPoint< double > | endCond |
end point of the orbit | |
double | timeUnit |
time unit = period of radial orbit with the same energy as this one (computed at most once if needed, then cached) | |
volatile ORBITSTATE | state |
current state of affairs | |
volatile bool | needToTerminate |
a flag raised internally or externally if the integration should be finished immediately | |
CBasicOdeIntegrator * | odeInt |
pointer to orbit integrator if it is running, otherwise NULL | |
bool | isCanonicalVel |
in the case Omega!=0, this flag specifies whether the velocity in Ode integrator is a canonical variable or refers to time derivative of coordinate | |
vectorRuntimeFncs | runtimeFncs |
holds all attached 'timestep functions' (if any). They are destroyed along with COrbit! | |
double | timeEnd |
integration time - 0 if it hasn't started yet, or the actual duration when finished | |
double | timeMax |
maximum allowed integration time (0 means equal to timeEnd) | |
size_t | numFncEval |
count the number of force evaluations | |
size_t | numSteps |
count the number of timesteps taken by ODE integrator | |
int | varEqMethod |
whether and how to compute the evolution of the deviation vector used in estimating the Lyapunov exponent. More... | |
int | drdtsign |
direction of motion at prev timestep, to keep track of peri/apocenter passages | |
bool | needrenorm |
flag set when renormalization of deviation vector required (usually close to pericenter) | |
bool | allowrenorm |
flag set when it is allowed to do the renormalization (in apocenter) | |
double | lnwadd |
additional summand for log deviation vector (if it was renormalized) | |
double | Etoler |
factor determining the accuracy of energy conservation in timestep selection | |
Class for performing a single orbit integration.
COrbit is an interface class that stores the orbit initial data, calls one of the available orbit integrators (derived from CBasicOdeIntegrator), and stores and provides access to orbit runtime functions and their information objects (e.g. trajectory and spectrum analysis, Poincare section, etc.). Its interface with ODE integrators is derived from the COdeSystem class, which provides the way to initialize and, if necessary, modify variables in the course of integration, and provide the r.h.s. of the equations of motion. The exact "meaning" of integration variables is defined by this class: it provides methods to access position and velocity as a function of time during integration, which are, in turn, provided by ODE integrator and transformed according to the internal representation.
|
inlinevirtual |
defines whether the ODE variables are canonical and represent a separable hamiltonian system.
Presently, the internal representation of integration variables is always in canonical coordinates – first come positions, then velocities; this allows for some simplifications in ODE integrator
Reimplemented from smile::COdeSystem.
|
virtual |
do some data recording and processing after each integration timestep.
Calls each of the runtime functions at each timestep and performs some other checks.
[in,out] | state | is the vector of integration variables at the end of timestep; if necessary, it may be transformed (e.g.rescaled). |
[in] | timePrev | is the time at the beginning of time step. |
[in] | timeCurr | is the time at the end of time step. |
Implements smile::COdeSystem.
|
private |
whether and how to compute the evolution of the deviation vector used in estimating the Lyapunov exponent.
0 - no dev.vec., 1 - integrate a nearby orbit, 2 - use variational equation