Gravity Engine 2 3.0
Loading...
Searching...
No Matches
GravityEngine2.GBUnits Class Reference

Gravity engine uses NBody units (nbu) (https://en.wikipedia.org/wiki/N-body_units) internally. This allows the numerical integration to work with values without worring about loss of precision due to odd choices of scale (e.g. galaxy simulation in cm). More...

Classes

struct  GEScaler
 

Public Types

enum  Units {
  DL , SI , SI_km , AU ,
  CR3BP_SCALE
}
 Units Length Unit Time Unit Velocity DL
SI m sec. m/sec SI_km km sec. km/sec AU 1 AU sec. km/sec CR3BP 1.0. More...
 

Static Public Member Functions

static double DistanceConversion (Units from, Units to, CR3BP.CR3BPSystemData crsbpSysData=null)
 
static string DistanceShortForm (Units unit)
 
static double double geTimePerGameSec GetGandTimescale (Units units, double orbitScale, double orbitMass, double gameSecPerOrbit)
 
static double GForUnits (Units units)
 
static string MassShortForm (Units unit)
 
static double VelocityConversion (Units from, Units to, CR3BP.CR3BPSystemData crsbpSysData=null)
 
static string VelocityShortForm (Units unit)
 

Static Public Attributes

const double AU_m = 1.495979e+11
 
const double earthMassKg = 5.9722E24
 
const double earthRadiusKm = 6371.0
 
static double gravG
 
const double JUPITER_MASS = 1.89812E27
 
const double MARS_MASS = 6.41691e23
 
const double MIN_PER_SEC = 1.0 / 60.0
 
const double moon_g = 1.625
 
const double moonMassKg = 7.342E22
 
const double moonMeanOrbitRadiusKm = 384400
 
const double moonRadiusKm = 1735.5
 
const double mTokm = 0.001
 
const double NEWTONS_G_AUYR = 1.98534641318525E-05
 
const double NEWTONS_G_KM = NEWTONS_G_SI * 1E-9
 
const double NEWTONS_G_KMHR = 864989280000
 
const double NEWTONS_G_SI = 6.67430E-11
 
const double SATURN_MASS = 5.68317e26
 
const double SEC_PER_MIN = 60.0
 
const double SECS_PER_SIDEREAL_DAY = 86164.1
 
const double SGP_radiusearthkm = 6378.135
 
const double SUN_MASS = 1.98841E30
 
const double SUN_RADIUS_KM = 6.957E5
 

Detailed Description

Gravity engine uses NBody units (nbu) (https://en.wikipedia.org/wiki/N-body_units) internally. This allows the numerical integration to work with values without worring about loss of precision due to odd choices of scale (e.g. galaxy simulation in cm).

These units rescale such that inside GECore: M=1 R=1 G=1 M => All world masses are scaled by the total mass of the system R => Divide all distance by the size of the reference orbit (in true nbu this would be the virial radius of a cluster of bodies, since the lineage of nbu is stellar cluster modelling) G => this is a choice. By choosing G=1, time scale is affected.

See https://nbodyphysics.com/ge2/html/scaling.html

Since this is always somewhat confusing, consider a concrete example: Earth satellite, in orbit of 7000km in SI units. Me = 5.972E24 kg, R=7E6 m, V=7531 m/s G_si = 6.674E-11 m^3/(kg s^2)

World => GE Earth mass => Me/Me = 1 Orbit radius = Rorbit/Rref = 1 V * Sqrt(R/(G_si M)) = 7512 * 1.33E-4 = 1

GE => World Mass => * M Distance => *R Velocity => * Sqrt(G_si M/R) Time => * Sqrt(R^3/(G_si M)) 1 s => 931.8 world sec

One orbit period for R=1, M=1, G=1 takes T=2 Pi. The integration step size in GE is typically chosen as 1000 steps per orbit or 2 Pi/1000 = 0.00628. This corresponds to a world time of 5.85 sec.

The orbit above has a period of 5851 sec. or about 1.63 hours.

Member Enumeration Documentation

◆ Units

Units Length Unit Time Unit Velocity DL
SI m sec. m/sec SI_km km sec. km/sec AU 1 AU sec. km/sec CR3BP 1.0.

CR3BP is scaled for a specific circular restricted 3-body system in which the scale length has been set to one, and the timescale (inverse of angular freq. of the system, which is period/2Pi). The position and velocity are defined in the co-rotating coordinate system.


The documentation for this class was generated from the following file: