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

SSE/BSE interface manager. More...

#include <bse_interface.h>

Public Member Functions

 BSEManager ()
 

name of binary type return from BSE evolv2, notice if it is -1, it indicate the end of record

More...
 
bool checkParams ()
 
void dumpRandConstant (const char *_fname)
 dump rand constant to file More...
 
void readRandConstant (const char *_fname)
 read BSE rand constant from file More...
 
bool isMassTransfer (const int _binary_type)
 
bool isMerger (const int _binary_type)
 notice kick priority is higher than others More...
 
bool isDisrupt (const int _binary_type)
 
void initial (const IOParamsBSE &_input, const bool _print_flag=false)
 initial SSE/BSE based code global parameters More...
 
double getMass (StarParameter &_star)
 get current mass in NB unit More...
 
double getMassLoss (StarParameterOut &_out)
 get mass loss in NB unit More...
 
double getMergerRadius (StarParameter &_star)
 get merger radius in NB unit More...
 
double getStellarRadius (StarParameter &_star)
 get stellar radius in NB unit More...
 
double getSpeedOfLight () const
 get speed of light in NB unit More...
 
double getTime (StarParameter &_star)
 get evolved Time in NB unit More...
 
double getDTMiss (StarParameterOut &_out)
 get the difference of required finishing time and actually evolved time in NB unit More...
 
void printTypeChange (std::ostream &_fout, StarParameter &_star, StarParameterOut &_out, const int _width=4)
 print type change More...
 
void printBinaryEvent (std::ostream &_fout, const BinaryEvent &_bin_event)
 print binary event More...
 
void printBinaryEventOne (std::ostream &_fout, const BinaryEvent &_bin_event, const int k)
 print binary event one More...
 
void printBinaryEventColumnOne (std::ostream &_fout, const BinaryEvent &_bin_event, const int k, const int _width=20, const bool print_type_name=true)
 print binary event one in column More...
 
double getVelocityChange (double *dv, StarParameterOut &_out)
 get velocity change in NB unit More...
 
int evolveStar (StarParameter &_star, StarParameterOut &_out, const double _dt, bool _unit_in_myr=false)
 call SSE evolv1 for single star More...
 
int evolveBinary (StarParameter &_star1, StarParameter &_star2, StarParameterOut &_out1, StarParameterOut &_out2, double &_semi, double &_period, double &_ecc, BinaryEvent &_bse_event, const int &_binary_init_type, const double _dt_nb)
 call evolv2 for a binary More...
 
bool isRocheFill (StarParameter &_star1, StarParameter &_star2, double &_semi, double &_ecc)
 check Roche fill condition More...
 
void merge (StarParameter &_star1, StarParameter &_star2, StarParameterOut &_out1, StarParameterOut &_out2, double &_semi, double &_ecc)
 merge two star using mix function, star 2 will becomes zero mass More...
 
double getTimeStepStar (StarParameter &_star)
 get next time step to check in Myr More...
 
double getTimeStepBinary (StarParameter &_star1, StarParameter &_star2, double &_semi, double &_ecc, int &_binary_type)
 call BSE evolv2 for a binary More...
 
bool isCallBSENeeded (StarParameter &_star1, StarParameter &_star2, double &_semi, double &_ecc, double &_dt)
 a simple check to determine whether call BSE is necessary by given a reference of time step More...
 

Static Public Member Functions

static void printReference (std::ostream &fout, const int offset=4)
 print reference to cite More...
 
static std::string getSSEOutputFilenameSuffix ()
 
static std::string getBSEOutputFilenameSuffix ()
 
static std::string getSSEName ()
 
static std::string getBSEName ()
 

Public Attributes

double z
 
double zpars [20]
 
double tscale
 

metallicity parameters

More...
 
double rscale
 

time scaling factor from NB to Myr (t[Myr]=t[NB]*tscale)

More...
 
double mscale
 

radius scaling factor from NB to Rsun

More...
 
double vscale
 

mass scaling factor from NB to Msun

More...
 
const double year_to_day
 

velocity scaling factor from NB to km/s

More...
 
const char * single_type [16]
 

year to day

More...
 
const char * binary_type [14]
 

name of single type from SSE

More...
 

Detailed Description

SSE/BSE interface manager.

