PeTar
N-body code for collisional gravitational systems
|
A class to manager the API to Galpy. More...
#include <galpy_interface.h>
Public Member Functions | |
GalpyManager () | |
void | printData (std::ostream &fout) |
print current potential data More... | |
void | initial (const IOParamsGalpy &_input, const double _time, const std::string _conf_name, const bool _restart_flag, const bool _print_flag=false) |
initialization function More... | |
void | updatePotentialSet () |
generate potentail args More... | |
bool | addPotentialFromString (const std::string &_type_args, const bool _reset_flag, const bool _print_flag) |
Update types and arguments from type-args string. More... | |
bool | updateMWPotentialEvolve (const double &_system_time, const bool _print_flag, const bool _initial_flag) |
Update MWpotential evolve (Gomez et al. 2010) More... | |
bool | updatePotentialFromFile (const double &_system_time, const bool _print_flag) |
Update types and arguments from configure file if update_time <= particle system time. More... | |
void | updatePotential (const double &_system_time, const bool _print_flag) |
Update Potential types and arguments based on time. More... | |
void | writePotentialPars (const std::string &_filename, const double &_system_time) |
write potential parameters for restart More... | |
void | resetPotAcc () |
reset acceleraltion of potential More... | |
void | kickMovePot (const double dt) |
kick velocity of moving potential (mode 2) More... | |
void | driftMovePot (const double dt) |
drift position of moving potential (mode 2) More... | |
void | calcMovePotAccFromPot (const double _time, const double *pos_pcm) |
calculate acceleration for moving potentials from other potentials More... | |
void | calcAccPot (double *acc, double &pot, const double _time, const double gm, const double *pos_g, const double *pos_l) |
calculate acceleration and potential at give position More... | |
void | writeDataToFile (const std::string &_filename) |
write data for restart More... | |
void | readDataFromFile (const std::string &_filename, const bool _print_flag) |
read configure data for restart More... | |
bool | evolveChangingArguments (const double &_time, const bool _print_flag) |
calculate new arguments for changing potentials More... | |
void | freePotentialArgs () |
void | clear () |
~GalpyManager () | |
Static Public Member Functions | |
static void | printReference (std::ostream &fout, const int offset=4) |
print reference to cite More... | |
Public Attributes | |
std::vector< int > | pot_type_offset |
std::vector< int > | pot_type |
std::vector< int > | pot_args_offset |
std::vector< double > | pot_args |
double | time |
std::vector< ChangeArgument > | change_args |
std::vector< int > | change_args_offset |
std::vector< PotentialSetPar > | pot_set_pars |
std::vector< PotentialSet > | pot_sets |
double | update_time |
double | rscale |
double | vscale |
double | tscale |
double | fscale |
double | pscale |
double | gmscale |
std::ifstream | fconf |
std::string | set_name |
std::string | set_parfile |
MWPotentialEvolve | mw_evolve |
A class to manager the API to Galpy.
|
inline |
|
inline |
|
inline |
Update types and arguments from type-args string.
[in] | _type_args | potential type and argment strings |
[in] | _reset_flag | if true, reset potential set, otherwise add to current existing set |
[in] | _print_flag | if true, print the read types and arguments. |
|
inline |
calculate acceleration and potential at give position
[out] | acc | [3] acceleration to return |
[out] | pot | potential to return |
[in] | _time | time in input unit |
[in] | gm | G*mass of particles [input unit] |
[in] | pos_g | position of particles in the galactic frame [input unit] |
[in] | pos_l | position of particles in the particle system frame [input unit] |
|
inline |
calculate acceleration for moving potentials from other potentials
[in] | _time | current time [input unit] of particle system |
[in] | pos_pcm | position of particle system in the galactic frame [input unit] for mode 1 potential |
|
inline |
|
inline |
drift position of moving potential (mode 2)
[in] | dt | time step for kick [input unit] |
|
inline |
calculate new arguments for changing potentials
Change index counts from 0 inside the local potential set If change index is -1, change the gm of potential set instead. To find the correct potential argument, the pot_args_offset is needed.
[in] | _time | new time (Galpy Unit) |
[in] | _print_flag | if true, print updated argument |
|
inline |
|
inline |
initialization function
[in] | _input | input parameters |
[in] | _time | current system time |
[in] | _conf_name | galpy configure file name for restart |
[in] | _restart_flag | if true, read the configure file for restart |
[in] | _print_flag | if true, printing information to std::cout |
|
inline |
kick velocity of moving potential (mode 2)
[in] | dt | time step for kick [input unit] |
|
inline |
print current potential data
|
inlinestatic |
print reference to cite
|
inline |
read configure data for restart
|
inline |
reset acceleraltion of potential
|
inline |
Update MWpotential evolve (Gomez et al. 2010)
Assume time unit is Myr!
[in] | _system_time | the time of globular particley system in PeTar. The time is transferred based on the time scaling factor |
[in] | _print_flag | if true, print the read types and arguments. |
[in] | _initial_flag | if true, this is the first time, potential parameter array will be generated. |
|
inline |
Update Potential types and arguments based on time.
[in] | _system_time | the time of globular particley system in PeTar. The time is transferred based on the time scaling factor |
[in] | _print_flag | if true, print the read types and arguments. |
|
inline |
Update types and arguments from configure file if update_time <= particle system time.
[in] | _system_time | the time of globular particley system in PeTar. The time is transferred based on the time scaling factor |
[in] | _print_flag | if true, print the read types and arguments. |
|
inline |
generate potentail args
clear the old potentialset first
|
inline |
write data for restart
Write data sctructure: Time N_set Mode[:] # N_set: set mode After first line, the format is (size, array) pot_set_par: # mode, gm, pos, vel per line pot_type_offset # N_set+1: number of pots per set pot_type # N_pot: pot type list pot_args_offset # N_set+1: number of arguments per set pot_args # N_pot_arg pot argument list change_args_offset # N_set+1: number of changing arguments per set change_args # N_change: changing arg index, mode, rate
[in] | _filename | file to save data |
|
inline |
write potential parameters for restart
Precision is set to 14
[out] | _filename | file to save data |
[in] | _time | current time |
std::vector<ChangeArgument> GalpyManager::change_args |
std::vector<int> GalpyManager::change_args_offset |
std::ifstream GalpyManager::fconf |
double GalpyManager::fscale |
double GalpyManager::gmscale |
MWPotentialEvolve GalpyManager::mw_evolve |
std::vector<double> GalpyManager::pot_args |
std::vector<int> GalpyManager::pot_args_offset |
std::vector<PotentialSetPar> GalpyManager::pot_set_pars |
std::vector<PotentialSet> GalpyManager::pot_sets |
std::vector<int> GalpyManager::pot_type |
std::vector<int> GalpyManager::pot_type_offset |
double GalpyManager::pscale |
double GalpyManager::rscale |
std::string GalpyManager::set_name |
std::string GalpyManager::set_parfile |
double GalpyManager::time |
double GalpyManager::tscale |
double GalpyManager::update_time |
double GalpyManager::vscale |