init
This commit is contained in:
commit
aa48f1fc02
8
.cargo/config.toml
Normal file
8
.cargo/config.toml
Normal file
@ -0,0 +1,8 @@
|
||||
# for Linux
|
||||
[target.x86_64-unknown-linux-gnu]
|
||||
linker = "clang"
|
||||
rustflags = ["-C", "link-arg=-fuse-ld=lld"]
|
||||
|
||||
# for Windows
|
||||
[target.x86_64-pc-windows-msvc]
|
||||
linker = "rust-lld.exe"
|
||||
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/target/
|
||||
/.claude/
|
||||
27
CLAUDE.md
Normal file
27
CLAUDE.md
Normal file
@ -0,0 +1,27 @@
|
||||
# CLAUDE.md
|
||||
|
||||
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||
|
||||
## Project Overview
|
||||
|
||||
This is a Bevy game engine project written in Rust.
|
||||
|
||||
## General rules
|
||||
|
||||
- Prefer fetching accurate and latest information by using tools like search, before concluding a solution. For example, when not confident with library APIs, search latest documentation and example code before attempting to add code to this project.
|
||||
- Always clear all errors and warnings by `cargo check`, or by checking IDE integration diagnostics, before concluding the code.
|
||||
|
||||
## Development Commands
|
||||
|
||||
### Building
|
||||
- `cargo run --features dev_mode` - Build and run the application
|
||||
- `cargo build` - Build the project without running
|
||||
- `cargo check` - Fast compile check without producing binaries
|
||||
|
||||
## Code Architecture
|
||||
|
||||
### Application Structure
|
||||
The application follows Bevy's ECS (Entity Component System) pattern:
|
||||
|
||||
### Bevy Version and Component Pattern
|
||||
- Uses Bevy 0.16 (latest stable)
|
||||
5184
Cargo.lock
generated
Normal file
5184
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
18
Cargo.toml
Normal file
18
Cargo.toml
Normal file
@ -0,0 +1,18 @@
|
||||
[package]
|
||||
name = "solar-sim"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
bevy = "0.16"
|
||||
|
||||
# Enable a small amount of optimization in the dev profile.
|
||||
[profile.dev]
|
||||
opt-level = 1
|
||||
|
||||
# Enable a large amount of optimization in the dev profile for dependencies.
|
||||
[profile.dev.package."*"]
|
||||
opt-level = 3
|
||||
|
||||
[features]
|
||||
dev_mode = ["bevy/bevy_dev_tools", "bevy/dynamic_linking"]
|
||||
152
assets/earth.txt
Normal file
152
assets/earth.txt
Normal file
@ -0,0 +1,152 @@
|
||||
curl -s "https://ssd.jpl.nasa.gov/api/horizons.api?format=text&COMMAND=%27399%27&CENTER=%27%40sun%27&EPHEM_TYPE=%27VECTORS%27&OUT_UNITS=%27AU-D%27&START_TIME=%272000-01-01%2012:00%27&STOP_TIME=%272000-01-01%2012:01%27&STEP_SIZE=%271%20m%27&VEC_TABLE=2&REF_PLANE=%27ECLIPTIC%27&REF_SYSTEM=%27J2000%27"
|
||||
|
||||
API VERSION: 1.2
|
||||
API SOURCE: NASA/JPL Horizons API
|
||||
|
||||
*******************************************************************************
|
||||
Revised: April 12,
|
||||
2021 Earth 399
|
||||
|
||||
GEOPHYSICAL PROPERTIES (revised May 9,
|
||||
2022):
|
||||
Vol. Mean Radius (km) = 6371.01+-0.02 Mass x10^24 (kg)= 5.97219+-0.0006
|
||||
Equ. radius, km = 6378.137 Mass layers:
|
||||
Polar axis, km = 6356.752 Atmos = 5.1 x 10^18 kg
|
||||
Flattening = 1/298.257223563 oceans = 1.4 x 10^21 kg
|
||||
Density, g/cm^3 = 5.51 crust = 2.6 x 10^22 kg
|
||||
J2 (IERS 2010) = 0.00108262545 mantle = 4.043 x 10^24 kg
|
||||
g_p, m/s^2 (polar) = 9.8321863685 outer core = 1.835 x 10^24 kg
|
||||
g_e, m/s^2 (equatorial) = 9.7803267715 inner core = 9.675 x 10^22 kg
|
||||
g_o, m/s^2 = 9.82022 Fluid core rad = 3480 km
|
||||
GM, km^3/s^2 = 398600.435436 Inner core rad = 1215 km
|
||||
GM 1-sigma, km^3/s^2 = 0.0014 Escape velocity = 11.186 km/s
|
||||
Rot. Rate (rad/s) = 0.00007292115 Surface area:
|
||||
Mean sidereal day, hr = 23.9344695944 land = 1.48 x 10^8 km
|
||||
Mean solar day 2000.0, s = 86400.002 sea = 3.62 x 10^8 km
|
||||
Mean solar day 1820.0, s = 86400.0 Love no., k2 = 0.299
|
||||
Moment of inertia = 0.3308 Atm. pressure = 1.0 bar
|
||||
Mean surface temp (Ts), K= 287.6 Volume, km^3 = 1.08321 x 10^12
|
||||
Mean effect. temp (Te), K= 255 Magnetic moment = 0.61 gauss Rp^3
|
||||
Geometric albedo = 0.367 Vis. mag. V(1,
|
||||
0)= -3.86
|
||||
Solar Constant (W/m^2) = 1367.6 (mean),
|
||||
1414 (perihelion),
|
||||
1322 (aphelion)
|
||||
HELIOCENTRIC ORBIT CHARACTERISTICS:
|
||||
Obliquity to orbit, deg = 23.4392911 Sidereal orb period = 1.0000174 y
|
||||
Orbital speed, km/s = 29.79 Sidereal orb period = 365.25636 d
|
||||
Mean daily motion, deg/d = 0.9856474 Hill's sphere radius = 234.9
|
||||
*******************************************************************************
|
||||
|
||||
|
||||
*******************************************************************************
|
||||
Ephemeris / API_USER Wed Aug 13 04: 00: 37 2025 Pasadena, USA / Horizons
|
||||
*******************************************************************************
|
||||
Target body name: Earth (399) {source: DE441
|
||||
}
|
||||
Center body name: Sun (10) {source: DE441
|
||||
}
|
||||
Center-site name: BODY CENTER
|
||||
*******************************************************************************
|
||||
Start time : A.D. 2000-Jan-01 12: 00: 00.0000 TDB
|
||||
Stop time : A.D. 2000-Jan-01 12: 01: 00.0000 TDB
|
||||
Step-size : 1 minutes
|
||||
*******************************************************************************
|
||||
Center geodetic : 0.0,
|
||||
0.0,
|
||||
0.0 {E-lon(deg),Lat(deg),Alt(km)
|
||||
}
|
||||
Center cylindric: 0.0,
|
||||
0.0,
|
||||
0.0 {E-lon(deg),Dxy(km),Dz(km)
|
||||
}
|
||||
Center radii : 695700.0,
|
||||
695700.0,
|
||||
695700.0 km {Equator_a, b, pole_c
|
||||
}
|
||||
Output units : AU-D
|
||||
Calendar mode : Mixed Julian/Gregorian
|
||||
Output type : GEOMETRIC cartesian states
|
||||
Output format : 2 (position and velocity)
|
||||
Reference frame : Ecliptic of J2000.0
|
||||
*******************************************************************************
|
||||
JDTDB
|
||||
X Y Z
|
||||
VX VY VZ
|
||||
*******************************************************************************
|
||||
$$SOE
|
||||
2451545.000000000 = A.D. 2000-Jan-01 12: 00: 00.0000 TDB
|
||||
X =-1.771350992727098E-01 Y = 9.672416867665306E-01 Z =-4.085281582511366E-06
|
||||
VX=-1.720762506872895E-02 VY=-3.158782144324866E-03 VZ= 1.049888594613343E-07
|
||||
2451545.000694444 = A.D. 2000-Jan-01 12: 01: 00.0000 TDB
|
||||
X =-1.771470489993106E-01 Y = 9.672394930949845E-01 Z =-4.085208640488331E-06
|
||||
VX=-1.720758754114626E-02 VY=-3.158991907845201E-03 VZ= 1.050842029536420E-07
|
||||
$$EOE
|
||||
*******************************************************************************
|
||||
|
||||
TIME
|
||||
|
||||
Barycentric Dynamical Time ("TDB" or T_eph) output was requested. This
|
||||
continuous coordinate time is equivalent to the relativistic proper time
|
||||
of a clock at rest in a reference frame co-moving with the solar system
|
||||
barycenter but outside the system's gravity well. It is the independent
|
||||
variable in the solar system relativistic equations of motion.
|
||||
|
||||
TDB runs at a uniform rate of one SI second per second and is independent
|
||||
of irregularities in Earth's rotation.
|
||||
|
||||
CALENDAR SYSTEM
|
||||
|
||||
Mixed calendar mode was active such that calendar dates after AD 1582-Oct-15
|
||||
(if any) are in the modern Gregorian system. Dates prior to 1582-Oct-5 (if any)
|
||||
are in the Julian calendar system, which is automatically extended for dates
|
||||
prior to its adoption on 45-Jan-1 BC. The Julian calendar is useful for
|
||||
matching historical dates. The Gregorian calendar more accurately corresponds
|
||||
to the Earth's orbital motion and seasons. A "Gregorian-only" calendar mode is
|
||||
available if such physical events are the primary interest.
|
||||
|
||||
REFERENCE FRAME AND COORDINATES
|
||||
|
||||
Ecliptic at the standard reference epoch
|
||||
|
||||
Reference epoch: J2000.0
|
||||
X-Y plane: adopted Earth orbital plane at the reference epoch
|
||||
Note: IAU76 obliquity of 84381.448 arcseconds wrt ICRF X-Y plane
|
||||
X-axis : ICRF
|
||||
Z-axis : perpendicular to the X-Y plane in the directional (+ or -) sense
|
||||
of Earth's north pole at the reference epoch.
|
||||
|
||||
Symbol meaning [
|
||||
1 au= 149597870.700 km,
|
||||
1 day= 86400.0 s
|
||||
]:
|
||||
|
||||
JDTDB Julian Day Number, Barycentric Dynamical Time
|
||||
X X-component of position vector (au)
|
||||
Y Y-component of position vector (au)
|
||||
Z Z-component of position vector (au)
|
||||
VX X-component of velocity vector (au/day)
|
||||
VY Y-component of velocity vector (au/day)
|
||||
VZ Z-component of velocity vector (au/day)
|
||||
|
||||
ABERRATIONS AND CORRECTIONS
|
||||
|
||||
Geometric state vectors have NO corrections or aberrations applied.
|
||||
|
||||
Computations by ...
|
||||
|
||||
Solar System Dynamics Group, Horizons On-Line Ephemeris System
|
||||
4800 Oak Grove Drive, Jet Propulsion Laboratory
|
||||
Pasadena, CA 91109 USA
|
||||
|
||||
General site: https: //ssd.jpl.nasa.gov/
|
||||
Mailing list: https: //ssd.jpl.nasa.gov/email_list.html
|
||||
System news : https: //ssd.jpl.nasa.gov/horizons/news.html
|
||||
User Guide : https: //ssd.jpl.nasa.gov/horizons/manual.html
|
||||
Connect : browser https: //ssd.jpl.nasa.gov/horizons/app.html#/x
|
||||
API https: //ssd-api.jpl.nasa.gov/doc/horizons.html
|
||||
command-line telnet ssd.jpl.nasa.gov 6775
|
||||
e-mail/batch https: //ssd.jpl.nasa.gov/ftp/ssd/horizons_batch.txt
|
||||
scripts https: //ssd.jpl.nasa.gov/ftp/ssd/SCRIPTS
|
||||
Author : Jon.D.Giorgini@jpl.nasa.gov
|
||||
*******************************************************************************
|
||||
127
assets/moon.txt
Normal file
127
assets/moon.txt
Normal file
@ -0,0 +1,127 @@
|
||||
curl -s "https://ssd.jpl.nasa.gov/api/horizons.api?format=text&COMMAND=%27301%27&CENTER=%27%40sun%27&EPHEM_TYPE=%27VECTORS%27&OUT_UNITS=%27AU-D%27&START_TIME=%272000-01-01%2012:00%27&STOP_TIME=%272000-01-01%2012:01%27&STEP_SIZE=%271%20m%27&VEC_TABLE=2&REF_PLANE=%27ECLIPTIC%27&REF_SYSTEM=%27J2000%27"
|
||||
|
||||
API VERSION: 1.2
|
||||
API SOURCE: NASA/JPL Horizons API
|
||||
|
||||
*******************************************************************************
|
||||
Revised: July 31, 2013 Moon / (Earth) 301
|
||||
|
||||
GEOPHYSICAL DATA (updated 2018-Aug-15):
|
||||
Vol. mean radius, km = 1737.53+-0.03 Mass, x10^22 kg = 7.349
|
||||
Radius (gravity), km = 1738.0 Surface emissivity = 0.92
|
||||
Radius (IAU), km = 1737.4 GM, km^3/s^2 = 4902.800066
|
||||
Density, g/cm^3 = 3.3437 GM 1-sigma, km^3/s^2 = +-0.0001
|
||||
V(1,0) = +0.21 Surface accel., m/s^2 = 1.62
|
||||
Earth/Moon mass ratio = 81.3005690769 Farside crust. thick. = ~80 - 90 km
|
||||
Mean crustal density = 2.97+-.07 g/cm^3 Nearside crust. thick.= 58+-8 km
|
||||
Heat flow, Apollo 15 = 3.1+-.6 mW/m^2 Mean angular diameter = 31'05.2"
|
||||
Heat flow, Apollo 17 = 2.2+-.5 mW/m^2 Sid. rot. rate, rad/s = 0.0000026617
|
||||
Geometric Albedo = 0.12 Mean solar day = 29.5306 d
|
||||
Obliquity to orbit = 6.67 deg Orbit period = 27.321582 d
|
||||
Semi-major axis, a = 384400 km Eccentricity = 0.05490
|
||||
Mean motion, rad/s = 2.6616995x10^-6 Inclination = 5.145 deg
|
||||
Apsidal period = 3231.50 d Nodal period = 6798.38 d
|
||||
Perihelion Aphelion Mean
|
||||
Solar Constant (W/m^2) 1414+-7 1323+-7 1368+-7
|
||||
Maximum Planetary IR (W/m^2) 1314 1226 1268
|
||||
Minimum Planetary IR (W/m^2) 5.2 5.2 5.2
|
||||
********************************************************************************
|
||||
|
||||
|
||||
*******************************************************************************
|
||||
Ephemeris / API_USER Wed Aug 13 04:01:18 2025 Pasadena, USA / Horizons
|
||||
*******************************************************************************
|
||||
Target body name: Moon (301) {source: DE441}
|
||||
Center body name: Sun (10) {source: DE441}
|
||||
Center-site name: BODY CENTER
|
||||
*******************************************************************************
|
||||
Start time : A.D. 2000-Jan-01 12:00:00.0000 TDB
|
||||
Stop time : A.D. 2000-Jan-01 12:01:00.0000 TDB
|
||||
Step-size : 1 minutes
|
||||
*******************************************************************************
|
||||
Center geodetic : 0.0, 0.0, 0.0 {E-lon(deg),Lat(deg),Alt(km)}
|
||||
Center cylindric: 0.0, 0.0, 0.0 {E-lon(deg),Dxy(km),Dz(km)}
|
||||
Center radii : 695700.0, 695700.0, 695700.0 km {Equator_a, b, pole_c}
|
||||
Output units : AU-D
|
||||
Calendar mode : Mixed Julian/Gregorian
|
||||
Output type : GEOMETRIC cartesian states
|
||||
Output format : 2 (position and velocity)
|
||||
Reference frame : Ecliptic of J2000.0
|
||||
*******************************************************************************
|
||||
JDTDB
|
||||
X Y Z
|
||||
VX VY VZ
|
||||
*******************************************************************************
|
||||
$$SOE
|
||||
2451545.000000000 = A.D. 2000-Jan-01 12:00:00.0000 TDB
|
||||
X =-1.790843809223965E-01 Y = 9.654035607264573E-01 Z = 2.383726922995396E-04
|
||||
VX=-1.683595459141215E-02 VY=-3.580960720855671E-03 VZ=-6.540550604528720E-06
|
||||
2451545.000694444 = A.D. 2000-Jan-01 12:01:00.0000 TDB
|
||||
X =-1.790960725225740E-01 Y = 9.654010738956424E-01 Z = 2.383681475637660E-04
|
||||
VX=-1.683585392087164E-02 VY=-3.581112024431721E-03 VZ=-6.548288423082821E-06
|
||||
$$EOE
|
||||
*******************************************************************************
|
||||
|
||||
TIME
|
||||
|
||||
Barycentric Dynamical Time ("TDB" or T_eph) output was requested. This
|
||||
continuous coordinate time is equivalent to the relativistic proper time
|
||||
of a clock at rest in a reference frame co-moving with the solar system
|
||||
barycenter but outside the system's gravity well. It is the independent
|
||||
variable in the solar system relativistic equations of motion.
|
||||
|
||||
TDB runs at a uniform rate of one SI second per second and is independent
|
||||
of irregularities in Earth's rotation.
|
||||
|
||||
CALENDAR SYSTEM
|
||||
|
||||
Mixed calendar mode was active such that calendar dates after AD 1582-Oct-15
|
||||
(if any) are in the modern Gregorian system. Dates prior to 1582-Oct-5 (if any)
|
||||
are in the Julian calendar system, which is automatically extended for dates
|
||||
prior to its adoption on 45-Jan-1 BC. The Julian calendar is useful for
|
||||
matching historical dates. The Gregorian calendar more accurately corresponds
|
||||
to the Earth's orbital motion and seasons. A "Gregorian-only" calendar mode is
|
||||
available if such physical events are the primary interest.
|
||||
|
||||
REFERENCE FRAME AND COORDINATES
|
||||
|
||||
Ecliptic at the standard reference epoch
|
||||
|
||||
Reference epoch: J2000.0
|
||||
X-Y plane: adopted Earth orbital plane at the reference epoch
|
||||
Note: IAU76 obliquity of 84381.448 arcseconds wrt ICRF X-Y plane
|
||||
X-axis : ICRF
|
||||
Z-axis : perpendicular to the X-Y plane in the directional (+ or -) sense
|
||||
of Earth's north pole at the reference epoch.
|
||||
|
||||
Symbol meaning [1 au= 149597870.700 km, 1 day= 86400.0 s]:
|
||||
|
||||
JDTDB Julian Day Number, Barycentric Dynamical Time
|
||||
X X-component of position vector (au)
|
||||
Y Y-component of position vector (au)
|
||||
Z Z-component of position vector (au)
|
||||
VX X-component of velocity vector (au/day)
|
||||
VY Y-component of velocity vector (au/day)
|
||||
VZ Z-component of velocity vector (au/day)
|
||||
|
||||
ABERRATIONS AND CORRECTIONS
|
||||
|
||||
Geometric state vectors have NO corrections or aberrations applied.
|
||||
|
||||
Computations by ...
|
||||
|
||||
Solar System Dynamics Group, Horizons On-Line Ephemeris System
|
||||
4800 Oak Grove Drive, Jet Propulsion Laboratory
|
||||
Pasadena, CA 91109 USA
|
||||
|
||||
General site: https://ssd.jpl.nasa.gov/
|
||||
Mailing list: https://ssd.jpl.nasa.gov/email_list.html
|
||||
System news : https://ssd.jpl.nasa.gov/horizons/news.html
|
||||
User Guide : https://ssd.jpl.nasa.gov/horizons/manual.html
|
||||
Connect : browser https://ssd.jpl.nasa.gov/horizons/app.html#/x
|
||||
API https://ssd-api.jpl.nasa.gov/doc/horizons.html
|
||||
command-line telnet ssd.jpl.nasa.gov 6775
|
||||
e-mail/batch https://ssd.jpl.nasa.gov/ftp/ssd/horizons_batch.txt
|
||||
scripts https://ssd.jpl.nasa.gov/ftp/ssd/SCRIPTS
|
||||
Author : Jon.D.Giorgini@jpl.nasa.gov
|
||||
*******************************************************************************
|
||||
126
assets/sun.txt
Normal file
126
assets/sun.txt
Normal file
@ -0,0 +1,126 @@
|
||||
curl -s "https://ssd.jpl.nasa.gov/api/horizons.api?format=text&COMMAND=%27%40sun%27&CENTER=%27%40sun%27&EPHEM_TYPE=%27VECTORS%27&OUT_UNITS=%27AU-D%27&START_TIME=%272000-01-01%2012:00%27&STOP_TIME=%272000-01-01%2012:01%27&STEP_SIZE=%271%20m%27&VEC_TABLE=2&REF_PLANE=%27ECLIPTIC%27&REF_SYSTEM=%27J2000%27"
|
||||
|
||||
API VERSION: 1.2
|
||||
API SOURCE: NASA/JPL Horizons API
|
||||
|
||||
*******************************************************************************
|
||||
Revised: July 31, 2013 Sun 10
|
||||
|
||||
PHYSICAL PROPERTIES (updated 2024-Oct-30):
|
||||
GM, km^3/s^2 = 132712440041.93938 Mass, 10^24 kg = ~1988410
|
||||
Vol. mean radius, km = 695700 Volume, 10^12 km^3 = 1412000
|
||||
Solar radius (IAU2015)= 695700 km Mean density, g/cm^3 = 1.408
|
||||
Radius (photosphere) = 696500 km Angular diam at 1 AU = 1919.3"
|
||||
Photosphere temp., K = 6600 (bottom) Photosphere temp., K = 4400(top)
|
||||
Photospheric depth = ~500 km Chromospheric depth = ~2500 km
|
||||
Flatness, f = 0.00005 Adopted sid. rot. per.= 25.38 d
|
||||
Surface gravity = 274.0 m/s^2 Escape speed, km/s = 617.7
|
||||
Pole (RA,DEC), deg. = (286.13, 63.87) Obliquity to ecliptic = 7.25 deg.
|
||||
Solar constant (1 AU) = 1367.6 W/m^2 Luminosity, 10^24 J/s = 382.8
|
||||
Mass-energy conv rate = 4.260 x 10^9 kg/s Effective temp, K = 5772
|
||||
Sunspot cycle = 11.4 yr Cycle 24 sunspot min. = 2008 A.D.
|
||||
|
||||
Motion relative to nearby stars = apex : R.A.= 271 deg.; DEC.= +30 deg.
|
||||
speed: 19.4 km/s (0.0112 au/day)
|
||||
Motion relative to 2.73K BB/CBR = apex : l= 264.7 +- 0.8; b= 48.2 +- 0.5 deg.
|
||||
speed: 369 +-11 km/s
|
||||
*******************************************************************************
|
||||
|
||||
|
||||
*******************************************************************************
|
||||
Ephemeris / API_USER Wed Aug 13 04:05:18 2025 Pasadena, USA / Horizons
|
||||
*******************************************************************************
|
||||
Target body name: Sun (10) {source: DE441}
|
||||
Center body name: Sun (10) {source: DE441}
|
||||
Center-site name: BODY CENTER
|
||||
*******************************************************************************
|
||||
Start time : A.D. 2000-Jan-01 12:00:00.0000 TDB
|
||||
Stop time : A.D. 2000-Jan-01 12:01:00.0000 TDB
|
||||
Step-size : 1 minutes
|
||||
*******************************************************************************
|
||||
Center geodetic : 0.0, 0.0, 0.0 {E-lon(deg),Lat(deg),Alt(km)}
|
||||
Center cylindric: 0.0, 0.0, 0.0 {E-lon(deg),Dxy(km),Dz(km)}
|
||||
Center radii : 695700.0, 695700.0, 695700.0 km {Equator_a, b, pole_c}
|
||||
Output units : AU-D
|
||||
Calendar mode : Mixed Julian/Gregorian
|
||||
Output type : GEOMETRIC cartesian states
|
||||
Output format : 2 (position and velocity)
|
||||
Reference frame : Ecliptic of J2000.0
|
||||
*******************************************************************************
|
||||
JDTDB
|
||||
X Y Z
|
||||
VX VY VZ
|
||||
*******************************************************************************
|
||||
$$SOE
|
||||
2451545.000000000 = A.D. 2000-Jan-01 12:00:00.0000 TDB
|
||||
X = 0.000000000000000E+00 Y = 0.000000000000000E+00 Z = 0.000000000000000E+00
|
||||
VX= 0.000000000000000E+00 VY= 0.000000000000000E+00 VZ= 0.000000000000000E+00
|
||||
2451545.000694444 = A.D. 2000-Jan-01 12:01:00.0000 TDB
|
||||
X = 0.000000000000000E+00 Y = 0.000000000000000E+00 Z = 0.000000000000000E+00
|
||||
VX= 0.000000000000000E+00 VY= 0.000000000000000E+00 VZ= 0.000000000000000E+00
|
||||
$$EOE
|
||||
*******************************************************************************
|
||||
|
||||
TIME
|
||||
|
||||
Barycentric Dynamical Time ("TDB" or T_eph) output was requested. This
|
||||
continuous coordinate time is equivalent to the relativistic proper time
|
||||
of a clock at rest in a reference frame co-moving with the solar system
|
||||
barycenter but outside the system's gravity well. It is the independent
|
||||
variable in the solar system relativistic equations of motion.
|
||||
|
||||
TDB runs at a uniform rate of one SI second per second and is independent
|
||||
of irregularities in Earth's rotation.
|
||||
|
||||
CALENDAR SYSTEM
|
||||
|
||||
Mixed calendar mode was active such that calendar dates after AD 1582-Oct-15
|
||||
(if any) are in the modern Gregorian system. Dates prior to 1582-Oct-5 (if any)
|
||||
are in the Julian calendar system, which is automatically extended for dates
|
||||
prior to its adoption on 45-Jan-1 BC. The Julian calendar is useful for
|
||||
matching historical dates. The Gregorian calendar more accurately corresponds
|
||||
to the Earth's orbital motion and seasons. A "Gregorian-only" calendar mode is
|
||||
available if such physical events are the primary interest.
|
||||
|
||||
REFERENCE FRAME AND COORDINATES
|
||||
|
||||
Ecliptic at the standard reference epoch
|
||||
|
||||
Reference epoch: J2000.0
|
||||
X-Y plane: adopted Earth orbital plane at the reference epoch
|
||||
Note: IAU76 obliquity of 84381.448 arcseconds wrt ICRF X-Y plane
|
||||
X-axis : ICRF
|
||||
Z-axis : perpendicular to the X-Y plane in the directional (+ or -) sense
|
||||
of Earth's north pole at the reference epoch.
|
||||
|
||||
Symbol meaning [1 au= 149597870.700 km, 1 day= 86400.0 s]:
|
||||
|
||||
JDTDB Julian Day Number, Barycentric Dynamical Time
|
||||
X X-component of position vector (au)
|
||||
Y Y-component of position vector (au)
|
||||
Z Z-component of position vector (au)
|
||||
VX X-component of velocity vector (au/day)
|
||||
VY Y-component of velocity vector (au/day)
|
||||
VZ Z-component of velocity vector (au/day)
|
||||
|
||||
ABERRATIONS AND CORRECTIONS
|
||||
|
||||
Geometric state vectors have NO corrections or aberrations applied.
|
||||
|
||||
Computations by ...
|
||||
|
||||
Solar System Dynamics Group, Horizons On-Line Ephemeris System
|
||||
4800 Oak Grove Drive, Jet Propulsion Laboratory
|
||||
Pasadena, CA 91109 USA
|
||||
|
||||
General site: https://ssd.jpl.nasa.gov/
|
||||
Mailing list: https://ssd.jpl.nasa.gov/email_list.html
|
||||
System news : https://ssd.jpl.nasa.gov/horizons/news.html
|
||||
User Guide : https://ssd.jpl.nasa.gov/horizons/manual.html
|
||||
Connect : browser https://ssd.jpl.nasa.gov/horizons/app.html#/x
|
||||
API https://ssd-api.jpl.nasa.gov/doc/horizons.html
|
||||
command-line telnet ssd.jpl.nasa.gov 6775
|
||||
e-mail/batch https://ssd.jpl.nasa.gov/ftp/ssd/horizons_batch.txt
|
||||
scripts https://ssd.jpl.nasa.gov/ftp/ssd/SCRIPTS
|
||||
Author : Jon.D.Giorgini@jpl.nasa.gov
|
||||
*******************************************************************************
|
||||
174
plan.md
Normal file
174
plan.md
Normal file
@ -0,0 +1,174 @@
|
||||
Here’s a **design plan** for a Bevy-based Solar System sim with **all major planets + major moons** (Earth, Mars, Jupiter, Saturn), no asteroids, stable at **all time scales**, and using a **good fixed timestep** choice for the fastest orbits.
|
||||
|
||||
---
|
||||
|
||||
## **1. Simulation Scope**
|
||||
|
||||
**Bodies included**:
|
||||
|
||||
* **Planets**: Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, Neptune
|
||||
* **Moons**:
|
||||
|
||||
* Earth: Moon
|
||||
* Mars: Phobos, Deimos
|
||||
* Jupiter: Io, Europa, Ganymede, Callisto
|
||||
* Saturn: Titan, Rhea, Iapetus, Dione, Tethys, Enceladus, Mimas
|
||||
*(Total \~22 bodies)*
|
||||
|
||||
No asteroids, no small irregular moons — keeps N small enough for **exact N-body**.
|
||||
|
||||
---
|
||||
|
||||
## **2. Coordinate & Unit System**
|
||||
|
||||
**Units**:
|
||||
|
||||
* Distance: **AU**
|
||||
* Time: **days**
|
||||
* Mass: **solar masses**
|
||||
* Constant: **G = 2.9591220828559093e-4 AU³ / (M☉·day²)**
|
||||
|
||||
**Precision**:
|
||||
|
||||
* Simulation: `f64` for all positions/velocities.
|
||||
* Rendering: `f32` with **floating origin**.
|
||||
|
||||
**Reference frame**:
|
||||
|
||||
* Start in **barycentric J2000 ecliptic frame**.
|
||||
* Planets initialized with **orbital elements** from NASA/JPL Horizons.
|
||||
* Moons initialized **relative to parent planet**, then converted to barycentric coordinates.
|
||||
|
||||
---
|
||||
|
||||
## **3. Time Integration Strategy**
|
||||
|
||||
### **Base timestep choice**
|
||||
|
||||
Fastest orbital period in scope:
|
||||
|
||||
* **Mimas** (moon of Saturn) → \~0.942 days per orbit.
|
||||
To get ≥300 steps/orbit for stability:
|
||||
* `dt_base = 0.003 days` (\~4.32 minutes per step)
|
||||
|
||||
This works for:
|
||||
|
||||
* Mimas: \~314 steps/orbit
|
||||
* Mercury: \~29,323 steps/orbit
|
||||
* Outer planets: many more → extremely stable.
|
||||
|
||||
---
|
||||
|
||||
### **Decoupled simulation loop**
|
||||
|
||||
* Always integrate at `dt_base = 0.003 days`.
|
||||
* Convert **time scale** (days per real second) into **number of steps to take per frame**.
|
||||
* At slow speeds: possibly fewer than 1 step/frame (interpolate positions for rendering).
|
||||
* At high speeds: multiple steps/frame (batched substepping).
|
||||
|
||||
---
|
||||
|
||||
## **4. ECS Structure**
|
||||
|
||||
**Components**:
|
||||
|
||||
* `Body`: mass, visual radius, color, parent body index (if a moon)
|
||||
* `State`: current position & velocity in AU/day
|
||||
* `RenderProxy`: used for floating-origin transforms
|
||||
|
||||
**Resources**:
|
||||
|
||||
* `SimParams`: G constant, time scale, base dt, paused flag
|
||||
* `FloatingOrigin`: current origin in AU
|
||||
|
||||
---
|
||||
|
||||
## **5. Physics Pipeline (per frame)**
|
||||
|
||||
1. **Determine number of substeps**:
|
||||
|
||||
* `sim_days_to_advance = time_scale × real_delta_seconds`
|
||||
* `steps_needed = sim_days_to_advance / dt_base`
|
||||
* Loop substeps until all sim\_days\_to\_advance consumed.
|
||||
|
||||
2. **N-body force calculation**:
|
||||
|
||||
* O(N²) summation — still trivial for \~22 bodies.
|
||||
* Double precision for all math.
|
||||
|
||||
3. **Integrator**:
|
||||
|
||||
* Symplectic leapfrog (kick–drift–kick).
|
||||
* Fixed `dt_base` in all cases.
|
||||
|
||||
4. **Floating origin adjustment**:
|
||||
|
||||
* Choose tracked target (e.g., Earth or camera target).
|
||||
* Subtract target’s AU position from all bodies before converting to f32 for rendering.
|
||||
|
||||
---
|
||||
|
||||
## **6. Rendering Pipeline**
|
||||
|
||||
* **Distance compression**:
|
||||
|
||||
* Use a scale factor (e.g., `1 AU → 10,000 km visual`) so planets aren’t microscopic.
|
||||
* **Planet size exaggeration**:
|
||||
|
||||
* Apply large visual radius multiplier for visibility.
|
||||
* **Orbit trails**:
|
||||
|
||||
* Store sampled positions in a circular buffer for each body.
|
||||
* **Lighting**:
|
||||
|
||||
* One directional light from Sun position.
|
||||
|
||||
---
|
||||
|
||||
## **7. Time Controls**
|
||||
|
||||
* **Pause/Resume** (spacebar)
|
||||
* **Speed up / Slow down** (`[` / `]`) — adjust `time_scale`
|
||||
* **Preset speeds**:
|
||||
|
||||
* 1 min = 1 year
|
||||
* 1 sec = 1 day (slow motion)
|
||||
* 1 sec = 10 years (fast forward)
|
||||
* **Reverse time** (optional) — simply invert `time_scale`
|
||||
|
||||
---
|
||||
|
||||
## **8. Initialization Plan**
|
||||
|
||||
1. **Gather J2000 orbital elements** for all planets and moons (NASA/JPL Horizons).
|
||||
2. **For moons**:
|
||||
|
||||
* Convert orbital elements relative to parent into Cartesian coordinates (AU, AU/day).
|
||||
* Add parent planet’s barycentric position/velocity to get barycentric moon state.
|
||||
3. **Store** these as starting states in your ECS.
|
||||
|
||||
---
|
||||
|
||||
## **9. Performance Considerations**
|
||||
|
||||
* N=22 bodies → no optimization needed beyond O(N²) CPU.
|
||||
* At fastest speed (e.g., 1 sec = 1000 years):
|
||||
|
||||
* Steps per second = `(1000 × 365.25 days) / 0.003 days` ≈ 121,750 steps/sec
|
||||
* Must batch steps in a loop inside one Bevy system per frame.
|
||||
* Limit display FPS to avoid CPU overload (physics can run faster than rendering).
|
||||
|
||||
---
|
||||
|
||||
## **10. Validation & Testing**
|
||||
|
||||
* **Check orbital periods**:
|
||||
|
||||
* Measure period for Mercury, Earth, Moon, Mimas.
|
||||
* **Energy drift check**:
|
||||
|
||||
* Track total system energy & angular momentum over 1,000 years of sim time.
|
||||
* **Visual comparison**:
|
||||
|
||||
* Compare planet positions to JPL Horizons output for 10-year window to confirm accuracy.
|
||||
|
||||
2
rust-toolchain.toml
Normal file
2
rust-toolchain.toml
Normal file
@ -0,0 +1,2 @@
|
||||
[toolchain]
|
||||
channel = "nightly"
|
||||
91
src/main.rs
Normal file
91
src/main.rs
Normal file
@ -0,0 +1,91 @@
|
||||
use bevy::{math::DVec3, prelude::*};
|
||||
|
||||
#[derive(Component)]
|
||||
struct PositionAu(DVec3);
|
||||
|
||||
#[derive(Component)]
|
||||
struct VelocityAuPerDay(DVec3);
|
||||
|
||||
#[derive(Component)]
|
||||
struct MassKg(f64);
|
||||
|
||||
#[derive(Component)]
|
||||
struct RadiusKm(f64);
|
||||
|
||||
#[derive(Component)]
|
||||
struct Name(String);
|
||||
|
||||
#[derive(Bundle)]
|
||||
struct ObjectBundle {
|
||||
name: Name,
|
||||
position: PositionAu,
|
||||
mass: MassKg,
|
||||
radius: RadiusKm,
|
||||
velocity: VelocityAuPerDay,
|
||||
}
|
||||
|
||||
pub struct SolarRenderingPlugin;
|
||||
|
||||
impl Plugin for SolarRenderingPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
// Rendering systems will be added here
|
||||
}
|
||||
}
|
||||
|
||||
fn setup_solar_system(mut commands: Commands) {
|
||||
// Sun - From NASA JPL Horizons data (J2000.0 epoch)
|
||||
// Physical properties: Mass = 1988410 x 10^24 kg, Radius = 695700 km
|
||||
commands.spawn(ObjectBundle {
|
||||
name: Name("Sun".to_string()),
|
||||
position: PositionAu(DVec3::new(0.0, 0.0, 0.0)), // At barycenter
|
||||
velocity: VelocityAuPerDay(DVec3::new(0.0, 0.0, 0.0)), // Stationary relative to barycenter
|
||||
mass: MassKg(1.988410e30), // Solar mass in kg
|
||||
radius: RadiusKm(695700.0), // Solar radius in km
|
||||
});
|
||||
|
||||
// Earth - From NASA JPL Horizons data (A.D. 2000-Jan-01 12:00:00.0000 TDB)
|
||||
// Position and velocity vectors in ecliptic J2000.0 frame relative to Sun
|
||||
// Mass = 5.97219 x 10^24 kg, Mean radius = 6371.01 km
|
||||
commands.spawn(ObjectBundle {
|
||||
name: Name("Earth".to_string()),
|
||||
position: PositionAu(DVec3::new(
|
||||
-1.771350992727098e-1, // X = -0.177135 AU
|
||||
9.672416867665306e-1, // Y = 0.967242 AU
|
||||
-4.085281582511366e-6, // Z = -4.085e-6 AU
|
||||
)),
|
||||
velocity: VelocityAuPerDay(DVec3::new(
|
||||
-1.720762506872895e-2, // VX = -0.0172076 AU/day
|
||||
-3.158782144324866e-3, // VY = -0.00315878 AU/day
|
||||
1.049888594613343e-7, // VZ = 1.04989e-7 AU/day
|
||||
)),
|
||||
mass: MassKg(5.97219e24), // Earth mass in kg
|
||||
radius: RadiusKm(6371.01), // Mean radius in km
|
||||
});
|
||||
|
||||
// Moon - From NASA JPL Horizons data (A.D. 2000-Jan-01 12:00:00.0000 TDB)
|
||||
// Position and velocity vectors in ecliptic J2000.0 frame relative to Sun
|
||||
// Mass = 7.349 x 10^22 kg, Mean radius = 1737.53 km
|
||||
commands.spawn(ObjectBundle {
|
||||
name: Name("Moon".to_string()),
|
||||
position: PositionAu(DVec3::new(
|
||||
-1.790843809223965e-1, // X = -0.179084 AU
|
||||
9.654035607264573e-1, // Y = 0.965404 AU
|
||||
2.383726922995396e-4, // Z = 0.000238373 AU
|
||||
)),
|
||||
velocity: VelocityAuPerDay(DVec3::new(
|
||||
-1.683595459141215e-2, // VX = -0.0168360 AU/day
|
||||
-3.580960720855671e-3, // VY = -0.00358096 AU/day
|
||||
-6.540550604528720e-6, // VZ = -6.54055e-6 AU/day
|
||||
)),
|
||||
mass: MassKg(7.349e22), // Moon mass in kg
|
||||
radius: RadiusKm(1737.53), // Mean radius in km
|
||||
});
|
||||
}
|
||||
|
||||
fn main() {
|
||||
App::new()
|
||||
.add_plugins(DefaultPlugins)
|
||||
.add_plugins(SolarRenderingPlugin)
|
||||
.add_systems(Startup, setup_solar_system)
|
||||
.run();
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user