The class provides the interface to call single and binary stellar evolution (evolveStar and evolveBinary); and also the time step estimators (getTimeStepStar, getTimeStepBinary).

Constructor & Destructor Documentation

◆ BSEManager()

BSEManager::BSEManager ( )
inline

name of binary type return from BSE evolv2, notice if it is -1, it indicate the end of record

Member Function Documentation

◆ checkParams()

bool BSEManager::checkParams ( )
inline
Here is the caller graph for this function:

◆ dumpRandConstant()

void BSEManager::dumpRandConstant ( const char *  _fname)
inline

dump rand constant to file

◆ evolveBinary()

int BSEManager::evolveBinary ( StarParameter _star1,
StarParameter _star2,
StarParameterOut _out1,
StarParameterOut _out2,
double &  _semi,
double &  _period,
double &  _ecc,
BinaryEvent _bse_event,
const int &  _binary_init_type,
const double  _dt_nb 
)
inline

call evolv2 for a binary

Parameters
[in,out]_star1star parameter of first
[in,out]_star2star parameter of second
[out]_out1output parameter of first from evolv2
[out]_out2output parameter of second from evolv2
[out]_bse_eventbinary event record (bpp array)
[in]_semisemi-major axis, only used to record initial semi [IN unit]
[in,out]_periodperiod of binary in NB unit [IN unit]
[in,out]_ecceccentricity of binary
[in]_binary_init_typeinitial type of binary
[in]_dt_nbphysical time step to evolve [In unit]
Returns
error flag: -1: error, 0: normal
Here is the call graph for this function:

◆ evolveStar()

int BSEManager::evolveStar ( StarParameter _star,
StarParameterOut _out,
const double  _dt,
bool  _unit_in_myr = false 
)
inline

call SSE evolv1 for single star

Parameters
[in,out]_starstar parameter
[out]_outoutput parameter from evolv1
[in]_dttime step to evolve
[in]_unit_in_myrif true, _dt is in Myr; else, _dt*tscale is used (default false)
Returns
event flag: -1: error, 0: normal, 1: type change, 2: velocity kick
Here is the caller graph for this function:

◆ getBSEName()

static std::string BSEManager::getBSEName ( )
inlinestatic
Here is the caller graph for this function:

◆ getBSEOutputFilenameSuffix()

static std::string BSEManager::getBSEOutputFilenameSuffix ( )
inlinestatic
Here is the caller graph for this function:

◆ getDTMiss()

double BSEManager::getDTMiss ( StarParameterOut _out)
inline

get the difference of required finishing time and actually evolved time in NB unit

Here is the caller graph for this function:

◆ getMass()

double BSEManager::getMass ( StarParameter _star)
inline

get current mass in NB unit

Here is the caller graph for this function:

◆ getMassLoss()

double BSEManager::getMassLoss ( StarParameterOut _out)
inline

get mass loss in NB unit

Here is the caller graph for this function:

◆ getMergerRadius()

double BSEManager::getMergerRadius ( StarParameter _star)
inline

get merger radius in NB unit

Here is the caller graph for this function:

◆ getSpeedOfLight()

double BSEManager::getSpeedOfLight ( ) const
inline

get speed of light in NB unit

IAU 2009: c = 299 792 458 m/s

◆ getSSEName()

static std::string BSEManager::getSSEName ( )
inlinestatic

◆ getSSEOutputFilenameSuffix()

static std::string BSEManager::getSSEOutputFilenameSuffix ( )
inlinestatic
Here is the caller graph for this function:

◆ getStellarRadius()

double BSEManager::getStellarRadius ( StarParameter _star)
inline

get stellar radius in NB unit

◆ getTime()

double BSEManager::getTime ( StarParameter _star)
inline

get evolved Time in NB unit

◆ getTimeStepBinary()

double BSEManager::getTimeStepBinary ( StarParameter _star1,
StarParameter _star2,
double &  _semi,
double &  _ecc,
int &  _binary_type 
)
inline

call BSE evolv2 for a binary

Parameters
[in]_star1star parameter of first
[in]_star2star parameter of second
[in]_semisemi-major axis, [IN unit]
[in]_ecceccentricity of binary, used for BSE
[in]_binary_typebinary type
Returns
next time step in IN unit
Here is the call graph for this function:

◆ getTimeStepStar()

double BSEManager::getTimeStepStar ( StarParameter _star)
inline

get next time step to check in Myr

