phyz-gravity 0.1.0

Layered gravity solver from constant-g to post-Newtonian corrections for phyz
Documentation
  • Coverage
  • 100%
    64 out of 64 items documented2 out of 32 items with examples
  • Size
  • Source code size: 49.15 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 4.45 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 54s Average build duration of successful builds.
  • all releases: 54s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • ecto/phyz
    19 3 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • ecto

Layered gravity solver from constant g to post-Newtonian corrections.

Implements 5 gravity layers:

  1. Constant gravity (uniform g)
  2. Poisson solver (local density fields)
  3. N-body with Barnes-Hut tree (O(N log N) far-field)
  4. Post-Newtonian corrections (1PN + 2.5PN)
  5. Numerical GR (BSSN, future work)

Example

use phyz_gravity::{GravityParticle, PostNewtonianSolver, GravitySolver};
use phyz_math::Vec3;

// Solar system: Mercury perihelion precession
let m_sun = 1.989e30;  // kg
let m_mercury = 3.285e23;

let mut particles = vec![
    GravityParticle::new(Vec3::zeros(), Vec3::zeros(), m_sun),
    GravityParticle::new(
        Vec3::new(57.9e9, 0.0, 0.0),  // 57.9M km
        Vec3::new(0.0, 47.4e3, 0.0),  // 47.4 km/s
        m_mercury,
    ),
];

let mut solver = PostNewtonianSolver::new(2.5); // 2.5PN order
solver.compute_forces(&mut particles);