<p>by default, this create a directory in your home <tt class="docutils literal"><span class="pre">~/pnbody_examples</span></tt>.
The scripts are in the <tt class="docutils literal"><span class="pre">~/pnbody_examples/ic</span></tt> directory.</p>
<div class="section" id="spherical-coordinate">
<h2>Spherical coordinate<a class="headerlink" href="#spherical-coordinate" title="Permalink to this headline">¶</a></h2>
<p>In spherical coordinates, supposing that the velocities are isotropics. the Jeans equations is reduced to one integral,
giving the value of the velocity dispertion of a component <img class="math" src="../_images/math/34857b3ba74ce5cd8607f3ebd23e9015908ada71.png" alt="i"/> :</p>
<h2>Example : Set a Plummer sphere to the jeans equilibrium<a class="headerlink" href="#example-set-a-plummer-sphere-to-the-jeans-equilibrium" title="Permalink to this headline">¶</a></h2>
<p>If <tt class="docutils literal"><span class="pre">UseTree=True</span></tt> the function uses a <tt class="docutils literal"><span class="pre">treecode</span></tt> to compute the potential at each node.
A new <tt class="docutils literal"><span class="pre">nb</span></tt> object with velocities computed from the Jeans equation is returned. We also get the potential in each node
and some statistics. The potential <tt class="docutils literal"><span class="pre">phi</span></tt> is usefull if we need to run the method for another component.</p>
<p>Using the <tt class="docutils literal"><span class="pre">stats</span></tt> variable, it is possible to plot some interesting values used during the computation, like the velocity dispertion as a function of the radius:</p>
<h3>Radial velocity dispersion<a class="headerlink" href="#radial-velocity-dispersion" title="Permalink to this headline">¶</a></h3>
<ol class="arabic simple">
<li>if <tt class="docutils literal"><span class="pre">mode_sigma_r['name']='epicyclic_approximation'</span></tt>, we use the epicyclic approximation which hold:</li>
</div><p>the parameter <img class="math" src="../_images/math/04777e262a979166a6295fb67e24ca75bc42f3b6.png" alt="\beta^2"/> is set by the variable <tt class="docutils literal"><span class="pre">mode_sigma_r['param']</span></tt> and takes usually a value around 1.</p>
<ol class="arabic simple" start="2">
<li>if <tt class="docutils literal"><span class="pre">mode_sigma_r['name']='isothropic'</span></tt>, the value is simply:</li>
<li><p class="first">if <tt class="docutils literal"><span class="pre">mode_sigma_r['name']='toomre'</span></tt>, we determine the velocity dispersion uses the Safronov-Toomre parameter <img class="math" src="../_images/math/9866e3a998d628ba0941eb4fea0666ac391d149a.png" alt="Q"/>:</p>
<div class="math">
<p><img src="../_images/math/ded125c9d4c060477de06e79b24b3d76661fc17e.png" alt="\sigma_R = \frac{3.36 Q G \Sigma_i}{\kappa}" /></p>
</div><p><img class="math" src="../_images/math/9866e3a998d628ba0941eb4fea0666ac391d149a.png" alt="Q"/> is set with the variable <tt class="docutils literal"><span class="pre">mode_sigma_r['param']</span></tt>.</p>
</li>
<li><p class="first">if <tt class="docutils literal"><span class="pre">mode_sigma_r['name']='constant'</span></tt>, the value is simply constant, given by the variable <tt class="docutils literal"><span class="pre">mode_sigma_r['param']</span></tt>:</p>
<h3>Azimuthal velocity dispersion<a class="headerlink" href="#azimuthal-velocity-dispersion" title="Permalink to this headline">¶</a></h3>
<ol class="arabic simple">
<li>if <tt class="docutils literal"><span class="pre">mode_sigma_p['name']='epicyclic_approximation'</span></tt>, we use the epicyclic approximation which hold:</li>
<h2>Example : Set an exponnential disk to the jeans equilibrium<a class="headerlink" href="#example-set-an-exponnential-disk-to-the-jeans-equilibrium" title="Permalink to this headline">¶</a></h2>
<p>Lest try to put an exponnential disk at the Jeans equilibrium.
<span class="gp">>>> </span><span class="n">nr</span> <span class="o">=</span> <span class="mi">32</span> <span class="c"># number of bins in r</span>
<span class="gp">>>> </span><span class="n">nt</span> <span class="o">=</span> <span class="mi">2</span> <span class="c"># number of bins in t</span>
<span class="gp">>>> </span><span class="n">nz</span> <span class="o">=</span> <span class="mi">64</span><span class="o">+</span><span class="mi">1</span> <span class="c"># number of bins in z</span>
</pre></div>
</div>
<dl class="docutils">
<dt>Set some functions used to distort the grid along the radius::</dt>
<p>The parameter <tt class="docutils literal"><span class="pre">select='0'</span></tt> tells that we want to compute the velocities on particles of type 0, while
<tt class="docutils literal"><span class="pre">disk=0</span></tt> tells that what we considere as the disk is only the particles 0. This is usefull when dealing with
multi-component models.</p>
<p>The latter function return <tt class="docutils literal"><span class="pre">nb</span></tt> with the new velocities, a matrix <tt class="docutils literal"><span class="pre">phi</span></tt> containing the potential at each node of the grid,
and a dictrionary <tt class="docutils literal"><span class="pre">stats</span></tt> containing some physical usefull quantities. Lets plot some of them:</p>
<h3>Multi component systems<a class="headerlink" href="#multi-component-systems" title="Permalink to this headline">¶</a></h3>
<p>Examples using multicomponents systems are provided in the <tt class="docutils literal"><span class="pre">pnbody_examples/ic</span></tt> directory obtained
<li><a class="reference internal" href="#example-set-a-plummer-sphere-to-the-jeans-equilibrium">Example : Set a Plummer sphere to the jeans equilibrium</a></li>
<li><a class="reference internal" href="#example-set-an-exponnential-disk-to-the-jeans-equilibrium">Example : Set an exponnential disk to the jeans equilibrium</a><ul>