orbit

package
v0.0.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2026 License: Apache-2.0 Imports: 8 Imported by: 3 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package orbit steps stars through a potential and reports their nearest pass to the galactic centre. It is the reference, in 64-bit floats, that the kernel in gpu/orbit is held to.

Inside, lengths are kiloparsecs and speeds kilometres per second, so the unit of time is one kiloparsec per kilometre per second, about 978 million years, and a potential's gm is in kiloparsecs times kilometres per second squared. The surface is measure's types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Back

func Back(field Potential, star State, span measure.Duration,
	steps int) (*Pass, *State, error)

Back runs a star's orbit back over a span, in so many steps, and reports its nearest pass to the centre over them, and its state at the start of the span.

It refuses a span that is not positive, no steps, and an orbit that ran away, through the centre or past what a float holds.

func Kiloparsecs

func Kiloparsecs(count float64) measure.Length

Kiloparsecs is a length of so many kiloparsecs.

func Step

func Step(span measure.Duration, steps int) (float64, error)

Step is the length of one of so many steps over a span, in units of time. It refuses a span that is not positive, and no steps.

func Units

func Units(count float64) measure.Duration

Units is a span of so many units of time, each a kiloparsec per kilometre per second.

Types

type Bulge

type Bulge struct {
	// contains filtered or unexported fields
}

Bulge is a bulge whose density falls as a power of the distance from the centre with an exponential cut-off: proportional to r to the exponent, times e to the minus (r over the cut-off) squared, as galpy's PowerSphericalPotentialwCutoff. The exponent is negative.

Its pull is that of the mass within the distance, which the regularised lower incomplete gamma function gives, of order half of three plus the exponent.

func (Bulge) GM

func (bulge Bulge) GM() float64

GM is the whole bulge's mass times the gravitational constant, in kiloparsecs times kilometres per second squared.

func (Bulge) Order

func (bulge Bulge) Order() float64

Order is the incomplete gamma function's order for the mass within a distance: half of three plus the exponent.

func (Bulge) Pull

func (bulge Bulge) Pull(at Place) Pull

Pull is the pull of the mass within the distance, toward the centre. At the centre itself it is not a number.

func (Bulge) Shape

func (bulge Bulge) Shape() (exponent, cutoff float64)

Shape is the bulge's density exponent and its cut-off in kiloparsecs.

func (Bulge) Well

func (bulge Bulge) Well(at Place) float64

Well is the bulge's potential at a place, in kilometres squared per second squared, below nothing: the mass within over the distance, and the shells outside, which the regularised upper incomplete gamma function of half an order less gives.

type Disc

type Disc struct {
	// contains filtered or unexported fields
}

Disc is a Miyamoto-Nagai disc: a Plummer sphere stretched along the plane by a scale length, with a scale height, both in kiloparsecs.

func (Disc) GM

func (disc Disc) GM() float64

GM is the disc's mass times the gravitational constant, in kiloparsecs times kilometres per second squared.

func (Disc) Pull

func (disc Disc) Pull(at Place) Pull

Pull is the disc's pull: in the plane as a point mass at the reach, out of it the same scaled by the lift's share of the hypotenuse.

func (Disc) Shape

func (disc Disc) Shape() (scaleLength, height float64)

Shape is the disc's scale length and scale height in kiloparsecs.

func (Disc) Well

func (disc Disc) Well(at Place) float64

Well is the disc's potential at a place, in kilometres squared per second squared, below nothing: a point mass's at the reach.

type Halo

type Halo struct {
	// contains filtered or unexported fields
}

Halo is a Navarro-Frenk-White halo: a density that falls as the distance near the centre and as its cube far out, turning at a scale radius in kiloparsecs.

Its gm is of the mass of a scale: four pi times the density's scale times the radius cubed, times the gravitational constant.

func (Halo) GM

func (halo Halo) GM() float64

GM is the mass of a scale times the gravitational constant, in kiloparsecs times kilometres per second squared.

func (Halo) Pull

func (halo Halo) Pull(at Place) Pull

Pull is the pull of the mass within the distance, toward the centre. At the centre itself it is not a number.

func (Halo) Scale

func (halo Halo) Scale() float64

Scale is the halo's scale radius in kiloparsecs.

func (Halo) Well

func (halo Halo) Well(at Place) float64

Well is the halo's potential at a place, in kilometres squared per second squared, below nothing.

type Kepler

type Kepler struct {
	// contains filtered or unexported fields
}

Kepler is the pull of one point mass at the centre.

func NewKepler

func NewKepler(body grav.Body) Kepler

NewKepler is the pull of a body at the centre.

func (Kepler) GM

func (field Kepler) GM() float64

GM is the body's mass times the gravitational constant, in kiloparsecs times kilometres per second squared.

