Simulating Dynamics - 1

Difficulty: Moderately hard. Learn about force computation simulation before attempting this.

The simulating dynamics series is original.

Consider a spring block system as I have drawn below:

The block of mass 5 5 kg is connected to a spring which is hinged at the ceiling. The spring constant is k = 20 k = 20 N / m N/m , the natural length is l 0 = 1 l_0 = 1 meter, and the height between the ceiling and the floor is 1 meter.

The block is initially released 10 10 meters from x = 0 x = 0 , shown by the dotted line above. There is gravitational acceleration in the y -y -direction, g = 10 m / s 2 \displaystyle g = 10m/s^2

There is a coefficient of friction μ = 0.7 \mu = 0.7 , with the opposing force in the x x direction (opposing the direction of the velocity) being μ N \mu N , N N being normal force to the ground.

Find the position of the block x x at t = 5 t = 5 seconds.

Note: the object always slides along the ground.

The best way to do this problem is through computer simulation, once again. The forces interacting are too hard to compute analytically.


The answer is 0.674.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

2 solutions

Krishna Karthik
May 28, 2020

My solution is completely numerical, like Steven Chase's. One cannot solve this problem without implementing a numerical solution. The forces involved are too complicated and ever-changing, so it's very hard to do analytically.

My method was to compute the acceleration at each point in time by running a series of force computations. For those who don't understand the theory behind the computer simulation, the forces of the system include gravitational force, spring force, and the frictional force.


The spring force is given by the stretch of the spring and the spring constant:

F s p r i n g = k ( 1 + x 2 1 ) \displaystyle |\vec{\bold{F}}_{spring}| = k( \sqrt{1+x^2}-1)

The horizontal and vertical components can be given by multiplying by cos ( θ ) = x 1 + x 2 \displaystyle \cos(\theta) = \frac{x}{\sqrt{1+x^2}} , sin ( θ ) = 1 1 + x 2 \displaystyle \sin(\theta) = \frac{1}{\sqrt{1+x^2}}

The opposing force to the upward spring force is gravitational force, given by m g mg .

Now, we need to consider the normal force to the floor, which is the resultant force in the y y -axis, given by:

F y = F s p r i n g F g = k ( 1 + x 2 1 ) 1 + x 2 m g \displaystyle \bold{F}_y = \bold{F}_{spring} - \bold{F}_{g} = \frac{k( \sqrt{1+x^2}-1) }{\sqrt{1+x^2}} - mg (normal force)

Finally, we can formulate an equation that gives us the force in the x a x i s x-axis :

F x = F s p r i n g x 1 + x 2 μ F y \displaystyle \bold{F}_x = \frac{|\vec{\bold{F}}_{spring}|x}{\sqrt{1+x^2}} - \mu \bold{F}_y

With this clear in the mind, we can program these forces and compute the total force along the x x -axis, thereby determining the acceleration. We can then numerically integrate the acceleration to find the distance travelled given a small time-step. That's the logic behind the computer program.


Graphs produced with matlab:


Here's the python code (using Explicit Euler instead due to slow speed with RK 4):

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
time = 0;
deltaT = 10^-4; %timestep


x = 10; %initial displacement
xDot = 0; %initial velocity


xValues = [];
timeValues = [];

%constants

k = 20;
m = 5;
g = 10;
mu = 0.7;
initialTotalEnergy = (k*(hypot(1,x)-1)^2)/2;

kineticEnergies = []; 
potentialEnergies = [];
dissipatedEnergies = [];

while time <= 5 %evolve till time = 5
  xValues = [xValues; x];
  timeValues = [timeValues; time];

  %Energy variables:  

  Kinetic = (m*xDot^2)/2;
  Potential = (k*(hypot(1,x)-1)^2)/2;
  totalEnergy = Kinetic + Potential;
  dissipatedEnergy = initialTotalEnergy - totalEnergy;

  kineticEnergies = [kineticEnergies; Kinetic];
  potentialEnergies = [potentialEnergies; Potential];
  dissipatedEnergies = [dissipatedEnergies; dissipatedEnergy];



  %spring force magnitude
  springForce = k*(hypot(1,x)-1);

  %spring force components
  Fsx = -springForce*x/(hypot(1,x));
  Fsy = springForce/(hypot(1,x));


  %gravitational force 
  gravityForceY = -m*g;


  %total forces in y = spring + gravity
  totalForceY = Fsy + gravityForceY;



  %frictional force = mu*N
  if xDot < 0 %negative or positive dependent on direction of velocity
    frictionForceX = -mu*totalForceY;
  else
    frictionForceX = mu*totalForceY;
  end


  %total force in x = spring force x + friction
  totalForceX = Fsx + frictionForceX;


  %Explicit Euler numerical integration
  xDotDot = totalForceX/m;
  xDot = xDot + xDotDot*deltaT;
  x = x + xDot*deltaT;

  %update time value
  time = time + deltaT;
end

plot(timeValues, xValues  );

Okay, so what I think is this. The answer to this problem is incorrect. This is because the friction force causes the block to lose kinetic energy. So once the block comes to rest it stays there till the 5 seconds elapse. The correct answer should be 7.1 -7.1 . See your plot.

