PeTar
N-body code for collisional gravitational systems
ARInteraction Class Reference

AR interaction clas. More...

#include <ar_interaction.hpp>

Public Types

typedef H4::ParticleH4< PtclHardH4Ptcl
 

Public Member Functions

 ARInteraction ()
 
bool checkParams ()
 (Necessary) check whether publicly initialized parameters are correctly set More...
 
void print (std::ostream &_fout) const
 print parameters More...
 
Float calcInnerAccPotAndGTKickInvTwo (AR::Force &_f1, AR::Force &_f2, Float &_epot, const PtclHard &_p1, const PtclHard &_p2)
 (Necessary) calculate inner member acceleration, potential and inverse time transformation function gradient and factor for kick (two-body case) More...
 
Float calcInnerAccPotAndGTKickInv (AR::Force *_force, Float &_epot, const PtclHard *_particles, const int _n_particle)
 calculate inner member acceleration, potential and inverse time transformation function gradient and factor for kick More...
 
void calcAccPert (AR::Force *_force, const PtclHard *_particles, const int _n_particle, const H4Ptcl &_particle_cm, const ARPerturber &_perturber, const Float _time)
 (Necessary) calculate acceleration from perturber and the perturbation factor for slowdown calculation More...
 
Float calcAccPotAndGTKickInv (AR::Force *_force, Float &_epot, const PtclHard *_particles, const int _n_particle, const H4Ptcl &_particle_cm, const ARPerturber &_perturber, const Float _time)
 (Necessary) calculate acceleration from internal members and perturbers More...
 
Float calcPertFromForce (const Float *_force, const Float _mp, const Float _mpert)
 calculate perturbation from c.m. acceleration More...
 
template<class Tparticle >
int modifyOneParticle (Tparticle &_p, const Float &_time_now, const Float &_time_end)
 (Necessary) modify one particle function More...
 
int modifyAndInterruptIter (AR::InterruptBinary< PtclHard > &_bin_interrupt, AR::BinaryTree< PtclHard > &_bin)
 (Necessary) modify the orbits and interrupt check More...
 
Float calcGTDriftInv (Float _ekin_minus_etot)
 (Necessary) calcualte the inverse time transformation factor for drift More...
 
Float calcH (Float _ekin_minus_etot, Float _epot)
 (Necessary) calculate the time transformed Hamiltonian More...
 
void writeBinary (FILE *_fp) const
 write class data to file with binary format More...
 
void readBinary (FILE *_fin)
 read class data to file with binary format More...
 

Static Public Member Functions

static Float calcPertFromBinary (const COMM::Binary &_bin)
 calculate perturbation from binary tree More...
 
static Float calcPertFromMR (const Float _r, const Float _mp, const Float _mpert)
 calculate perturbation from distance to perturber and masses of particle and perturber More...
 

Public Attributes

Float eps_sq
 
Float gravitational_constant
 

softening parameter

More...
 

Detailed Description

AR interaction clas.

Member Typedef Documentation

◆ H4Ptcl

typedef H4::ParticleH4<PtclHard> ARInteraction::H4Ptcl

Constructor & Destructor Documentation

◆ ARInteraction()

ARInteraction::ARInteraction ( )
inline

Member Function Documentation

◆ calcAccPert()

void ARInteraction::calcAccPert ( AR::Force *  _force,
const PtclHard _particles,
const int  _n_particle,
const H4Ptcl _particle_cm,
const ARPerturber _perturber,
const Float  _time 
)
inline

(Necessary) calculate acceleration from perturber and the perturbation factor for slowdown calculation

Parameters
[out]_forceforce array to store the calculation results (in acc_pert[3], notice acc_pert may need to reset zero to avoid accummulating old values)
[in]_particlesmember particle array
[in]_n_particlenumber of member particles
[in]_particle_cmcenter-of-mass particle
[in]_perturberpertuber container
[in]_timecurrent time
Here is the caller graph for this function:

◆ calcAccPotAndGTKickInv()

Float ARInteraction::calcAccPotAndGTKickInv ( AR::Force *  _force,
Float &  _epot,
const PtclHard _particles,
const int  _n_particle,
const H4Ptcl _particle_cm,
const ARPerturber _perturber,
const Float  _time 
)
inline

(Necessary) calculate acceleration from internal members and perturbers

The Force class acc_pert should be updated

Parameters
[out]_forceforce array to store the calculation results (in acc_pert[3], notice acc_pert may need to reset zero to avoid accummulating old values)
[out]_epotpotential
[in]_particlesmember particle array
[in]_n_particlenumber of member particles
[in]_particle_cmcenter-of-mass particle
[in]_perturberpertuber container
[in]_timecurrent time
Returns
perturbation energy to calculate slowdown factor
Here is the call graph for this function:

◆ calcGTDriftInv()