func (Kepler) Pull

func (field Kepler) Pull(at Place) Pull

Pull is the inverse-square pull toward the centre. At the centre itself it is not a number, and an orbit through it runs away.

func (Kepler) Well

func (field Kepler) Well(at Place) float64

Well is a point mass's well at a place, in kilometres squared per second squared, below nothing: its gm over the distance.

type MilkyWay

type MilkyWay struct {
	// contains filtered or unexported fields
}

MilkyWay is the galaxy's pull as a model has it: a bulge whose density is a power law with an exponential cut-off, a Miyamoto-Nagai disc and a Navarro-Frenk-White halo, and the black hole at the centre as a point mass.

Each part is normalised by its share of the radial force at the Sun's distance in the model, where the circular speed is the model's.

Bovy 2015 says MWPotential2014 does not contain the black hole. It is added here, from the measured mass of Sgr A*, since the inner parsecs are this search's regime; its pull is a part in twenty thousand of the galaxy's at the Sun.

The model lives at its own distance for the Sun and its own circular speed there. A caller placing the Sun at its measured distance does that in the transform, as galpy does, not by rescaling the model.

That seam is open. At the measured distance, 8.277 kpc, the model's circular speed is about 219 km/s (220 at 8 kpc, falling as the curve's slope has it) and the Sun's about 231 with its own motion added; the galactocentric frame's Sun goes 251.5 along the rotation.

The 20 km/s between them is carried by every star the frame places until the model is placed at the frame's Sun, as galpy's ro and vo do, or the frame's Sun is given the model's speed. That choice is not made here.

func NewMilkyWay

func NewMilkyWay(model Model, hole grav.Body) (*MilkyWay, error)

NewMilkyWay is the galaxy of a model, with the given black hole at the centre: the caller makes it, as a point of the ledger's sgr-a-mass for the real one.

It refuses a model the physics cannot hold: no circle for the Sun, a negative share, a bulge whose well diverges, or a part with no size.

func (MilkyWay) Bulge

func (galaxy MilkyWay) Bulge() Bulge

Bulge is the bulge's pull.

func (MilkyWay) Disc

func (galaxy MilkyWay) Disc() Disc

Disc is the disc's pull.

func (MilkyWay) Halo

func (galaxy MilkyWay) Halo() Halo

Halo is the halo's pull.

func (MilkyWay) Hole

func (galaxy MilkyWay) Hole() Kepler

Hole is the black hole's pull.

func (MilkyWay) Pull

func (galaxy MilkyWay) Pull(at Place) Pull

Pull is the four pulls together.

func (MilkyWay) Well

func (galaxy MilkyWay) Well(at Place) float64

Well is the four wells together.

type Model

type Model struct {
	// contains filtered or unexported fields
}

Model is a galaxy's numbers as Bovy 2015 gives MWPotential2014's: the Sun's distance from the centre and the circular speed there, which the model is normalised to; each part's share of the radial force there; and each part's shape.

Lengths are kiloparsecs, the speed is kilometres per second, shares and the exponent are plain numbers. A model is built from the Sun's circle with each part added: NewModel(8, 220).WithBulge(0.05, -1.8, 1.9) and so on, as MWPotential2014 does from the research ledger.

func MWPotential2014

func MWPotential2014() Model

MWPotential2014 is the model as the research ledger has it from the paper's table 1: the Sun at 8 kpc circling at 220 km/s, the bulge a twentieth of the force there, the disc three fifths, the halo the rest.

func NewModel

func NewModel(sun, circular float64) Model

NewModel is a model of a galaxy where the Sun is so many kiloparsecs from the centre, circling at so many kilometres per second, with no parts yet.

func (Model) BulgeShape

func (model Model) BulgeShape() (exponent, cutoff float64)

BulgeShape is the bulge's density exponent and its cut-off in kiloparsecs.

func (Model) DiscShape

func (model Model) DiscShape() (scaleLength, height float64)

DiscShape is the disc's scale length and scale height in kiloparsecs.

func (Model) HaloShape

func (model Model) HaloShape() float64

HaloShape is the halo's scale radius in kiloparsecs.

func (Model) Shares

func (model Model) Shares() (bulge, disc, halo float64)

Shares is each part's share of the radial force at the Sun.

func (Model) Sun

func (model Model) Sun() (distance, circular float64)

Sun is the Sun's distance from the centre in kiloparsecs and the circular speed there in kilometres per second.

func (Model) WithBulge

func (model Model) WithBulge(share, exponent, cutoff float64) Model

WithBulge is the model with its bulge: the bulge's share of the radial force at the Sun, its density's exponent and its cut-off in kiloparsecs.

func (Model) WithDisc

func (model Model) WithDisc(share, scaleLength, height float64) Model

