test_polyhedralGravityModel
Validate polyhedral gravity normalization, initialization, and energy.
A closed C-shaped body contains fourteen equal cubes. Its signed volume is 14 km^3, whereas summing the absolute tetrahedral volumes gives 18 km^3. Acceleration and potential are checked against the superposition of separate cube models and their point-mass limits. Stored Eros results check compatibility with a mesh whose tetrahedral contributions are all positive (issue 1681). Potential gradients, inertial-frame evaluations, and spacecraft energy checks cover the sign and reference-frame corrections in issue 1689.
- test_polyhedralGravityModel.c_shape()[source]
Return an initialized C-shaped body and its constituent cube centers.
- test_polyhedralGravityModel.test_acceleration_is_negative_potential_gradient(c_shape, position)[source]
Check the energy sign independently of another polyhedral potential call.
- Parameters:
c_shape – Initialized concave model and its cube centers.
position – Exterior evaluation point in body-fixed coordinates [m].
- test_polyhedralGravityModel.test_base_potential_api_preserves_position_keyword(c_shape)[source]
Preserve base-class positional and keyword calls for a polyhedral model.
- Parameters:
c_shape – Initialized concave model and its cube centers.
- test_polyhedralGravityModel.test_concave_body_far_field(c_shape, direction)[source]
Check the vector acceleration and potential against the point-mass limits.
- Parameters:
c_shape – Initialized C-shaped model and its cube centers.
direction – Dimensionless direction of the evaluation point.
- test_polyhedralGravityModel.test_concave_body_matches_cube_superposition(c_shape, position)[source]
Check acceleration and potential against fourteen correctly normalized cubes.
The second evaluation point lies in the opening of the C-shaped body.
- Parameters:
c_shape – Initialized C-shaped model and its cube centers.
position – Evaluation point in meters relative to the center of mass.
- test_polyhedralGravityModel.test_eros_field_and_potential_magnitude_are_unchanged()[source]
Preserve the Eros field and potential magnitude while correcting its sign.
- test_polyhedralGravityModel.test_inertial_potential_uses_requested_orientation(c_shape, orientation, offset)[source]
Use the message epoch and identity fallback independently of cached field properties.
- Parameters:
c_shape – Initialized concave model and its cube centers.
orientation – Rotating message, zero DCM, or unlinked message.
offset – Signed evaluation offset from the message epoch [s].
- test_polyhedralGravityModel.test_initialization_retry_matches_fresh_model(invalid_volume, through_body, previously_initialized)[source]
Recover from a rejected mesh without retaining facet or edge dyads.
After rejection, replace the mesh with a valid cube and compare acceleration and potential against a fresh model. An optional earlier successful initialization also populates the edge cache, which a rejected mesh does not rebuild. Cyclically permuting the earlier vertices changes the cached dyads associated with each index while preserving a valid, outward-oriented cube.
- Parameters:
invalid_volume – Rejected mesh configuration.
through_body – Whether all initialization attempts use
GravBodyData.previously_initialized – Whether to initialize a valid mesh before rejection.
- test_polyhedralGravityModel.test_invalid_volume_is_rejected(invalid_volume, through_body)[source]
Reject invalid volume directly and through the body initialization error path.
- Parameters:
invalid_volume – Mesh modification producing a non-positive or non-finite volume.
through_body – Whether to initialize through
GravBodyData.
- test_polyhedralGravityModel.test_polyhedral_energy_or_jacobi_is_conserved(spin_rate)[source]
Conserve energy for a static body and the Jacobi integral for uniform rotation.
- Parameters:
spin_rate – Constant planet rotation rate [rad/s].
- test_polyhedralGravityModel.test_reported_energy_uses_body_frame_and_output_epoch(model_kind, frame, integrator_name)[source]
Check energy at the output epoch for moving, rotating gravity bodies.
RKF45 evaluates its last stage before the step endpoint. Energy must use the output time for both planet translation and orientation, rather than that stage. The secondary-body case exercises both existing potential contribution terms.
- Parameters:
model_kind – Gravity model whose energy contribution is checked.
frame – Integration origin and role of the tested body.
integrator_name – Fixed-step or adaptive integrator.