Body is a common representation of RigidBody or a Particle.
A Body represents either a rigid body or particle in classical mechanics. Bodies have a body-fixed reference frame, a mass, a mass center and possibly a body-fixed inertia.
Parameters : | name: String
masscenter : Point, optional
frame : ReferenceFrame (optional)
mass : Sympifyable, optional
body_inertia : Dyadic
|
---|
Examples
Default behaviour. It creates a RigidBody after defining mass, mass center, frame and inertia.
>>> from sympy.physics.mechanics import Body
>>> body = Body('name_of_body')
Passing attributes of Rigidbody. All the arguments needed to create a RigidBody can be passed while creating a Body too.
>>> from sympy import Symbol
>>> from sympy.physics.mechanics import ReferenceFrame, Point, inertia
>>> from sympy.physics.mechanics import Body
>>> mass = Symbol('mass')
>>> masscenter = Point('masscenter')
>>> frame = ReferenceFrame('frame')
>>> ixx = Symbol('ixx')
>>> body_inertia = inertia(frame, ixx, 0, 0)
>>> body = Body('name_of_body',masscenter,mass,frame,body_inertia)
Creating a Particle. If masscenter and mass are passed, and inertia is not then a Particle is created.
>>> from sympy import Symbol
>>> from sympy.physics.vector import Point
>>> from sympy.physics.mechanics import Body
>>> mass = Symbol('mass')
>>> masscenter = Point('masscenter')
>>> body = Body('name_of_body',masscenter,mass)
Similarly, A frame can also be passed while creating a Particle.
Adds the force to the point (center of mass by default) on the body.
Parameters : | vec: Vector
point: Point, optional
|
---|
Example
To apply a unit force in x direction of body’s frame to body’s center of mass.
>>> from sympy import Symbol
>>> from sympy.physics.mechanics import Body
>>> body = Body('body')
>>> g = Symbol('g')
>>> body.apply_force(body.mass * g * body.frame.x)
To apply force to any other point than center of mass, pass that point as well.
>>> from sympy import Symbol
>>> from sympy.physics.mechanics import Body
>>> parent = Body('parent')
>>> child = Body('child')
>>> g = Symbol('g')
>>> frame = parent.frame
>>> l = Symbol('l')
>>> point = child.masscenter.locatenew('force_point', l * body.frame.y)
>>> gravity = child.mass * g
>>> body.apply_force(gravity * body.frame.x, point)