1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

カテナリー曲線のシミュレーション

Posted at

はじめに

ロープを水平にすると電柱の電線のようにカテナリー曲線を描くことが一般的に知られている。これは、ロープを細かく分割して質量を持った短いロープの集合体として考え、微分方程式を立てることで証明することができる。もしくは、変分法でも証明することができる。そこで、今回はPythonを用いて水平にしたロープの描く軌跡をシミュレーションする。

カテナリー曲線2.gif

運動方程式

左から等間隔に$n$個の質点を並べる。そこで、$i$番目の質点に対して以下のような運動方程式を考える。
ただし、質点の座標を$X_i=x_i+jy_i$とした。

m\frac{dX_i^2}{dt^2}=-j\{ -k(X_i-X_{i-1})-k(X_i-X_{i-1})=-k(X_{i+1}+X_{i-1}-2X_i)\}

プログラム

上記の運動方程式を用いて、プログラムを作成する。

python catenary.py
import numpy as np
import matplotlib.pyplot as plt
import japanize_matplotlib
import math
import matplotlib.animation as animation

fig = plt.figure()

ims = []
g=-9.8
m=1

k=1
n=10
X=np.linspace(0,10,n,dtype=complex)
dxdt=np.zeros(n,dtype=complex)
ddxdtt=np.zeros(n,dtype=complex)
dt=0.03
Y=np.zeros(n)

t=0
#オイラー法による微分方程式の数値解析
while t<10:
  for i in range(n):
    if 0<i<n-2:
      ddxdtt[i]=-(k/m*abs(X[i+1]+X[i-1]-2*X[i])-m*g)*(-1j)
    #境界条件(両端固定)
    elif i==0:
      X[0]=0
      ddxdtt[0]=0
    else:
      X[-1]=0
      ddxdtt[-1]=0
    dxdt[i]=dxdt[i]+ddxdtt[i]*dt
    X[i]=X[i]+dxdt[i]*dt
  im=plt.plot(X.real,X.imag,"o",color="red")
  ims.append(im)
  t=t+dt
# 10枚のプロットを 100ms ごとに表示
ani = animation.ArtistAnimation(fig, ims, interval=10)
#保存
ani.save("カテナリー曲線2.gif", writer="pillow")

これを実行すると以下のようになる。

カテナリー曲線2.gif

確かに、落下するにつれてカテナリー曲線を各質点は描写していくのが分かる。

まとめ

今回は、オイラー法を用いて、カテナリー曲線のシミュレーションを行った。結果見事に、曲線を描写することができた。

参考文献

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?