본문 바로가기
물리코딩

달이 멈춘다면 ?!

by 로토마 2021. 6. 24.

달이 멈춘다면?!

만약 달이 멈춘다면 어떻게 될까??

달과 지구가 서로 끌어다니는 만유인력으로 인해 상대적으로 질량이 큰 지구쪽으로 끌려간다.

결국 달은 지구와 충돌하게 된다!!

 

이번 시간은 무엇보다 물리코딩의 장점이 드러나는 시간이었다.

물리코딩을 통해 우리가 평소 관측하기 힘든 물리 현상을  쉽게 살펴볼 수 있다!!

비록 작용하는 힘의 요소는 너무 많기 때문에, 실제와 100% 같을 순 없겠지만, 

그럼에도 물리 코딩을 통해 많은 물리 현상을 직접적으로 눈으로 확인할 수 있어서 너무 유익하다~~!

 

GlowScript 3.0 VPython
#Creating Objects
Earth = sphere(pos = vector(0,0,0), radius = 6400000, texture = textures.earth)
Moon = sphere(pos = vector(385000e3,0,0), radius = 1737000, make_trail =True)
sf = 6 #scailing factor
Earth.radius = sf*Earth.radius
Moon.radius = sf*Moon.radius

#Physical Properties
G = 6.67e-11
Earth.mass = 5.972e24
Moon.mass = 7.347e22
Earth.v = vec(0,0,0)
Moon.v = vec(0,0,0)

#time
t = 0
dt = 60*5

scene.waitfor('click')

#Simulation Loop
while True:
    rate(1000)
    #Forces
    r = Moon.pos-Earth.pos
    Moon.f = -G*Earth.mass*Moon.mass/mag(r)**2*norm(r)
    Earth.f= -Moon.f
    #Time Integration
    Moon.v = Moon.v + Moon.f/Moon.mass*dt
    Earth.v = Earth.v + Earth.f/Earth.mass*dt
    Moon.pos = Moon.pos + Moon.v*dt
    Earth.pos = Earth.pos + Earth.v*dt
    t = t + dt
    #Collision Check
    if Earth.radius + Moon.radius >= mag(r):
        print("Collision!")
        print( t/60/60/24, "days")
        break

 

https://www.glowscript.org/#/user/emilyjiminroh/folder/physicscoding/program/%EB%8B%AC%EC%9D%B4%EB%A9%88%EC%B6%98%EB%8B%A4%EB%A9%B4? 

 

GlowScript IDE

GlowScript is an easy-to-use, powerful environment for creating 3D animations and publishing them on the web. Here at glowscript.org, you can write and run GlowScript programs right in your browser, store them in the cloud for free, and easily share them w

www.glowscript.org

 

'물리코딩' 카테고리의 다른 글

등속도, 등속직선, 등가속도 운동  (0) 2021.12.31
3체 운동  (0) 2021.07.07
수직(자유낙하운동) + 수평(포물선운동)  (0) 2021.06.28
달의 공전  (0) 2021.06.24
지구의 자전  (0) 2021.06.24