Page - 265 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition
Image of the Page - 265 -
Text of the Page - 265 -
8.4 Oscillating1DSystems:ASecondOrderODE 265
If there is no external excitation force acting on the body, we have the equation
ofmotion
mu′′+μmgsign(u′)+kα−1 tanh(αu)=0 .
Let us simulate a situation where a body of mass 1 kg slides on a surface with
μ = 0.4, while attached to a spring with stiffness k = 1000 kg/s2. The initial
displacement of the body is 10 cm, and theα parameter in s(u) is set to 60 1/m.
Using theEulerCromer functionfromtheosc_EC_generalcode,we can write a
functionsliding_frictionfor solving thisproblem:
def sliding_friction():
from numpy import tanh, sign
f = lambda v: mu*m*g*sign(v)
alpha = 60.0
s = lambda u: k/alpha*tanh(alpha*u)
F = lambda t: 0
g = 9.81
mu = 0.4
m = 1
k = 1000
U_0 = 0.1
V_0 = 0
T = 2
dt = T/5000.
u, v, t = EulerCromer(f=f, s=s, F=F, m=m, T=T,
U_0=U_0, V_0=V_0, dt=dt)
plot_u(u, t)
Running thesliding_frictionfunctiongives us the results in Fig. 8.34 with
s(u)= kα−1 tanh(αu) (left) and the linearizedversion s(u)= ku (right).
Programming for Computations – Python
A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition
- Title
- Programming for Computations – Python
- Subtitle
- A Gentle Introduction to Numerical Simulations with Python 3.6
- Volume
- Second Edition
- Authors
- Svein Linge
- Hans Petter Langtangen
- Publisher
- Springer Open
- Date
- 2020
- Language
- English
- License
- CC BY 4.0
- ISBN
- 978-3-319-32428-9
- Size
- 17.8 x 25.4 cm
- Pages
- 356
- Keywords
- Programmiersprache, Informatik, programming language, functional, imperative, object-oriented, reflective
- Category
- Informatik