Simulating Dynamics - 3

Difficulty: quite hard.

Here's another monstrous engineering/classical mechanics exercise. Use simulation once again.

Consider the system shown below, with a block of mass that's connected to a spring on a ramp (with friction):

The coordinate system used is Cartesian. The spring is hinged at point ( 7 , 9 ) (7, 9) and the top-right corner of the mass-block is at the point ( 8 , 8 ) (8, 8) . The bottom of the ramp is at the origin ( 0 , 0 ) (0, 0) .

The force of friction is μ N \displaystyle \mu \bold{N} , with N \bold{N} being the normal force.

The displacement of the block is measured from the top of the ramp to the position of the block, that is diagonally down the ramp. See the diagram. The block is initially at a displacement of 0.1 0.1 meters from the top of the ramp as shown in the diagram. The Cartesian components are in meters.

It is released from that point at time t = 0 t = 0 seconds. Find the displacement of the block (from the top) in meters at t = 5 t = 5 seconds.

Important constants to note:

  • The ramp's incline angle is θ = π 4 \displaystyle \theta = \frac{\pi}{4} radians.
  • The block's mass m = 8 m = 8 k g kg .
  • There is ambient gravitational acceleration in the negative y y -direction, g = 10 g = 10 m / s 2 m/s^2
  • The coefficient of friction of the ramp surface is μ = 0.5 \mu = 0.5
  • Spring constant: k = 50 N / m k = 50 N/m
  • Natural length of spring: 2 \displaystyle \sqrt{2} meters


The answer is 2.393.

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

Steven Chase
Jun 12, 2020

Fun problem. Simulation code is below. Aside from computing the basic dynamics, the key thing about this problem is to keep track of two different forces:

1) The combined force from gravity and the spring parallel to the ramp
2) The maximum available friction force (equal to the friction coefficient multiplied by the normal force)

Every time the block's velocity becomes zero, you have to check force (1) to see if it is bigger/smaller than force (2). If it is bigger, the motion continues. If it is smaller, the block stays where it is in perpetuity. As it turns out, the block comes to rest at a displacement of 2.438 \approx 2.438 at time t 4.6 t \approx 4.6 . It stays there from then on.

  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
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
import math
import numpy as np

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

# Constants

xh = 7.0   # hinge coordinates
yh = 9.0

x0 = 8.0   # coordinates of start point
y0 = 8.0

theta = math.pi/4.0  # ramp angle

uk = 0.5   # friction coefficient
g = 10.0  # gravity

tf = 5.0  # final time

m = 8.0   # mass

k = 50.0  # spring constant
L0 = math.sqrt(2.0)  # spring natural length

dt = 10.0**(-5.0)  # time step

u1x = -1.0/math.sqrt(2.0)  # unit vector down ramp
u1y = -1.0/math.sqrt(2.0)

u2x = -1.0/math.sqrt(2.0)  # unit vector normal to ramp
u2y = 1.0/math.sqrt(2.0)

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

# Initialize simulation

t = 0.0
count = 0

D = 0.0  # distance from start point along ramp
Dd = 0.0
Ddd = 0.0

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

while t <= tf:

    D = D + Dd*dt     # numerical integration
    Dd = Dd + Ddd*dt

    x = x0 + D*u1x   # xy coordinates
    y = y0 + D*u1y

    Sx = xh - x     # vector from block to hinge
    Sy = yh - y

    S = math.hypot(Sx,Sy)   # spring length

    sx = Sx/S   # unit vector from block to hinge
    sy = Sy/S

    Fs = k*(S-L0) # spring force magnitude

    Fsx = Fs * sx  # spring force vector
    Fsy = Fs * sy

    # Resolve spring force into components down ramp and perpendicular to ramp

    # Fsx = F1*u1x + F2*u2x   
    # Fsy = F1*u1y + F2*u2y

    M11 = u1x
    M12 = u2x

    M21 = u1y
    M22 = u2y

    M =  np.array([[M11,M12],[M21,M22]])
    vec = np.array([Fsx,Fsy])

    Sol = np.linalg.solve(M, vec)

    F1 = Sol[0]
    F2 = Sol[1]

    N = m*g*math.cos(theta) - F2   # Normal force

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

    Fgs = m*g*math.sin(theta) + F1    # Force parallel to ramp due to gravity and spring
    Facc = Fgs + Ff                   # Friction force

    Ddd = Facc/m  # acceleration of block along ramp

    t = t + dt
    count = count + 1

    if count % 1000 == 0:
        print t,D,Dd,(Fgs/Ff)

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

print ""
print ""  
print dt
print D

Nicely done. I simply plotted the results and later did an energy analysis to see if my results were correct. I used the new set of bases down the ramp, like you did.

Krishna Karthik - 12 months ago

Log in to reply

Thanks. Yes, I also just plotted the trajectory, and verified its physical correctness afterwards

Steven Chase - 12 months ago

@Steven Chase Sir Hello, Good Morning.
In this problem I am not able to understand this steps

A Former Brilliant Member - 11 months, 3 weeks ago

Log in to reply

Those are the first and second time derivatives of the distance down the ramp

Steven Chase - 11 months, 3 weeks ago

Log in to reply

@Steven Chase sir what is the meaning of D in that blue box and the meaning of h in that green box?

A Former Brilliant Member - 11 months, 3 weeks ago

Log in to reply

@A Former Brilliant Member Let me make a suggestion. This is too difficult a problem to start programming with. Perhaps you could write a program to simulate a parabolic trajectory under the influence of gravity, using numerical integration.

Steven Chase - 11 months, 3 weeks ago