Float ARInteraction::calcGTDriftInv ( Float  _ekin_minus_etot)
inline

(Necessary) calcualte the inverse time transformation factor for drift

The time transformation factor for drift only depends on (kinetic energy - total energy)

Parameters
[in]_ekin_minus_etotekin - etot

◆ calcH()

Float ARInteraction::calcH ( Float  _ekin_minus_etot,
Float  _epot 
)
inline

(Necessary) calculate the time transformed Hamiltonian

calculate the time transformed Hamiltonian

Parameters
[in]_ekin_minus_etotekin - etot

◆ calcInnerAccPotAndGTKickInv()

Float ARInteraction::calcInnerAccPotAndGTKickInv ( AR::Force *  _force,
Float &  _epot,
const PtclHard _particles,
const int  _n_particle 
)
inline

calculate inner member acceleration, potential and inverse time transformation function gradient and factor for kick

Parameters
[out]_forceforce array to store the calculation results (in acc_in[3] for acceleration and gtgrad[3] for gradient, notice acc/gtgard may need to reset zero to avoid accummulating old values)
[out]_epottotal inner potential energy
[in]_particlesmember particle array
[in]_n_particlenumber of member particles
Returns
the inverse time transformation factor (gt_kick_inv) for kick step
Here is the caller graph for this function:

◆ calcInnerAccPotAndGTKickInvTwo()

Float ARInteraction::calcInnerAccPotAndGTKickInvTwo ( AR::Force &  _f1,
AR::Force &  _f2,
Float &  _epot,
const PtclHard _p1,
const PtclHard _p2 
)
inline

(Necessary) calculate inner member acceleration, potential and inverse time transformation function gradient and factor for kick (two-body case)

Parameters
[out]_f1force for particle 1 to store the calculation results (in acc_in[3] for acceleration and gtgrad[3] for gradient, notice acc/gtgard are overwritten, not accummulating old values)
[out]_f2force for particle 2
[out]_epottotal inner potential energy
[in]_p1particle 1
[in]_p2particle 2
Returns
the inverse time transformation factor (gt_kick_inv) for kick step
Here is the caller graph for this function:

◆ calcPertFromBinary()

static Float ARInteraction::calcPertFromBinary ( const COMM::Binary &  _bin)
inlinestatic

calculate perturbation from binary tree

◆ calcPertFromForce()

Float ARInteraction::calcPertFromForce ( const Float *  _force,
const Float  _mp,
const Float  _mpert 
)
inline

calculate perturbation from c.m. acceleration

◆ calcPertFromMR()

static Float ARInteraction::calcPertFromMR ( const Float  _r,
const Float  _mp,
const Float  _mpert 
)
inlinestatic

calculate perturbation from distance to perturber and masses of particle and perturber

◆ checkParams()

bool ARInteraction::checkParams ( )
inline

(Necessary) check whether publicly initialized parameters are correctly set

Returns
true: all parmeters are correct. In this case no parameters, return true;
Here is the call graph for this function:

◆ modifyAndInterruptIter()

int ARInteraction::modifyAndInterruptIter ( AR::InterruptBinary< PtclHard > &  _bin_interrupt,
AR::BinaryTree< PtclHard > &  _bin 
)
inline

(Necessary) modify the orbits and interrupt check

check the inner left binary whether their separation is smaller than particle radius sum and become close, if true, set one component stauts to merger with cm mass and the other unused with zero mass. Return the binary tree address

Parameters
[in]_bin_interruptinterrupt binary information: adr: binary tree address; time_now: current physical time; time_end: integration finishing time; status: interrupt status: change, merge,none
[in]_binbinarytree to check iteratively
Returns
0: no modification; 2: modified; 3: destroyed

◆ modifyOneParticle()

template<class Tparticle >
int ARInteraction::modifyOneParticle ( Tparticle &  _p,
const Float &  _time_now,
const Float &  _time_end 
)
inline

(Necessary) modify one particle function

Parameters
[in]_pparticle
[in]_time_nowcurrent time (not physical time, NB unit)
[in]_time_endrequired evolved time (not physical time, do not directly use, NB unit)
Returns
0: no modification; 1: modify mass; 2: modify mass and velocity; 3: mass become zero
Here is the call graph for this function:

◆ print()

void ARInteraction::print ( std::ostream &  _fout) const
inline

print parameters

◆ readBinary()

void ARInteraction::readBinary ( FILE *  _fin)
inline

read class data to file with binary format

Parameters
[in]_fpFILE type file for reading

◆ writeBinary()

void ARInteraction::writeBinary ( FILE *  _fp) const
inline

write class data to file with binary format

Parameters
[in]_fpFILE type file for output

Member Data Documentation

◆ eps_sq

Float ARInteraction::eps_sq

◆ gravitational_constant

Float ARInteraction::gravitational_constant

softening parameter


The documentation for this class was generated from the following file: