Time-step independent friction model

In summary, Integral's code calculates the movement vector without friction, but it is not time step independent.
  • #1
TK
5
0
Help with Friction

Greetings , all fellow scientists!




I've been struggling with time-step independent physics for a programming project. The problem is that it doesn't seem to be time-step independent after all. Here's some of it in a pseudo-code form. It seems to be the friction part where it goes wrong. The reason I'm calculating friction like that anyway is because this way has a nice property of limiting the speed. ( Should implement surface friction and drag separately for better simulation though. ) The following gets executed at varying intervals. Hope the variable names are self-explanatory.
Code:
``calc acc vector without friction
acc_x = time_step * ( move_force_x / mass )
acc_y = time_step * ( move_force_y / mass )
acc_z = time_step * ( move_force_z / mass )

``calc movement vector without friction
move_x = time_step * ( speed_x + ( acc_x / 2 ) )
move_y = time_step * ( speed_y + ( acc_y / 2 ) )
move_z = time_step * ( speed_z + ( acc_z / 2 ) )

``calc and apply friction
move_force_x = move_force_x - ( move_x * friction_coefficient )
move_force_y = move_force_y - ( move_y * friction_coefficient )
move_force_z = move_force_z - ( move_z * friction_coefficient )


``calc acc vector
acc_x = time_step * ( move_force_x / mass )
acc_y = time_step * ( move_force_y / mass )
acc_z = time_step * ( move_force_z / mass )

``calc movement vector
move_x = time_step * ( speed_x + ( acc_x / 2 ) )
move_y = time_step * ( speed_y + ( acc_y / 2 ) )
move_z = time_step * ( speed_z + ( acc_z / 2 ) )

``calc new speed
speed_x = speed_x + acc_x
speed_y = speed_y + acc_y
speed_z = speed_z + acc_z

``calc new pos
pos_x = pos_x + move_x
pos_y = pos_y + move_y
pos_z = pos_z + move_z

And now in a shorter form joining the coordinates to vector-type variables. Could have only posted that one but then the variable names would have been less self-explanatory.
Code:
``calc acc vector without friction
V_acc = time_step * ( V_move_force / mass )

``calc movement vector without friction
V_move = time_step * ( V_speed + ( V_acc / 2 ) )

``calc and apply friction
V_move_force = V_move_force - ( V_move * friction_coefficient )


``calc acc vector
V_acc = time_step * ( V_move_force / mass )

``calc movement vector
V_move = time_step * ( V_speed + ( V_acc / 2 ) )

``calc new speed
V_speed = V_speed + V_acc

``calc new pos
V_pos = V_pos + V_move

Maybe it's more like a mathematical question but anyway it is wrong to separate those sciences. The physics are not complex here and that's why I thought it'd do with lesser explanation on what it is supposed to do and so on. In case the above is how it should be after all I'll take a look at the part where it calculates the time-step in the 1st place.
Thanks in advance!




All the best!


TK
 
Last edited:
Physics news on Phys.org
  • #2
I do not see any way that your calculations can be time step independent, please provide more information about what you mean.

move_x = time_step * ( speed_x + ( acc_x / 2 ) )

This will not give you the correct position. You are adding a velocity to an acceleration, you need to do this:

[tex] move_x = time_{step} * (speed_x + (time_{step} * \frac {acc_x} 2)) [/tex]

to get a distance.
 
  • #3
Hiya , Integral!


Thank You for a really fast reply! Thought I'd have to wait atleast until tomorrow morning.
Anyway , it should be a nice , little optimization. Follow the flow of the code...
Code:
``calc acc vector without friction
V_acc = time_step * ( V_move_force / mass )

``calc movement vector without friction
V_move = time_step * ( V_speed + ( V_acc / 2 ) )
...acceleration is premultiplied with time-step. Should of have made it clearer though and perhaps named the variable differently.
 
Last edited:
  • #4
Had a mistype( typo ) there...
``calc and apply friction
move_force_X = move_force_x - ( move_x * friction_coefficient )
move_force_X = move_force_y - ( move_y * friction_coefficient )
move_force_X = move_force_z - ( move_z * friction_coefficient )
This is not the case with the real thing though.
So , has anyone got any ideas? Thank You!
 
  • #5
Has anyone got any ideas?
 

1. What is a "Time-step independent friction model"?

A time-step independent friction model is a mathematical model used to simulate the behavior of friction between two surfaces over a range of time scales. It takes into account the properties of the materials, the contact geometry, and the applied forces to predict the frictional behavior without being dependent on the time-step used in the simulation.

2. How is a time-step independent friction model different from traditional friction models?

Traditional friction models usually require a small time-step to accurately capture the dynamic behavior of friction. However, a time-step independent friction model can accurately predict the frictional behavior even with larger time-steps, making it more efficient and practical for real-world applications.

3. What are the advantages of using a time-step independent friction model?

One of the main advantages of using a time-step independent friction model is its ability to accurately predict frictional behavior over a wide range of time scales. It also reduces the computational cost and allows for larger time-steps, making it more efficient for simulations. Additionally, it can handle complex contact geometries and material properties.

4. What factors are considered in a time-step independent friction model?

A time-step independent friction model takes into account the physical properties of the materials in contact, such as surface roughness and material stiffness. It also considers the geometry of the contact, including the shape and size of the surfaces. The applied forces and their direction are also important factors in the model.

5. In what industries or fields is a time-step independent friction model commonly used?

A time-step independent friction model is commonly used in industries and fields that involve the study of friction, such as mechanical engineering, material science, and tribology. It is also useful in simulations of complex systems, such as earthquake dynamics, where accurate prediction of frictional behavior is crucial.

Similar threads

  • Introductory Physics Homework Help
Replies
6
Views
221
  • Mechanics
Replies
20
Views
908
Replies
4
Views
1K
  • Introductory Physics Homework Help
Replies
3
Views
4K
Replies
17
Views
3K
  • Programming and Computer Science
Replies
13
Views
5K
  • Introductory Physics Homework Help
Replies
1
Views
1K
  • Introductory Physics Homework Help
Replies
1
Views
1K
  • Introductory Physics Homework Help
Replies
18
Views
2K
  • Introductory Physics Homework Help
Replies
11
Views
2K
Back
Top