Log in to reply

@Steven Chase @Steven Chase Sir I will not able to do that, one thing we can do is that first you show me 1 program with answer after that I will do one by myself.

A Former Brilliant Member - 11 months, 3 weeks ago

Log in to reply

@A Former Brilliant Member Don't start programming with physics. Start with the basics, like learning functional programming, how to manipulate strings, calculations, looping, variables, and data types.

Krishna Karthik - 11 months, 3 weeks ago

@A Former Brilliant Member I agree with Steven Chase here. This is too difficult to start with numerical simulation.

Krishna Karthik - 11 months, 3 weeks ago

Yeah; from your doubts you don't seem to have much experience with Python. Learning Python programming is important first. It's actually a pretty simple language to get the hang of.

Krishna Karthik - 11 months, 3 weeks ago
Krishna Karthik
Jun 12, 2020

My approach is completely numerical. The main approach with this kind of problem is to compute the net force and thereby determine the acceleration of the block. The forces acting on the block are:

Gravitational force:

This force makes the block move down the ramp, as well as creates a normal force between the ramp and the block. Let's assume a coordinate system where y y is normal to the ramp and x x is orthogonal to y y (in the slope of the ramp).

F g x = m g sin ( θ ) \displaystyle \bold{F}_{gx} = mg \sin (\theta)

F g y = m g cos ( θ ) \displaystyle \bold{F}_{gy} = -mg \cos(\theta)

Spring force:

The spring force components are the most difficult to work out with the new set of bases directions (stated above).

Let the angle the spring makes with the ramp be ϕ \phi .

sin ( ϕ ) = 2 d 2 + 2 \displaystyle \sin(\phi) = \frac{\sqrt{2}}{d^2+2} (where d d is the displacement)

cos ( ϕ ) = d d 2 + 2 \displaystyle \cos(\phi) = \frac{d}{\sqrt{d^2 + 2}}

The magnitude of spring force:

k s = k ( d 2 + 2 2 ) \displaystyle ks = k(\sqrt{d^2+2} - \sqrt{2})

Components:

F s x = k ( d 2 + 2 2 ) cos ( ϕ ) \displaystyle \bold{F}_{s x} = -k(\sqrt{d^2+2} - \sqrt{2}) \cos(\phi)

F s y = k ( d 2 + 2 2 ) sin ( ϕ ) \displaystyle \bold{F}_{s y} = k(\sqrt{d^2+2} - \sqrt{2}) \sin(\phi)

Frictional force:

The normal force is the net y y force, given by:

N = F g y F s y \bold{N} = \bold{F}_{gy} - \bold{F}_{s y}

So the frictional force is ± μ N \pm \mu \bold{N} (depending on velocity of block).

Total force in x x -direction:

F x = F g x + F s x ± μ N \bold{F}_x = \bold{F}_{gx} + \bold{F}_{s x} \pm \mu \bold{N}


Now, we can code the forces in and simulate the motion of the block. Here's a graph of the displacement of the block:

Here's my code:

 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
time = 0;
deltaT = 10^-4;

velocity = 0;
displacement = 0.1;

%constants

L = sqrt(2);
k = 50;
m = 8;
g = 10;
mu = 0.5;

%ramp angle
sin_theta = 1/sqrt(2);
cos_theta = 1/sqrt(2);

displacementValue = [displacement];
timeValue = [time];
velocityValue = [velocity];

while time <= 5

  displacementValue = [displacementValue, displacement];
  timeValue = [timeValue, time];
  velocityValue = [velocityValue, velocity];



  %component multipliers for spring force:    
  sin_phi = L/(hypot(displacement,L));
  cos_phi = displacement/hypot(displacement,L);

  %spring force magnitude:
  stretch = hypot(L,displacement)-L;
  springForce = k*stretch;

  %Gravitational force components:
  Fgx = m*g*sin_theta;
  Fgy = -m*g*cos_theta;

  %Spring force components:
  Fsx = -springForce*cos_phi;
  Fsy = springForce*sin_phi;

  %normal force computation:
  normalForce = Fsy + Fgy;


  %spring force (dependent on direction of velocity):
  if velocity < 0
    frictionForce = -mu*normalForce;
  else
    frictionForce = mu*normalForce;
  end

  %total force:
  totalForceX = Fgx + Fsx + frictionForce;

  %Euler numerical integration:
  acceleration = totalForceX/m;
  velocity = velocity + acceleration*deltaT;
  displacement = displacement + velocity*deltaT;

  time = time + deltaT;

end


plot(timeValue,displacementValue)

hold on

plot(timeValue, velocityValue)

hold off

Nice problem. Just solved it. I was looking at your solution and you have defined:

sin ϕ = 2 d \sin{\phi} = \frac{\sqrt{2}}{d}

Shouldn't it be:

tan ϕ = 2 d \tan{\phi} = \frac{\sqrt{2}}{d}

Karan Chatrath - 12 months ago

Log in to reply

Oh woops, sorry, I meant sin ( ϕ ) = 2 d 2 + 2 \displaystyle \sin(\phi) = \frac{\sqrt{2}}{d^2 + 2}

Krishna Karthik - 12 months ago

Yes, quite right. I'll edit that in a moment.

Krishna Karthik - 12 months ago

I like this problem and I have posted a follow up. Hope you enjoy it.

Karan Chatrath - 12 months ago

Log in to reply

Ah, I've seen it. I'm going to attempt it soon :) Glad you liked the problem.

Krishna Karthik - 12 months ago

Hey, I just solved your problem, nice one.

Krishna Karthik - 12 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...