80 likes | 211 Views
Plasma Application Modeling, POSTECH. ODE by using Modified Euler Method. 2005. 9. 27. G.J. Kim. Plasma Application Modeling, POSTECH. Problem 8. Solve the following ODE by using second-order modified Euler method without iteration through the shooting method. Plasma Application
E N D
Plasma Application Modeling, POSTECH ODE by using Modified Euler Method 2005. 9. 27. G.J. Kim
Plasma Application Modeling, POSTECH Problem 8 Solve the following ODE by using second-order modified Euler method without iteration through the shooting method
Plasma Application Modeling, POSTECH Exact Solution Exact Solution
Plasma Application Modeling, POSTECH Code subroutine ode(y0,z0,yl,x,y,z) real y0,z0 real x(100),y(100),z(100) real dx integer N common /a/ N,dx y(1) = y0 z(1) = z0 do 400 i = 2,N z(i) = z(i-1)+dx*dz(x(i-1),y(i-1),z(i-1)) y(i) = y(i-1)+dx*dy(x(i-1),y(i-1),z(i-1)) z(i) = z(i-1)+0.5*dx* ( dz(x(i),y(i),z(i)) + dz(x(i-1),y(i-1),z(i-1)) ) y(i) = y(i-1)+0.5*dx* ( dy(x(i),y(i),z(i)) + dy(x(i-1),y(i-1),z(i-1)) ) 400 continue yl = y(N) end subroutine shoot(Y0,YL,x,y,z) real Y0,YL real yll,b,slope,o1,o2,t1,t2 real error b = 0 yll = YL + 100 t1 = 0.0 t2 = 1.0; call ode(Y0,t1,o1,x,y,z) call ode(Y0,t2,o2,x,y,z) slope = (o1 - o2)/(t1 - t2) do 300 i = 1,100 b = b + (YL-yll)/slope; print *,'b = ',b call ode(Y0,b,yll,x,y,z) error = abs(YL-yll) print *,'error = ',error,i if(error .LT. 0.001) go to 301 300 continue 301 end
Plasma Application Modeling, POSTECH Euler Method solution error
Plasma Application Modeling, POSTECH Modified Euler Method (no iteration) solution error
Plasma Application Modeling, POSTECH Compare h=0.125 h=0.25 h=0.0625 h=0.03125