cmech

package module
v0.0.0-...-b6b8cb0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2017 License: GPL-2.0 Imports: 1 Imported by: 0

README

cmech

A simple celestial mechanics package in golang

Body

A struct which models a celestial body in the solar system. Mass in kg, state vector in cartesian coordinates (km-s).

func (body *Body) Update(other *Body, timestep float64)

Updates the state vector of a pair of Bodies based on gravitational forces for a single timestep.

getsv

Uses the JPL Horizons telnet server to get a mass and state vector for a celestial body. Includes a command line demo application.

Documentation

Index

Constants

View Source
const G float64 = 6.674e-20 // km**3 / kg-s**2

gravitational constant

Variables

This section is empty.

Functions

This section is empty.

Types

type Body

type Body struct {
	Name string
	X    float64
	Y    float64
	Z    float64
	Vx   float64
	Vy   float64
	Vz   float64
	T    float64 // thrust
	TVx  float64 // thrust direction (unit vector)
	TVy  float64
	TVz  float64
	Mass float64
}

celestial body km, sec, kg

func (*Body) Dist

func (body *Body) Dist(other *Body) float64

compute the Euclidian distance between two bodies

func (*Body) Update

func (body *Body) Update(other *Body, timestep float64)

update state of body and other based on pairwise interaction G m1 m2 / r ** 2 meters, seconds

type CMSystem

type CMSystem []*Body

system of Bodys

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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