Gravity – Basic Gravity¶
-
class
trep.potentials.Gravity(system[, gravity=(0.0, 0.0, -9.8), name=None])¶ (Inherits from
Potential)Parameters: - system (
System) – An instance ofSystemto add the gravity to. - gravity (Sequence of three
Float) – The gravity vector - name – A string that uniquely identifies the gravity.
Gravityimplements a basic constant acceleration gravity (\(F = m\vec{g}\)).Implemented Calculations¶ Calculation Implemented V Y V_dq Y V_dqdq Y V_dqdqdq Y - system (
Examples¶
Adding gravity to a system is as easy as declaring an instance of
Gravity:
>>> system = build_custom_system()
>>> trep.potentials.Gravity(system)
<Gravity 0.000000 0.000000 -9.800000>
The System saves a reference to the new Gravity, so
we do not have to save a refence to prevent it from being garbage
collected.
The default gravity points in the negative Z direction. We can specify a new gravity vector when we add the gravity. For example, we can make gravity point in the positive Y direction:
>>> system = build_custom_system()
>>> trep.potentials.Gravity(system, (0, 9.8, 0))
<Gravity 0.000000 9.800000 0.000000>