the ic module¶
- pNbody.ic.ComputeGridParameters(n, args, rmax, M, pr_fct, mr_fct, Neps_des, rc, ng)¶
This function computes dR, the appropriate grid used to approximate Mr.
The grid is set in order to have “Neps_des” particles in the first division of the grid. Then, the radius of the grid follows an exponnential distribution up to rmax.
from the density distribution, the total mass and the number of particles, using a newton algorithm, it computes eps, the radius that will contains “Neps_des” particles
once eps is set, we determine rc (the grid scale length) from eps and ng, in order to have a grid with the a first cell equal to eps.
if the computation of rc fails, we use the default value of rc
The function takes the following arguments
n : number of particles M : total mass rmax : max radius args : list of args for the profile pr_fct : profile function mr_fct : mass-radius function
Neps_des : desired number of point in the first beam rc : default size of the first beam ng : number of grid divisions
it returns :
Rs : grid points eps : radius containing about Neps_des particles Neps : number of particles in eps
- pNbody.ic.ComputeGridParameters2(eps, nmax, args, rmax, M, pr_fct, mr_fct, Neps_des, rc, ng)¶
This function computes dR, the appropriate grid used to approximate Mr.
The number of particle of the model is set in order to have “Neps_des” particles in the first division of the grid. Then, the radius of the grid follows an exponential distribution up to rmax.
n is set from the total mass and Neps_des
once n is set, we determine rc (the grid scale length) from eps and ng, in order to have a grid with the a first cell equal to eps.
if the computation of rc fails, we use the default value of rc
The function takes the following arguments
eps : the desired grid resolution nmax : max number of particles M : total mass rmax : max radius args : list of args for the profile pr_fct : profile function mr_fct : mass-radius function
Neps_des : desired number of point in the first beam rc : default size of the first beam ng : number of grid divisions
it returns :
n : number of particles Rs : grid points rc : parameter of the scaling fct g : scaling fct gm : inverse of scaling fct
- pNbody.ic.box(n, a, b, c, irand=1, name='box.dat', ftype='binary')¶
Return an Nbody object that contains n particles distributed in an homogeneous box of dimension a,b,c, centred at the origin radius rmax.
- pNbody.ic.burkert(n, rs, Rmax, dR, Rs=None, irand=1, name='burkert.dat', ftype='binary', verbose=False)¶
Return an Nbody object that contains n particles following a burkert profile.
rhob = 1 / ( ( 1 + r/rs ) * ( 1 + (r/rs)**2 ) )
- pNbody.ic.deprojsersic(n, re, nindex, Rmax, M, dR, Rs=None, irand=1, name='nfwg.dat', ftype='binary', verbose=False)¶
Return an Nbody object that contains n particles following a 3D deprojected sersic profile.
- pNbody.ic.disklrrc(n, a, b, dz, irand=1, name='homodisk.dat', ftype='binary')¶
Return an Nbody object that contains n particles distributed in a disk having a linear rising rotation curve.
- pNbody.ic.dl2(n, a, b, c, eps, rmax, irand=1, name='dl2.dat', ftype='binary')¶
Return an Nbody object that contains n particles distributed as
rho = (1.-eps*(r/rmax)**2)
- pNbody.ic.dl2_mr(r, args)¶
Mass in the radius r for the distribution
rho = (1.-eps*(r/rmax)**2)
- pNbody.ic.expd(n, Hr, Hz, Rmax, Zmax, irand=1, name='expd.dat', ftype='binary')¶
Exonential disk
rho = 1/(1+(r/rc)**2)
- pNbody.ic.generic2c(n, rs, a, b, Rmax, dR, Rs=None, irand=1, name='nfwg.dat', ftype='binary', verbose=False)¶
Return an Nbody object that contains n particles following an nfw modifed profile.
rho = 1/( (r/rs)**a * (1+r/rs)**(b-a) )
- pNbody.ic.generic_Mr(n, rmax, R=None, Mr=None, irand=1, name='sphere_Mr.dat', ftype='binary', verbose=False)¶
Distribute particles in order to reproduce M(R) given by Mr
- pNbody.ic.generic_Mx(n, xmax, x=None, Mx=None, irand=1, name='box_Mx.dat', ftype='binary', verbose=False)¶
Distribute particles in a box. The density in x is defined in order to reproduce M(x) given by Mx
- pNbody.ic.generic_alpha(n, a, e, rmax, irand=1, fct=None, name='generic_alpha.dat', ftype='binary')¶
Generic alpha distribution : rho ~ (r+e)^a
- pNbody.ic.get_local_n(n)¶
This function set the global number of particle each node must hand.
- pNbody.ic.hernquist(n, rs, Rmax, dR, Rs=None, irand=1, name='hernquist.dat', ftype='binary', verbose=False)¶
Return an Nbody object that contains n particles following a hernquist modifed profile.
rho = 1/( (r/rs) * (1+r/rs)**3 )
- pNbody.ic.homodisk(n, a, b, dz, irand=1, name='homodisk.dat', ftype='binary')¶
Return an Nbody object that contains n particles distributed in an homogeneous oval of radius a and b, and of thickness dz.
- pNbody.ic.homosphere(n, a, b, c, irand=1, name='homosphere.dat', ftype='binary')¶
Return an Nbody object that contains n particles distributed in an homogeneous triaxial sphere of axis a,b,c.
- pNbody.ic.invert(x, rmin, rmax, fct, args, eps=1e-10)¶
return vector r that corresponds to fct(r,args)=x This routine uses a simple bissector algorithm
- pNbody.ic.isothm(n, rc, rmax, irand=1, name='isothm.dat', ftype='binary')¶
Return an Nbody object that contains n particles distributed as
rho = 1/(1+r/rc)**2
- pNbody.ic.isothm_mr(r, args)¶
Mass in the radius r for the distribution
rho = 1/(1+r/rc)**2
- pNbody.ic.kuzmin(n, eps, dz, irand=1, name='kuzmin.dat', ftype='binary')¶
Return an Nbody object that contains n particles distributed in a Kuzmin (infinitely thin) disk
rho = eps*M/(2*pi*(R**2+eps**2)**(3/2))
- pNbody.ic.mestel(n, rmax=1, dz=0, V0=1, G=1, irand=1, name='mestel.dat', ftype='gadget')¶
Return an Nbody object that contains n particles distributed such as they reproduce a Mestel disk (1/R surface density).
V0 : rotation curve at infinity
- pNbody.ic.miyamoto_nagai(n, a, b, Rmax, Zmax, irand=1, fct=None, fRmax=0, name='miyamoto.dat', ftype='binary')¶
Miyamoto Nagai distribution
- pNbody.ic.nfw(n, rs, Rmax, dR, Rs=None, irand=1, name='nfw.dat', ftype='binary', verbose=False)¶
Return an Nbody object that contains n particles following an nfw profile.
rho = 1/[ (r/rs)(1+r/rs)^2 ]
- pNbody.ic.nfwg(n, rs, gamma, Rmax, dR, Rs=None, irand=1, name='nfwg.dat', ftype='binary', verbose=False)¶
Return an Nbody object that contains n particles following an nfw modifed profile.
rho = 1/[ ((r/rs))**(gamma)(1+r/rs)^2 ]**(0.5*(3-gamma))
- pNbody.ic.pisothm(n, rc, rmax, rmin=0, irand=1, name='pisothm.dat', ftype='binary')¶
Pseudo-isothermal sphere Mass in the radius r for the distribution
rho = 1/(1+(r/rc)**2)
- pNbody.ic.pisothm_mr(r, args)¶
Mass in the radius r for the distribution
rho = 1/(1+(r/rc)**2)
- pNbody.ic.plummer(n, a, b, c, eps, rmax, M=1.0, irand=1, vel='no', name='plummer.dat', ftype='binary')¶
Return an Nbody object that contains n particles distributed in a triaxial plummer model of axis a,b,c and core radius eps and max radius of rmax.
rho = (1.+(r/eps)**2)**(-5/2)
- pNbody.ic.pseudomestel(n, rmax=1, dz=0, V0=1, a=0.1, G=1, irand=1, name='pseudomestel.dat', ftype='gadget')¶
Return an Nbody object that contains n particles distributed such as they reproduce a Mestel disk (1/sqrt(a^2 + R^2) surface density).
V0 : rotation curve at infinity
- pNbody.ic.ring(n, r, M=1.0, irand=1, name='ring.dat', ftype='binary')¶
Ring of radius r
- pNbody.ic.shell(n, r, irand=1, name='shell.dat', ftype='binary')¶
Shell of radius r