2013年9月3日火曜日
蛙跳び
' Leap Frog Method
dim n as Integer
dim i as Integer
dim f(100) as double
dim fo(100) as double
dim fn(100) as double
dim mojiretsu as String
'Initial Condition
For i = 1 to ixmx
if i > 10 And i<20 then
fo(i) = 1.0
f(i) = 1.0
fn(i) = 1.0
else
fo(i) = 0.0
f(i) = 0.0
fn(i) = 0.0
end if
next i
'Time Marching
for n =1 to itmx
'Leap Frog
for i = 2 to ixmx
fn(i) = fo(i) - 2*u*dt/dx*(f(i) - f(i-1))
next i
'Shift Variables
for i = 2 to ixmx
f(i) = 0.5*(fn(i)+fo(i))
fo(i) = fn(i)
next i
next n
'Output
for i = 1 to ixmx
mojiretsu = Str(i) +"," + Str(f(i))
ListBox2.AddRow(mojiretsu)
next i
4次精度ルンゲクッタと比較すると、2次精度の蛙飛びの方が、鈍りが少ないです。
なぜなんだろう・・・。
登録:
コメントの投稿 (Atom)
0 件のコメント:
コメントを投稿