WithDisc is the model with its disc: the disc's share of the radial force at the Sun, its scale length and its scale height, in kiloparsecs.

func (Model) WithHalo

func (model Model) WithHalo(share, scale float64) Model

WithHalo is the model with its halo: the halo's share of the radial force at the Sun and its scale radius in kiloparsecs.

type Numbers

type Numbers struct {
	// contains filtered or unexported fields
}

Numbers is a star's place in kiloparsecs and its motion in kilometres per second along each axis.

func (Numbers) At

func (numbers Numbers) At() (x, y, z float64)

At is the place, in kiloparsecs along each axis.

func (Numbers) Moving

func (numbers Numbers) Moving() (vx, vy, vz float64)

Moving is the motion, in kilometres per second along each axis.

type Pass

type Pass struct {
	// contains filtered or unexported fields
}

Pass is a star's nearest sampled pass to the centre over a span: how near it came, how long ago, and the step's shares of the pass there.

Positions are sampled at each step's end, so the pass is the nearest of those, not the orbit's own pericentre; more steps bring the two together.

How many steps is set by the nearest pass itself: a step dt resolves a pass at a distance r at a speed v under a pull a when v dt over r and a dt squared over r are both small, and the leapfrog's errors are of the size of the first's square and of the second.

Those two are the step's shares, and the pass carries them from the step it was found at, so a caller can tell a resolved pass from a plunge the steps missed: a star that fell through the inner parsecs between two samples has a pass with large shares.

orbittest.Resolved is the same measure from a point mass's closed form, and the tests hold the kernel to this reference where it is under a tenth. A run that wants the passes through the inner parsecs sizes its steps by the nearest pass it means to see.

func NewPass

func NewPass(near, ago, moved, pulled float64) Pass

NewPass is a pass so many kiloparsecs from the centre, so many units of time ago, with the step's shares of it in the star's motion and in the pull.

func (Pass) Ago

func (pass Pass) Ago() measure.Duration

Ago is how long ago it came that near.

func (Pass) Near

func (pass Pass) Near() measure.Length

Near is how near the centre the star came.

func (Pass) Numbers

func (pass Pass) Numbers() (near, ago float64)

Numbers is the pass in kiloparsecs and units of time.

func (Pass) Steps

func (pass Pass) Steps() (moved, pulled float64)

Steps is the step's shares of the pass: how far the star moved in one step, and how much the pull moved it over one step squared, each as a share of the pass's distance. Both small means the steps resolved the pass.

A pass through the centre itself has shares that are not finite, since no step resolves it.

type Place

type Place struct {
	// contains filtered or unexported fields
}

Place is a position from the galactic centre.

func PlaceOf

func PlaceOf(x, y, z float64) Place

PlaceOf is the place x, y and z kiloparsecs from the centre along the axes.

func (Place) Coord

func (place Place) Coord() measure.Coord

Coord is the place as a coordinate from the centre.

func (Place) Numbers

func (place Place) Numbers() (x, y, z float64)

Numbers is the place in kiloparsecs along each axis.

type Potential

type Potential interface {
	// Pull is the acceleration at a place: the change in a star's
	// velocity there over one unit of time.
	Pull(at Place) Pull
}

Potential is what pulls on a star.

type Pull

type Pull struct {
	// contains filtered or unexported fields
}

Pull is an acceleration: the change of velocity over one unit of time along each galactic axis, in kilometres per second.

func NewPull

func NewPull(x, y, z float64) Pull

NewPull is an acceleration of so many kilometres per second over one unit of time along each axis.

func (Pull) Along

func (pull Pull) Along() (x, y, z float64)

Along is the acceleration along each axis, in kilometres per second over one unit of time.

type State

type State struct {
	// contains filtered or unexported fields
}

State is a star's place and motion.

func NewState

func NewState(at measure.Coord, moving measure.Velocity) State

NewState is a star at a place, moving at a velocity.

func StateOf

func StateOf(x, y, z, vx, vy, vz float64) State

StateOf is a star at x, y and z kiloparsecs from the centre, moving vx, vy and vz kilometres per second along the axes.

func (State) Motion

func (star State) Motion() (*measure.Velocity, error)

Motion is how the star moves. Nothing stepped here moves faster than light, so the error is for a state built from numbers that do.

func (State) Numbers

func (star State) Numbers() Numbers

Numbers is the star's numbers, as the stepping runs on them.

func (State) Place

func (star State) Place() measure.Coord

Place is where the star is.

Directories

Path Synopsis
Package orbittest is what orbit's tests and gpu/orbit's share: a centre to orbit, the closed forms of a point mass's orbits, and how well a run of steps resolves one.
Package orbittest is what orbit's tests and gpu/orbit's share: a centre to orbit, the closed forms of a point mass's orbits, and how well a run of steps resolves one.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL