.. _potential-api: Potential (``galpy.potential``) =============================== 3D potentials ------------- General instance routines +++++++++++++++++++++++++ Use as ``Potential-instance.method(...)`` .. toctree:: :maxdepth: 2 __call__ dens dvcircdR epifreq flattening lindbladR mass nemo_accname nemo_accpars omegac phiforce phi2deriv plot plotDensity plotEscapecurve plotRotcurve Rphideriv R2deriv r2deriv Rzderiv Rforce rforce rl rtide surfdens toPlanar toVertical ttensor turn_physical_off turn_physical_on vcirc verticalfreq vesc vterm z2deriv zforce In addition to these, the ``NFWPotential`` also has methods to calculate virial quantities .. toctree:: :maxdepth: 2 conc mvir rvir General 3D potential routines +++++++++++++++++++++++++++++ Use as ``method(...)`` .. toctree:: :maxdepth: 2 dvcircdR epifreq evaluateDensities evaluatephiforces evaluatePotentials evaluatephi2derivs evaluateRphiderivs evaluateR2derivs evaluater2derivs evaluateRzderivs evaluateRforces evaluaterforces evaluateSurfaceDensities evaluatez2derivs evaluatezforces flatten flattening lindbladR nemo_accname nemo_accpars omegac plotDensities plotEscapecurve plotPotentials plotRotcurve rl rtide ttensor turn_physical_off turn_physical_on vcirc verticalfreq vesc vterm In addition to these, the following methods are available to compute expansion coefficients for the ``SCFPotential`` class for a given density .. toctree:: :maxdepth: 2 scf_compute_coeffs scf_compute_coeffs_axi scf_compute_coeffs_spherical Specific potentials +++++++++++++++++++ All of the following potentials can also be modified by the specific ``WrapperPotentials`` listed :ref:`below `. Spherical potentials ******************** .. toctree:: :maxdepth: 2 potentialburkert.rst potentialdoublepowerspher.rst potentialjaffe.rst potentialhernquist.rst potentialisochrone.rst potentialkepler.rst potentialnfw.rst potentialplummer.rst potentialpowerspher.rst potentialpowerspherwcut.rst potentialpseudoiso.rst potentialsphericalshell.rst Axisymmetric potentials *********************** .. toctree:: :maxdepth: 2 potentialdoubleexp.rst potentialflattenedpower.rst potentialinterprz.rst potentialinterpsnapshotrzpotential.rst potentialkuzmindisk.rst potentialkuzminkutuzov.rst potentialloghalo.rst potentialmiyamoto.rst potential3mn.rst potentialrazorexp.rst potentialring.rst potentialsnapshotrzpotential.rst Ellipsoidal triaxial potentials ******************************** ``galpy`` has very general support for implementing triaxial (or the oblate and prolate special cases) of ellipsoidal potentials through the general ``EllipsoidalPotential`` class. These potentials have densities that are uniform on ellipsoids, thus only functions of :math:`m^2 = x^2 + \frac{y^2}{b^2}+\frac{z^2}{c^2}`. New potentials of this type can be implemented by inheriting from this class and implementing the ``_mdens(self,m)``, ``_psi(self,m)``, and ``_mdens_deriv`` functions for the density, its integral with respect to :math:`m^2`, and its derivative with respect to m, respectively. For adding a C implementation, follow similar steps (use ``PerfectEllipsoidPotential`` as an example to follow). .. toctree:: :maxdepth: 2 potentialperfectellipsoid.rst potentialdoublepowertriaxial.rst potentialtriaxialjaffe.rst potentialtriaxialhernquist.rst potentialtriaxialnfw.rst Note that the Ferrers potential listed below is a potential of this type, but it is currently not implemented using the ``EllipsoidalPotential`` class. Spiral, bar, other triaxial, and miscellaneous potentials ********************************************************** .. toctree:: :maxdepth: 2 potentialdehnenbar.rst potentialferrers.rst potentialloghalo.rst potentialmovingobj.rst potentialsoftenedneedle.rst potentialspiralarms.rst All ``galpy`` potentials can also be made to rotate using the ``SolidBodyRotationWrapperPotential`` listed in the section on wrapper potentials :ref:`below `. General Poisson solvers for disks and halos ******************************************* .. toctree:: :maxdepth: 2 potentialdiskscf.rst potentialscf.rst Dissipative forces ******************* .. toctree:: :maxdepth: 2 potentialchandrasekhardynfric.rst .. _potential-mw: In addition to these classes, a simple Milky-Way-like potential fit to data on the Milky Way is included as ``galpy.potential.MWPotential2014`` (see the ``galpy`` paper for details). Note that this potential assumes a circular velocity of 220 km/s at the solar radius at 8 kpc; see `arXiv/1412.3451 `_ for full information on how this potential was fit. This potential is defined as >>> bp= PowerSphericalPotentialwCutoff(alpha=1.8,rc=1.9/8.,normalize=0.05) >>> mp= MiyamotoNagaiPotential(a=3./8.,b=0.28/8.,normalize=.6) >>> np= NFWPotential(a=16/8.,normalize=.35) >>> MWPotential2014= [bp,mp,np] and can thus be used like any list of ``Potentials``. If one wants to add the supermassive black hole at the Galactic center, this can be done by >>> from galpy.potential import KeplerPotential >>> from galpy.util import bovy_conversion >>> MWPotential2014wBH= [MWPotential2014,KeplerPotential(amp=4*10**6./bovy_conversion.mass_in_msol(220.,8.))] for a black hole with a mass of :math:`4\times10^6\,M_{\odot}` (this works because a list of Potential instances can contain a nested list of Potential instances in versions>=1.4). If you want to take into account dynamical friction for, say, an object of mass :math:`5\times 10^{10}\,M_\odot` and a half-mass radius of 5 kpc, do >>> from galpy.potential import ChandrasekharDynamicalFrictionForce >>> from astropy import units >>> cdf= ChandrasekharDynamicalFrictionForce(GMs=5.*10.**10.*units.Msun, rhm=5.*units.kpc, dens=MWPotential2014) >>> MWPotential2014wDF= [MWPotential2014,cdf] where we have specified the parameters of the dynamical friction with units; alternatively, convert them directly to ``galpy`` natural units as >>> cdf= ChandrasekharDynamicalFrictionForce(GMs=5.*10.**10./bovy_conversion.mass_in_msol(220.,8.), rhm=5./8., dens=MWPotential2014) >>> MWPotential2014wDF= [MWPotential2014,cdf] As explained in :ref:`this section `, *without* this black hole or dynamical friction, ``MWPotential2014`` can be used with Dehnen's gyrfalcON code using ``accname=PowSphwCut+MiyamotoNagai+NFW`` and ``accpars=0,1001.79126907,1.8,1.9#0,306770.418682,3.0,0.28#0,16.0,162.958241887``. An older version ``galpy.potential.MWPotential`` of a similar potential that was *not* fit to data on the Milky Way is defined as >>> mp= MiyamotoNagaiPotential(a=0.5,b=0.0375,normalize=.6) >>> np= NFWPotential(a=4.5,normalize=.35) >>> hp= HernquistPotential(a=0.6/8,normalize=0.05) >>> MWPotential= [mp,np,hp] ``galpy.potential.MWPotential2014`` supersedes ``galpy.potential.MWPotential``. 2D potentials ------------- General instance routines +++++++++++++++++++++++++ Use as ``Potential-instance.method(...)`` .. toctree:: :maxdepth: 2 __call__ phiforce Rforce turn_physical_off turn_physical_on General axisymmetric potential instance routines ++++++++++++++++++++++++++++++++++++++++++++++++ Use as ``Potential-instance.method(...)`` .. toctree:: :maxdepth: 2 epifreq lindbladR omegac plot plotEscapecurve plotRotcurve vcirc vesc General 2D potential routines +++++++++++++++++++++++++++++ Use as ``method(...)`` .. toctree:: :maxdepth: 2 evaluateplanarphiforces evaluateplanarPotentials evaluateplanarRforces evaluateplanarR2derivs flatten LinShuReductionFactor plotEscapecurve plotplanarPotentials plotRotcurve turn_physical_off turn_physical_on Specific potentials +++++++++++++++++++ All of the 3D potentials above can be used as two-dimensional potentials in the mid-plane. .. toctree:: :maxdepth: 2 toPlanarPotential (general) RZToplanarPotential In addition, a two-dimensional bar potential, two spiral potentials, the `Henon & Heiles (1964) `__ potential, and some static non-axisymmetric perturbations are included .. toctree:: :maxdepth: 2 potentialdehnenbar.rst potentialcosmphidisk.rst potentialellipticaldisk.rst potentialhenonheiles.rst potentiallopsideddisk.rst potentialsteadylogspiral.rst potentialtransientlogspiral.rst 1D potentials ------------- General instance routines +++++++++++++++++++++++++ Use as ``Potential-instance.method(...)`` .. toctree:: :maxdepth: 2 __call__ force plot turn_physical_off turn_physical_on General 1D potential routines +++++++++++++++++++++++++++++ Use as ``method(...)`` .. toctree:: :maxdepth: 2 evaluatelinearForces evaluatelinearPotentials flatten plotlinearPotentials turn_physical_off turn_physical_on Specific potentials +++++++++++++++++++ .. toctree:: :maxdepth: 2 KGPotential One-dimensional potentials can also be derived from 3D axisymmetric potentials as the vertical potential at a certain Galactocentric radius .. toctree:: :maxdepth: 2 RZToverticalPotential .. _potwrapperapi: Potential wrappers ------------------- Gravitational potentials in ``galpy`` can also be modified using wrappers, for example, to change their amplitude as a function of time. These wrappers can be applied to *any* ``galpy`` potential (although whether they can be used in C depends on whether the wrapper *and* all of the potentials that it wraps are implemented in C). Multiple wrappers can be applied to the same potential. Specific wrappers ++++++++++++++++++ .. toctree:: :maxdepth: 2 potentialcorotwrapper.rst potentialdehnensmoothwrapper.rst potentialgaussampwrapper.rst potentialsolidbodyrotationwrapper.rst