模拟圆周运动/切向加速度

时间:2020-12-31 07:06:54

标签: physics

以下伪代码适用于线性加速度建模(对每个时间刻度应用 calculateNextStepdoNextStep):

class myObject{

    vector positionVector
    vector velocityVector
    vector accelerationVector
    vector forceVector

    function calculateNextStep(){
        resetForceVector()
        calculateNetForces()
    }

    function doNextStep(){
        accelerationVector = forceVector.getCopy()
        accelerationVector.divideBy(mass)
        velocityVector.add(accelerationVector)
        positionVector.add(velocityVector)
    }
}

我的理解是,对于圆周运动,我们需要施加一个与物体速度正交的力。该力的大小将决定圆的半径:

    function calculateNextStep() {
        resetForceVector()
        orthogonalForce = velocityVector.getCopy.getOrthogonalVector()
        orthogonalForce.setLength(sizeOfForce)
    }

当我应用这种方法时,对象不会沿圆形路径行进。相反,它向外盘旋,速度增加。

我认为这是因为切向力仅瞬时作用,即。一旦物体移动,切向力就会相应地改变,但我不知道如何在我的模型中解释这一点。

我认为之前已经解决了这个问题,但找不到任何东西。是否有我应该应用的修正术语?与极限/积分有关吗?

2 个答案:

答案 0 :(得分:0)

你的假设是对的。问题在于切向力。

但是您计算切向力的方式存在两个问题:

  1. 你提到的,力应该立即施加。
  2. 计算力的方式、旋转中心在整个模拟过程中都会发生变化。

这两个都可以通过减少时间步长和增加迭代次数来解决,但这些都是硬件限制,所以你最终会触底。

解决这些问题的更好方法是使用不同的模型:

使用保守力(例如重力、静电力、连接物体和中心的绳索的力……)允许系统在它开始螺旋时自行纠正(如果物体离开所需的半径,保守势力将确保它回来)。

这是重力的示例实现:

orthogonalVector = centerPoint - positionVector;
float value = orthogonalVector.value();
float scalar = gravityConstant*centerMass/pow(value, 3);
accelerationVector = scalar*orthogonalVector;

答案 1 :(得分:0)

这个问题是基于尝试将线性力学应用于角力学问题!

圆周运动只发生在力与运动正交且运动方向是转动的情况下!

我通过向模型添加角速度来解决这个问题

class myObject{

    vector positionVector
    vector velocityVector
    vector accelerationVector
    vector forceVector
    scalar mass

    scalar torque
    scalar angularAccelleration
    scalar angularVelocity
    scalar orientation
    scalar rotationalInertia

    function calculateNextStep(){
        resetForceVector()
        angularAccelleration = 0
        calculateNetForces()

    }

    function doNextStep(){
        accelerationVector = forceVector.getCopy()
        accelerationVector.divideBy(mass)
        velocityVector.add(accelerationVector)
        positionVector.add(velocityVector)

        angularAcceleration = torque / rotationalInertia
        angularVelocity += angularAccelleration
        orientation += angularVelocity

    }
}
相关问题