Its possible generate a cubic box with the density varying along one axix. This is obtained
by using the {\hyperref[rst/IcModule:pNbody.ic.generic_Mx]{\code{generic\_Mx()}}} function. As for {\hyperref[rst/IcModule:pNbody.ic.generic_Mr]{\code{generic\_Mr()}}}, we have to define
the variation of the cumulative mass, in this case, the x axis. In the following example,
we set a two level transition along the x axis, following the function:
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{g} \PYG{o}{=} \PYG{k}{lambda} \PYG{n}{r}\PYG{p}{:}\PYG{n}{log}\PYG{p}{(}\PYG{n}{r}\PYG{o}{/}\PYG{n}{rc}\PYG{o}{+}\PYG{l+m+mi}{1}\PYG{p}{)} \PYG{c}{\# the function}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{gm} \PYG{o}{=} \PYG{k}{lambda} \PYG{n}{r}\PYG{p}{:}\PYG{n}{rc}\PYG{o}{*}\PYG{p}{(}\PYG{n}{exp}\PYG{p}{(}\PYG{n}{r}\PYG{p}{)}\PYG{o}{-}\PYG{l+m+mi}{1}\PYG{p}{)} \PYG{c}{\# and its inverse}
If \code{UseTree=True} the function uses a \code{treecode} to compute the potential at each node.
A new \code{nb} object with velocities computed from the Jeans equation is returned. We also get the potential in each node
and some statistics. The potential \code{phi} is usefull if we need to run the method for another component.
Using the \code{stats} variable, it is possible to plot some interesting values used during the computation, like the velocity dispertion as a function of the radius:
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nr} \PYG{o}{=} \PYG{l+m+mi}{32} \PYG{c}{\# number of bins in r}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nt} \PYG{o}{=} \PYG{l+m+mi}{2} \PYG{c}{\# number of bins in t}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nz} \PYG{o}{=} \PYG{l+m+mi}{64}\PYG{o}{+}\PYG{l+m+mi}{1} \PYG{c}{\# number of bins in z}
\end{Verbatim}
\begin{description}
\item[{Set some functions used to distort the grid along the radius::}] \leavevmode
\label{rst/MainModule:module-pNbody.main}\label{rst/MainModule::doc}\label{rst/MainModule:the-main-module}\index{pNbody.main (module)}\index{Nbody() (in module pNbody.main)}
\label{rst/IcModule::doc}\label{rst/IcModule:the-ic-module}\label{rst/IcModule:module-pNbody.ic}\index{pNbody.ic (module)}\index{ComputeGridParameters() (in module pNbody.ic)}
File \PYG{n+nb}{"\textless{}stdin\textgreater{}"}, line \PYG{l+m}{1}, in \PYG{n+nIdentifier}{\textless{}module\textgreater{}}
File \PYG{n+nb}{"/home/epfl/revaz/local/lib64/python2.6/site-packages/pNbody/io.py"}, line \PYG{l+m}{33}, in \PYG{n+nIdentifier}{checkfile}
\PYG{k}{raise} \PYG{n+ne}{IOError}\PYG{p}{(}\PYG{l+m+mi}{915}\PYG{p}{,}\PYG{l+s}{'}\PYG{l+s}{file }\PYG{l+s+si}{\%s}\PYG{l+s}{ not found ! Pease check the file name.}\PYG{l+s}{'}\PYG{o}{\%}\PYG{p}{(}\PYG{n}{name}\PYG{p}{)}\PYG{p}{)}
\PYG{n+nc}{IOError}: \PYG{n+nIdentifier}{[Errno 915] file nofile not found ! Pease check the file name. }
\label{rst/UnitsModule:the-units-module}\label{rst/UnitsModule::doc}\label{rst/UnitsModule:module-pNbody.units}\index{pNbody.units (module)}\index{PhysCte (class in pNbody.units)}
\label{rst/CtesModule:module-pNbody.ctes}\label{rst/CtesModule:the-ctes-module}\label{rst/CtesModule::doc}\index{pNbody.ctes (module)}\index{convert\_ctes() (in module pNbody.ctes)}
\label{rst/MpiModule:module-pNbody.mpi}\label{rst/MpiModule:the-mpi-module}\label{rst/MpiModule::doc}\index{pNbody.mpi (module)}\index{mpi\_AllgatherAndConcatArray() (in module pNbody.mpi)}
\phantomsection\label{rst/MpiModule:pNbody.mpi.mpi_allreduce}\pysiglinewithargsret{\code{pNbody.mpi.}\bfcode{mpi\_allreduce}}{\emph{x}, \emph{op=\textless{}mpi4py.MPI.Op object at 0x2fd74e0\textgreater{}}}{}
Reduce x from all node for all nodes.
When there is only one is defined, the function return x.
\label{rst/LibutilModule:the-libutil-module}\label{rst/LibutilModule::doc}\label{rst/LibutilModule:module-pNbody.libutil}\index{pNbody.libutil (module)}\index{Extract1dMeanFrom2dMap() (in module pNbody.libutil)}
Transform velocities in cylindrical coordinates vr,vt,vz into carthesian
coodinates vx,vy,vz.
Pos is the position of particles in cart. coord.
Vel is the velocity in cylindrical coord.
Return a 3xn float array.
\end{fulllineitems}
\section{the param module}
\label{rst/ParamModule:the-param-module}\label{rst/ParamModule::doc}\label{rst/ParamModule:module-pNbody.param}\index{pNbody.param (module)}\index{Params (class in pNbody.param)}
\label{rst/LiblogModule:the-liblog-module}\label{rst/LiblogModule::doc}\label{rst/LiblogModule:module-pNbody.liblog}\index{pNbody.liblog (module)}\index{Log (class in pNbody.liblog)}
\label{rst/TalkgdispModule:the-talkgdisp-module}\label{rst/TalkgdispModule:module-pNbody.talkgdisp}\label{rst/TalkgdispModule::doc}\index{pNbody.talkgdisp (module)}\index{TalkServer (class in pNbody.talkgdisp)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{getdata}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{in.fits}\PYG{l+s}{'}\PYG{p}{,} \PYG{l+m+mi}{0}\PYG{p}{)} \PYG{c}{\# the primary header }
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{getdata}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{in.fits}\PYG{l+s}{'}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{)} \PYG{c}{\# the second extension}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{getdata}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{in.fits}\PYG{l+s}{'}\PYG{p}{,} \PYG{n}{ext}\PYG{o}{=}\PYG{l+m+mi}{2}\PYG{p}{)} \PYG{c}{\# the second extension}
\label{rst/LibqtModule:module-pNbody.libqt}\label{rst/LibqtModule::doc}\label{rst/LibqtModule:the-libqt-module}\index{pNbody.libqt (module)}\index{QNumarrayImage (class in pNbody.libqt)}
\label{rst/MovieModule::doc}\label{rst/MovieModule:module-pNbody.Movie}\label{rst/MovieModule:the-movie-module}\index{pNbody.Movie (module)}\index{Movie (class in pNbody.Movie)}
\label{rst/ProfilesModule:module-pNbody.profiles}\label{rst/ProfilesModule::doc}\label{rst/ProfilesModule:the-profiles-module}\index{pNbody.profiles (module)}\index{burkert\_mr() (in module pNbody.profiles)}
\label{rst/GeometryModule:the-geometry-module}\label{rst/GeometryModule::doc}\label{rst/GeometryModule:module-pNbody.geometry}\index{pNbody.geometry (module)}\index{align() (in module pNbody.geometry)}
\label{rst/LibmiyamotoModule::doc}\label{rst/LibmiyamotoModule:module-pNbody.libmiyamoto}\label{rst/LibmiyamotoModule:the-libmiyamoto-module}\index{pNbody.libmiyamoto (module)}\index{Density() (in module pNbody.libmiyamoto)}
\label{rst/LibgridModule:module-pNbody.libgrid}\label{rst/LibgridModule:the-libgrid-module}\label{rst/LibgridModule::doc}\index{pNbody.libgrid (module)}\index{get\_AccelerationMap\_On\_Cylindrical\_2dv\_Grid() (in module pNbody.libgrid)}
Interpolates continuous value of pos, using matrix mat
only along first axis.
\end{fulllineitems}
\section{the libdisk module}
\label{rst/LibdiskModule:the-libdisk-module}\label{rst/LibdiskModule::doc}\label{rst/LibdiskModule:module-pNbody.libdisk}\index{pNbody.libdisk (module)}\index{Diff() (in module pNbody.libdisk)}
Integrate the vector v, between ia and ib, using trapezes.
v : values of cells (must be 1 dimensional)
dr : corresponding physical size of cells
ia : lower real indice WARNING : the indicies must now be integer !!!
ib : higher real indice WARNING : the indicies must now be integer !!!
\end{fulllineitems}
\section{the cosmo module}
\label{rst/CosmoModule:the-cosmo-module}\label{rst/CosmoModule::doc}\label{rst/CosmoModule:module-pNbody.cosmo}\index{pNbody.cosmo (module)}\index{A\_z() (in module pNbody.cosmo)}
\label{rst/ThermodynModule:module-pNbody.thermodyn}\label{rst/ThermodynModule::doc}\label{rst/ThermodynModule:the-thermodyn-module}\index{pNbody.thermodyn (module)}\index{Arp() (in module pNbody.thermodyn)}
\label{rst/FourierModule:module-pNbody.fourier}\label{rst/FourierModule::doc}\label{rst/FourierModule:the-fourier-module}\index{pNbody.fourier (module)}\index{fourier() (in module pNbody.fourier)}
\label{rst/PhotModule:module-pNbody.phot}\label{rst/PhotModule:the-phot-module}\label{rst/PhotModule::doc}\index{pNbody.phot (module)}\index{LvtoMv() (in module pNbody.phot)}
\label{rst/C_asciilib:the-c-asciilib-module}\label{rst/C_asciilib:module-pNbody.asciilib}\label{rst/C_asciilib::doc}\index{pNbody.asciilib (module)}\index{read() (in module pNbody.asciilib)}
\label{rst/C_coolinglib::doc}\label{rst/C_coolinglib:the-c-coolinglib-module}\phantomsection\label{rst/C_coolinglib:module-pNbody.coolinglib}\index{pNbody.coolinglib (module)}\index{cooling() (in module pNbody.coolinglib)}
Return Mu and Lambda. Temperature and Hydrogen Density must be in cgs.
\end{fulllineitems}
\section{the C cooling\_with\_metals module}
\label{rst/C_cooling_with_metals::doc}\label{rst/C_cooling_with_metals:the-c-cooling-with-metals-module}\phantomsection\label{rst/C_cooling_with_metals:module-pNbody.cooling_with_metals}\index{pNbody.cooling\_with\_metals (module)}\index{PrintParameters() (in module pNbody.cooling\_with\_metals)}
Integrate cooling during a timestep using second scheme of integration.
\end{fulllineitems}
\section{the C cosmolib module}
\label{rst/C_cosmolib:the-c-cosmolib-module}\label{rst/C_cosmolib::doc}\label{rst/C_cosmolib:module-pNbody.cosmolib}\index{pNbody.cosmolib (module)}\index{Age\_a() (in module pNbody.cosmolib)}
Return age of the univers as a function of a (expansion factor).
\end{fulllineitems}
\section{the C iclib module}
\label{rst/C_iclib:the-c-iclib-module}\label{rst/C_iclib::doc}\label{rst/C_iclib:module-pNbody.iclib}\index{pNbody.iclib (module)}\index{burkert() (in module pNbody.iclib)}
\label{rst/C_mapping:the-c-mapping-module}\label{rst/C_mapping:module-pNbody.mapping}\label{rst/C_mapping::doc}\index{pNbody.mapping (module)}\index{create\_line() (in module pNbody.mapping)}
\label{rst/C_montecarlolib:the-c-montecarlolib-module}\label{rst/C_montecarlolib::doc}\phantomsection\label{rst/C_montecarlolib:module-pNbody.montecarlolib}\index{pNbody.montecarlolib (module)}\index{mc1d() (in module pNbody.montecarlolib)}
\label{rst/C_myNumeric:the-c-mynumeric-module}\label{rst/C_myNumeric::doc}\label{rst/C_myNumeric:module-pNbody.myNumeric}\index{pNbody.myNumeric (module)}\index{Interpolate\_From\_1d\_Array() (in module pNbody.myNumeric)}
\label{rst/C_nbdrklib:the-c-nbdrklib-module}\label{rst/C_nbdrklib::doc}\label{rst/C_nbdrklib:module-pNbody.nbdrklib}\index{pNbody.nbdrklib (module)}\index{Compute() (in module pNbody.nbdrklib)}
\label{rst/C_nbodymodule:the-c-nbodymodule-module}\label{rst/C_nbodymodule::doc}\phantomsection\label{rst/C_nbodymodule:module-pNbody.nbodymodule}\index{pNbody.nbodymodule (module)}\index{acceleration() (in module pNbody.nbodymodule)}
\label{rst/C_peanolib::doc}\label{rst/C_peanolib:module-pNbody.peanolib}\label{rst/C_peanolib:the-c-peanolib-module}\index{pNbody.peanolib (module)}\index{peano2xyz() (in module pNbody.peanolib)}
This mpdule is currently not completely integrated to \textbf{pNbody}.
It is part of the \textbf{pNbody} package but must be compiled
separately.
For mpi, use:
\begin{Verbatim}[commandchars=@\[\]]
export CC=mpirun
\end{Verbatim}
\section{the C pygsl module}
\label{rst/C_pygsl:module-pNbody.pygsl}\label{rst/C_pygsl::doc}\label{rst/C_pygsl:the-c-pygsl-module}\index{pNbody.pygsl (module)}\index{sobol\_sequence() (in module pNbody.pygsl)}
\label{rst/C_tessel:the-c-tessel-module}\label{rst/C_tessel::doc}\label{rst/C_tessel:module-pNbody.tessel}\index{pNbody.tessel (module)}\index{CircumCircleProperties() (in module pNbody.tessel)}