Karan Chatrath - 1 year ago

@Steven Chase I would like to know your thoughts on this. Once the block comes to rest for the first time, it has dissipated all of its kinetic energy as heat and there exists no other driving force to propel it back into motion. The block finds its equilibrium at that instant.

Karan Chatrath - 1 year ago

Log in to reply

Steven got the same answer as me. And he's a much better physicist than me. I think he can provide better insight into your question than me.

Krishna Karthik - 1 year ago

Log in to reply

In hindsight, what I said is incorrect. I assessed this problem incorrectly and got the answer wrong. My apologies.

It was a nice one!

Karan Chatrath - 1 year ago

Log in to reply

@Karan Chatrath Ah, thank you for responding nevertheless. I was wondering why the block would come to equilibrium there if the force of the spring was greater than friction at that particular point in time.

Krishna Karthik - 1 year ago

Log in to reply

@Krishna Karthik Yes, that is precisely my mistake. The block still has potential energy when it first comes to rest. The system gets driven back to motion (by the spring force) and dissipates more of its energy until it eventually settles to x = 0 x=0 after a long time.

Karan Chatrath - 1 year ago

Log in to reply

@Karan Chatrath It certainly does take a very long time to reach x = 0 x = 0 . I think if you simulate it for a huge amount of time, it'll eventually stop dead at x = 0 x = 0 , with negligible vibrations caused simply by the mathematics of the calculation.

My insight is that the ODE of the system has only one steady state I can see, being x = 0 x = 0 . A similar system would be the pendulum (with drag), which similarly has a 0 steady state.

Krishna Karthik - 1 year ago

Log in to reply

@Krishna Karthik I did solve your problem on the pendulum with drag. Another good one. Indeed, the physics plays out the way you said. Keep posting

Karan Chatrath - 1 year ago

I'll try to check the code again; maybe add an energy variable. Thanks for pointing this out.

Krishna Karthik - 1 year ago

Log in to reply

No, what you have done is fine. My assessment of the physics is incorrect.

Karan Chatrath - 1 year ago

Log in to reply

@Karan Chatrath All good man, thanks!

Krishna Karthik - 1 year ago

You may be right. When the block comes to rest for the first time, if the horizontal spring force is less than the friction coefficient times the normal force, the block will remain at rest. This assumes that the static coefficient is the same as the dynamic coefficient. I won't have time to play with this again until later today

Steven Chase - 1 year ago

Log in to reply

Yes, the static is the same as the dynamic coefficient.

Krishna Karthik - 1 year ago

I added a few energy variables, and I have found out that the system only loses half of its energy to friction (heat) when it first stops, and still has lots of energy left. I also tried running it for large amounts of time and found that it only fully dissipates all its energy till x = 0 x = 0 . I have attached the summary to my solution.

Krishna Karthik - 1 year ago

When the block comes to rest at x = 7.1 x = -7.1 , the rightward horizontal spring force magnitude is 122 \approx 122 , and the product of the friction coefficient with the normal force is 23 \approx 23 , so friction can't hold the block still there. Now of course, your argument may hold true at some other point at which the speed of the block becomes zero. But it doesn't appear to be that first stopping point.

Steven Chase - 1 year ago

Log in to reply

Yes, Karan Chatrath checked back and stated earlier that in hindsight what he had said was incorrect.

Krishna Karthik - 1 year ago

Very true, the energy only fully dissipates at x = 0 x = 0 . Karan already resolved the report.

Krishna Karthik - 1 year ago

Thank you for checking. Our discussion following my earlier problem on the exponential wire and this problem have both given me useful insights on modelling friction force.

Karan Chatrath - 1 year ago
Steven Chase
May 28, 2020

Fun problem. This sort of problem benefits greatly from a code solution

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import math

# Constants

m = 5.0
k = 20.0
L0 = 1.0
h = 1.0
g = 10.0
u = 0.7

dt = 10.0**(-6.0)

##############################

t = 0.0

x = 10.0            # Initialize simulation
xd = 0.0
xdd = 0.0

while t <= 5.0:

    x = x + xd*dt     # numerical integration
    xd = xd + xdd*dt

    L = math.hypot(x,h)  # spring length

    s = L - L0  # spring stretch

    Fs = k*s  # spring force magnitude

    Fsx = -Fs*(x/L)     # horizontal spring force
    Fsy = Fs*(h/L)      # vertical spring force

    # m*g = Fsy + N    # vertical force balance

    N = m*g - Fsy     # normal force

    if xd > 0.0:      # friction force
        Ff = -u*N     # depends on velocity sign   
    else:
        Ff = u*N

    Fx = Fsx + Ff     # net x force

    xdd = Fx/m        # x acceleration

    t = t + dt

##############################

print dt
print x

#>>> ================================ RESTART ================================
#>>> 
#0.0001
#0.668524353854
#>>> ================================ RESTART ================================
#>>> 
#1e-05
#0.673516137027
#>>> ================================ RESTART ================================
#>>> 
#1e-06
#0.67401590979
#>>> 

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...