English 中文(简体)
Verlet integrator + friction
原标题:Verlet integrator + friction
最佳回答

仅对与动议相反的方向相向的移动物体实行小规模、持续的加速。 并确保它实际上能够做到reverse。 该动议;如果你发现,在一体化步骤中,速度刚刚达到零。

如果你想更现实,加速应来自与物体和表面之间正常力量成正比的一支部队。

您可以在任何基本物理文本中将此视为“动力摩擦”或“滑动摩擦”。

问题回答

At the verlet integration: r(t)=2.00*r(t-dt)-1.00*r(t-2dt)+2at² change the multipliers to 1.99 and 0.99 for friction

Edit:这更加真实:

(t)=(2.0-friction_mult.)*r(t-dt)-(1.00-friction_mult.)*r(t-2dt)+at2

这里是一个简单的时速计划(由人工解决的LCP的幻灯电子器法),用于一个带有孔波摩摩摩擦的盒子和一个春天(<>摩擦除器)。

mq + kq + mu*sgn(q) = F(t)

import numpy as np
import matplotlib.pyplot as plt

q0 = 0   # initial position
p0 = 0  # initial momentum
t_start = 0   # initial time
t_end = 10   # end time
N = 500 # time points
m = 1   # mass
k = 1   # spring stiffness

muN = 0.5   # friction force (slip and maximal stick)
omega = 1.5   # forcing radian frequency [RAD]
Fstat = 0.1   # static component of external force
Fdyn = 0.6   # amplitude of harmonic external force
F = lambda tt,qq,pp: Fstat + Fdyn*np.sin(omega*tt) - k*qq - muN*np.sign(pp)  # total force, note sign(0)=0 used to disable friction
zero_to_disable_friction = 0

omega0 = np.sqrt(k/m)
print("eigenfrequency   f = {} Hz;   eigen period   T = {} s".format(omega0/(2*np.pi), 2*np.pi/omega0))
print("forcing frequency   f = {} Hz;   forcing period   T = {} s".format(omega/(2*np.pi), 2*np.pi/omega))

time = np.linspace(t_start, t_end, N)   # time grid
h = time[1] - time[0]   # time step
q = np.zeros(N+1)   # position
p = np.zeros(N+1)   # momentum
absFfriction = np.zeros(N+1)

q[0] = q0   
p[0] = p0
for n, tn in enumerate(time):
   
    p1slide = p[n] + h*F(tn, q[n], p[n])   # end-time momentum, assuming sliding
    q1slide = q[n] + h*p1slide/m   # end-time position, assuming sliding
    
    if p[n]*p1slide > 0:   # sliding goes on
        q[n+1] = q1slide
        p[n+1] = p1slide
        absFfriction[n] = muN
        
    else:
        q1stick = q[n]   # assume p1 = 0 at t=tn+h
        Fstick = -p[n]/h - F(tn, q1stick, zero_to_disable_friction)    # friction force needed to stop at t=tn+h
        if np.abs(Fstick) <= muN:
            p[n+1] = 0   # sticking
            q[n+1] = q1stick
            absFfriction[n] = np.abs(Fstick)
        else:  # sliding starts or passes zero crossing of velocity
            q[n+1] = q1slide   # possible refinements (adapt to slip-start or zero crossing)
            p[n+1] = p1slide
            absFfriction[n] = muN




相关问题
Class or Metaclass Design for Astrodynamics Engine

Gurus out there: The differential equations for modeling spacecraft motion can be described in terms of a collection of acceleration terms: d2r/dt2 = a0 + a1 + a2 + ... + an Normally a0 is the ...

ePic - what’s the relations with physics?

What is the relation with Physics and techniques ? I am interested in learning the algorithms followed in this 3d photo viewer ePic. Any other known physics engine ?

Collision Detection between Accelerating Spheres

I am writing a physics engine/simulator which incorporates 3D space flight, planetary/stellar gravitation, ship thrust and relativistic effects. So far, it is going very well, however, one thing that ...

Triangle - Triangle Intersection Test

I d like to know if there is out there some tutorial or guide to understand and implement a Triangle-Triangle intersection test in a 3D Environment. (i don t need to know precise where the ...

Farseer Physics XNA Geom Tripping

I have an issue similar to http://farseerphysics.codeplex.com/Thread/View.aspx?ThreadId=72364 I have a rectangle player geom, and many rectangle tile geoms lined up next to each other. Occasionally ...

Falling object in Box2D should rotate due to centre of mass?

I m trying to simulate a falling balloon in Box2DAS3. What is important is that balloon falls the such that the bottom part were you blow it up rotates towards the bottom if it s knock sideways or is ...

iPhone fluid simulation

Somebody know fluid engine for iphone?I need water and gases simulation.

热门标签