Parameters
[in]_starstar parameter
Returns
next time step
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getVelocityChange()

double BSEManager::getVelocityChange ( double *  dv,
StarParameterOut _out 
)
inline

get velocity change in NB unit

Parameters
[in]_dv3-D array to record velocity change
Returns
value of velocity change
Here is the caller graph for this function:

◆ initial()

void BSEManager::initial ( const IOParamsBSE _input,
const bool  _print_flag = false 
)
inline

initial SSE/BSE based code global parameters

Here is the caller graph for this function:

◆ isCallBSENeeded()

bool BSEManager::isCallBSENeeded ( StarParameter _star1,
StarParameter _star2,
double &  _semi,
double &  _ecc,
double &  _dt 
)
inline

a simple check to determine whether call BSE is necessary by given a reference of time step

For the given time step, if the general relativity effect is important or Roche overflow may happen, return True When calling BSE is necessary within the given time step, return true. If KW type <10, check whether peri-center distance < 100*stellar radii (sum); If KW type >10, check GR effect timescale.

Parameters
[in]_star1star parameter of first
[in]_star2star parameter of second
[in]_semisemi-major axis, [IN unit]
[in]_ecceccentricity of binary, used for BSE
[in]_dtthe time step [In unit]
Returns
true: necessary

◆ isDisrupt()

bool BSEManager::isDisrupt ( const int  _binary_type)
inline

◆ isMassTransfer()

bool BSEManager::isMassTransfer ( const int  _binary_type)
inline

◆ isMerger()

bool BSEManager::isMerger ( const int  _binary_type)
inline

notice kick priority is higher than others

◆ isRocheFill()

bool BSEManager::isRocheFill ( StarParameter _star1,
StarParameter _star2,
double &  _semi,
double &  _ecc 
)
inline

check Roche fill condition

◆ merge()

void BSEManager::merge ( StarParameter _star1,
StarParameter _star2,
StarParameterOut _out1,
StarParameterOut _out2,
double &  _semi,
double &  _ecc 
)
inline

merge two star using mix function, star 2 will becomes zero mass

Parameters
[in,out]_star1star parameter of first
[in,out]_star2star parameter of second
[out]_out1output parameter of first from evolv2
[out]_out2output parameter of second from evolv2
[in]_semisemi-major axis, only used to record initial semi [IN unit]
[in]_ecceccentricity of hyperbolic orbit, used for BSE TODO: we must to consider the donor!

◆ printBinaryEvent()

void BSEManager::printBinaryEvent ( std::ostream &  _fout,
const BinaryEvent _bin_event 
)
inline

print binary event

Here is the call graph for this function:

◆ printBinaryEventColumnOne()

void BSEManager::printBinaryEventColumnOne ( std::ostream &  _fout,
const BinaryEvent _bin_event,
const int  k,
const int  _width = 20,
const bool  print_type_name = true 
)
inline

print binary event one in column

◆ printBinaryEventOne()

void BSEManager::printBinaryEventOne ( std::ostream &  _fout,
const BinaryEvent _bin_event,
const int  k 
)
inline

print binary event one

◆ printReference()

static void BSEManager::printReference ( std::ostream &  fout,
const int  offset = 4 
)
inlinestatic

print reference to cite

Here is the caller graph for this function:

◆ printTypeChange()

void BSEManager::printTypeChange ( std::ostream &  _fout,
StarParameter _star,
StarParameterOut _out,
const int  _width = 4 
)
inline

print type change

◆ readRandConstant()

void BSEManager::readRandConstant ( const char *  _fname)
inline

read BSE rand constant from file

Member Data Documentation

◆ binary_type

const char* BSEManager::binary_type[14]

name of single type from SSE

◆ mscale

double BSEManager::mscale

radius scaling factor from NB to Rsun

◆ rscale

double BSEManager::rscale

time scaling factor from NB to Myr (t[Myr]=t[NB]*tscale)

◆ single_type

const char* BSEManager::single_type[16]

year to day

◆ tscale

double BSEManager::tscale

metallicity parameters

◆ vscale

double BSEManager::vscale

mass scaling factor from NB to Msun

◆ year_to_day

const double BSEManager::year_to_day

velocity scaling factor from NB to km/s

◆ z

double BSEManager::z

◆ zpars

double BSEManager::zpars[20]

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