Skip to content

Get force and torque applied to rigid body by fluid #269

@MillyaPC

Description

@MillyaPC

Hi there,
I would like to get force and torque applied to rigid body by fluid.
Thus I call method "GetForceAndTorque" in scene file "\pySPlisHSPlasH\examples\animated_body.py" as following:

def time_step_callback(): sim = sph.Simulation.getCurrent() boundary = sim.getBoundaryModel(1) animatedBody = boundary.getRigidBodyObject() animatedBody.setAngularVelocity([0, 60.0/180.0*math.pi, 0]) animatedBody.animate() # calculate force and torque of fluid to rigid body? f = np.ndarray([3, 1]) t = np.ndarray([3, 1]) boundary.getForceAndTorque(f, t) print("Force: ", f[0], " ", f[1], " ", f[2]) print("Torque: ", t[0], " ", t[1], " ", t[2])

However, I get the values that remain the same as:
image
which I supposed to be related to fluids.

I wondering whether I call "GetForceAndTorque()" correctly?
Otherwise, how can I get force and torque applied to rigid body by fluid?
Thanks!

——————————————————————————————————————————————————————
Latest:

I have found forces and torques applied to dynamic rigid bodies however, calculating them for an animated rigid body remains an issue.
Rigid bodies with tag "isAnimated = True" seem to contradict calculating force and torque?
Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions