模拟围绕稳态点的摩擦

计算科学 Python 计算物理学 模拟
2021-12-24 01:35:04

在模拟摩擦动力系统时,我在接近稳态时遇到了问题。

在下面的示例中,一个盒子沿具有特定摩擦系数的表面移动:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import numpy as np
import matplotlib.pyplot as plt

G = 9.8
MU = 0.3

TIME_STEP = [0.1, 0.01, 0.001]
SIM_TIME = 10 # s

fig, ax = plt.subplots()

for time_step in TIME_STEP:
    t = np.linspace(0, SIM_TIME, int(SIM_TIME/time_step))
    speed = 10 # m/s
    s = []    

    for i in t:
        speed += -np.sign(speed)*G*MU*time_step
        s.append(speed)

    ax.plot(t, s, label = "Time step {:1.3f} s".format(time_step))

ax.set_xlabel('Time (s)')
ax.set_ylabel('Speed (m/s)')
ax.legend(loc='upper right')

由于摩擦仅取决于速度单位矢量,因此系统围绕稳态点振荡而不是收敛到 0。振荡取决于模拟的 time_step,但它始终存在。

仿真图1 仿真图二

难点在于,在实际系统中,稳态点是未知的,因此在穿越稳态点时使速度为零等方法是不适用的。

有没有办法对此进行编码以避免那些稳态振荡,并且不会失去物理完整性?

编辑

给定系统的方程为:

v0=10

v˙=v|v|gμ

0个回答
没有发现任何回复~