<font color=#008000> >作者: 吳姿瑩 >更新:2022.11.24 </font>[color=#008000] # Lesson10: 終端速度 ###### tags: `運動科學模擬` `多元選修` `vpython` `終端速度` ## :memo:什麼是終端速度terminal velocity? <iframe width="560" height="315" src="https://www.youtube.com/embed/eLO4liZQHuE" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> 物體自由落下過程中,不僅受到重力,亦會受到阻力影響,當阻力與重力等大時,即合力為零,作等速度運動,此速度即為終端速度(terminal velocity)。 ## :memo:終端速度物理觀念 - 鉛直運動的自由落體,考慮空氣阻力的影響,最終當合力為零時,速度極為終端速度,其鉛直方向運動如下: (1). $\vec{F} = m\vec{g} + \vec{f_{阻力}}$ (2). $f_{阻力}= - k*v$ 其中k為空氣阻力係數,和表面介面、物體形狀有關, 當速度愈大時,阻力大小也會愈大,其中球的合力會愈小,故可得 $\vec{F} = m\vec{g} - k\vec{v} = m\vec{a}$ 其中在地表重力加速度$g=9.8 m/s^2$ ## :memo:設置一個物體sphere自由落下、一個物體sphere自由落下(考慮空氣阻力) <iframe width="560" height="315" src="https://www.youtube.com/embed/vedmYxH3-HA" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> ### 1.參數設定 |**意涵** |**設定**| |-----|--------| |圓球質量 1kg|m = 1 | |圓球半徑 1m |R = 1 | |圓球初始高度 20 m|H = 20| |圓球初速度(靜止落下)|v = 0| |圓球加速度 $m/s^2$|g = 9.8| |初始時間|t = 0| |時間間隔|dt = 0.01| |地板厚度 0.01 m| thin = 0.01| |空氣阻力$N\times s/m$|k= 1.5| ### 2.畫面設定 - 前一堂課有關畫布canvas的設定,請設定title="1D Motion", caption='自由落下'的畫布 - 利用box設定一個地板 - 設定兩球sphere,位置皆從==從地板高度H==自由落下(==注意球的半徑、地板厚度==),初速度為$\vec{v}=(0, 0, 0)$,初加速度為$\vec{a}=(0, -g, 0)$ ```javascript=1 ball = sphere(pos=vec(0, H + thin/2, 0), radius=R, color=color.red, v=vec(0, 0, 0), a=vec(0, -g, 0)) #紅球自由落下(考慮空氣阻力) ball2 = sphere(pos=vec(-H/2, H + thin/2, 0), radius=R, color=color.blue, v=vec(0, 0, 0), a=vec(0, -g, 0)) #藍球自由落下(無考慮空氣阻力) ``` - 新增箭頭資訊,來代表加速度的大小變化,==箭頭位置position==更新位置即球的位置,==箭頭指向的軸axis==即是y方向向下加速度之方向,shaftwidth即為箭頭的寬度,另外統一使用黑色箭頭代表加速度的大小。 ```javascript=1 a_arrow = arrow(pos = ball.pos, axis=ball.a, shaftwidth=0.3, color=color.black) a_arrow2 = arrow(pos = ball2.pos, axis=ball2.a, shaftwidth=0.3, color=color.black) ``` - 需畫出三個圖(1)y-t圖 (2)v~y~-t圖 (3)a~y~-t圖 (==注意畫布的大小以及y位置==),圖的名稱可定義為gd、gd_vel、gd_a ```javascript=1 yt = gcurve(graph=gd, color=color.red) vt = gcurve(graph=gd_vec, color=color.red) at = gcurve(graph=gd_a, color=color.red) yt2 = gcurve(graph=gd, color=color.blue) vt2 = gcurve(graph=gd_vec, color=color.blue) at2 = gcurve(graph=gd_a, color=color.blue) ``` ### 3.物體的運動 - 這次新增了==當按下滑鼠後,程式才開始執行==,故在迴圈之前新增了以下程式碼,按下滑鼠後才可進行程式碼 ```javascript=1 T = text(text='Please click to run! ',pos=vec(-30, -10, 0), align='left', height = 3, color=color.black) scene.waitfor('click') ``` 文字提醒位置可調整至不影響畫面的位置。 - 設置當時間小於10秒時,會執行程式,並當考慮空氣阻力的球,撞擊至地面時(考慮地面厚度、球的半徑),則停止迴圈 ```javascript=1 while( t < 10 ): ...(略) if ball.pos.y - floor.pos.y <= R + thin/2 : break ...(略) ``` - 考慮空氣阻力$f$,根據前面的概念$f_{阻力}= - k\times v$,程式碼中的f即為空氣阻力,方向與球的速度反向, - 根據前面概念$\vec{F} = m\vec{g} - k\vec{v} = m\vec{a}$,可得球的==加速度==為$\vec{g}-\frac{k\vec{v}}{m}$,==即是$\vec{g} + \frac{\vec{f}}{m}$.== - 因為不再是等加速度運動,故利用每一時刻加速度乘上微小時間變化,為速度變化量;每一時刻速度乘上微小時間變化,為位移變化量,此法即為==解析法==,每一時刻更新球的速度、位置資訊。 ```javascript=1 #空氣阻力f = -k*v f = - k*ball.v a_tot = ball.a + f/m ball.v.y += a_tot.y*dt ball.pos.y += ball.v.y*dt ``` - 考慮空氣阻力時,重要的是,當==合力為零時,即加速度為零時==,球的運動即為==等速度運動==,速度量值、加速度量值皆為定值,其中球的位置變化即是等速度運動 $\vec{\Delta x} = \vec{v} \times \Delta t$ ```javascript=1 if a_tot.y == 0: ball.v.y = ball.v.y ball.a = a_tot ball.pos.y += ball.v.y*dt ``` - 無考慮空氣阻力的球,即為等加速度運動,其程式碼如上週自由落體 ```javascript=1 #無空氣阻力 ball2.v.y = v + ball2.a.y*t ball2.pos.y = H + thin/2 + (v*t + 0.5*ball2.a.y*t**2) ``` - ==箭頭更新資訊==即為加速度資訊,因球的位置、加速度大小每一時刻資訊皆會更新,故箭頭資訊的更新如下 ```javascript=1 #更新箭頭資訊 a_arrow.pos = ball.pos a_arrow.axis = a_tot a_arrow2.pos = ball2.pos a_arrow2.axis = ball2.a ``` - 最後畫圖資訊,為求當落地時的球,不再更新畫圖資訊,讓圖的資訊更為明確清楚,故新增一if條件判斷,當尚未落地時,則更新圖的資訊;當落地時,就不再更新圖的資訊,且球的速度、加速度皆為零,位置則在地面上 ```javascript=1 if ball2.pos.y >=R + thin/2 : yt2.plot(pos = (t, ball2.pos.y)) vt2.plot(pos = (t, ball2.v.y)) at2.plot(pos = (t, ball2.a.y)) else : ball2.v.y = 0 ball2.a.y = 0 H = 0 ball2.pos.y = R ``` - 以下為物體運動的完整程式碼 ```javascript=1 while( t < 10 ): rate(100) #空氣阻力f = -k*v f = - k*ball.v a_tot = ball.a + f/m ball.v.y += a_tot.y*dt ball.pos.y += ball.v.y*dt #無空氣阻力 ball2.v.y = v + ball2.a.y*t ball2.pos.y = H + (v*t + 0.5*ball2.a.y*t**2) if a_tot.y == 0: ball.v.y = ball.v.y ball.a = a_tot ball.pos.y += ball.v.y*dt if ball2.pos.y >=R + thin/2 : yt2.plot(pos = (t, ball2.pos.y)) vt2.plot(pos = (t, ball2.v.y)) at2.plot(pos = (t, ball2.a.y)) else : ball2.v.y = 0 ball2.a.y = 0 H = 0 ball2.pos.y = R #設置停止迴圈條件 if ball.pos.y - floor.pos.y <= R + thin/2 : break #更新箭頭資訊 a_arrow.pos = ball.pos a_arrow.axis = a_tot a_arrow2.pos = ball2.pos a_arrow2.axis = ball2.a yt.plot(pos = (t, ball.pos.y)) vt.plot(pos = (t, ball.v.y)) at.plot(pos = (t, a_tot.y)) t += dt ``` :::spoiler **自由落下(考慮空氣阻力) 完整程式碼** ```javascript=1 """ Auther :吳姿瑩 Date :2022/08/19 2022/08/20 ver.2 (加速度視覺化, 無空氣阻力球比較) version :python3.10.6 vpython7 chapter :自由落下(終端速度) 空氣阻力 f = -k*v """ from vpython import * """ 1. 參數設定, 設定變數及初始值 """ m = 1 # 圓球質量 1kg R = 1 # 圓球半徑 H = 20 # 圓球初始高度 20 m v = 0 # 圓球初速度(靜止落下) g = 9.8 # 圓球加速度 t = 0 # 時間 dt = 0.01 # 時間間隔 thin = 0.01 # 地板厚度 k = 1.5 # 空氣阻力常數 """ 2. 畫面設定 """ #畫面設定,預設為 640 and 400 像素 scene = canvas(title="1D Motion", width=640, height=400, x=0, y=0, center=vec(0, 0.3, 0), background=vec(204/255,204/255,255/255), caption = "自由落下(Black arrow means accerlation).") floor = box(pos=vec(0, 0, 0), size=vec(40, thin, 10), color=color.green) ball = sphere(pos=vec(0, H + thin/2, 0), radius=R, color=color.red, v=vec(0, 0, 0), a=vec(0, -g, 0)) ball2 = sphere(pos=vec(-H/2, H + thin/2, 0), radius=R, color=color.blue, v=vec(0, 0, 0), a=vec(0, -g, 0)) text(text='Red ball: with friction' ,pos=vec(0, H+5, 0), align='left', height = 2, color=color.red) text(text='Blue ball: without friction' ,pos=vec(-H/2-20, H+5, 0), align='left', height = 2, color=color.blue) #畫y-t圖v-t圖設定畫布 gd = graph(title="y-t plot", width=600, height=450, x=0, y=640, xtitle="t(s)", ytitle="y(m)") gd_vec = graph(title="<b>v<sub>y</sub>-t plot<b>", width=600, height=450, x=0, y=1050, xtitle="t(s)", ytitle="v<sub>y</sub>(m/s)") gd_a = graph(title="<b>a<sub>y</sub>-t plot<b>", width=600, height=450, x=0, y=1500, xtitle="t(s)", ytitle="a<sub>y</sub>(m/s)") yt = gcurve(graph=gd, color=color.red) vt = gcurve(graph=gd_vec, color=color.red) at = gcurve(graph=gd_a, color=color.red) yt2 = gcurve(graph=gd, color=color.blue) vt2 = gcurve(graph=gd_vec, color=color.blue) at2 = gcurve(graph=gd_a, color=color.blue) #箭頭資訊 a_arrow = arrow(pos = ball.pos, axis=ball.a, shaftwidth=0.3, color=color.black) a_arrow2 = arrow(pos = ball2.pos, axis=ball2.a, shaftwidth=0.3, color=color.black) """ 3. 物體運動部分, 圓球到達地板邊緣時停止執行 """ #等待click才會開始執行 T = text(text='Please click to run! ',pos=vec(-30, -10, 0), align='left', height = 3, color=color.black) scene.waitfor('click') while( t < 10 ): rate(100) #空氣阻力f = -k*v f = - k*ball.v a_tot = ball.a + f/m ball.v.y += a_tot.y*dt ball.pos.y += ball.v.y*dt #無空氣阻力 ball2.v.y = v + ball2.a.y*t ball2.pos.y = H + (v*t + 0.5*ball2.a.y*t**2) if a_tot.y == 0: ball.v.y = ball.v.y ball.a = a_tot ball.pos.y += ball.v.y*dt if ball2.pos.y >=R + thin/2 : yt2.plot(pos = (t, ball2.pos.y)) vt2.plot(pos = (t, ball2.v.y)) at2.plot(pos = (t, ball2.a.y)) else : ball2.v.y = 0 ball2.a.y = 0 H = 0 ball2.pos.y = R #設置停止迴圈條件 if ball.pos.y - floor.pos.y <= R + thin/2 : break #更新箭頭資訊 a_arrow.pos = ball.pos a_arrow.axis = a_tot a_arrow2.pos = ball2.pos a_arrow2.axis = ball2.a yt.plot(pos = (t, ball.pos.y)) vt.plot(pos = (t, ball.v.y)) at.plot(pos = (t, a_tot.y)) t += dt ``` :::spoiler **學生作業(上課活動)** 1. 試求質量$1 kg$,空氣阻力係數為$1.5 Ns/m$,重力加速度$g$為9.8 $m/s^2$,終端速度為何? 2. 試求質量$1 kg、0.5 kg,終端速度何者較大? ::: :::spoiler 學生作業 1. Homework:畫出==三個不同顏色==的球,分別為空氣阻力係數為$1.5 ,2.0 ,2.5 N\times s/m$ <iframe width="560" height="315" src="https://www.youtube.com/embed/Mxjt7xcyt8w" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> Requirements要求: (1)需畫出球體移動 (2)需畫出三個球體搭配球體顏色(1)y-t圖 (2)v~y~-t圖 (3)a~y~-t圖 (3)需在算出各自終端速度v~1~(k=1.5)、v~2~(k=2.0)、v~3~(k=2.5) 2. 請將==程式code以及瀏覽器結果截圖== 至google classroom繳交作業。 3. 完成今日協作平台更新 4. 將code上傳至雲端硬碟中(Lesson10 vpython終端速度) ::: ## :memo:參考網址 1. vpython arrow箭頭語法:https://www.glowscript.org/docs/VPythonDocs/arrow.html 2. vpython mouse螢幕互動:https://www.glowscript.org/docs/VPythonDocs/mouse.html