{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

HW9 Solution

# HW9 Solution - Solve the problem by A System of 1st Order...

This preview shows pages 1–5. Sign up to view the full content.

ME 218: ENGINEERING COMPUTATIONAL METHODS Home Work #9 Assigned: November 12, 2011 Due: Friday, November 18, 2011 at 5pm Please leave your homeworks in ETC 5.128 or slide under Prof. Djurdjanovic’s office door Name: __________________ UT EID: ____________ Unique: _________ or Lab Time: (Mon/Tue) ___PM

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Problem 1 % Assign the initial value of this spherical tank parameters C=0.5; A=pi*(0.04/2)^2; g=9.81; H_n=3.75; r=5/2; delta_t=1; i=0; % Solve the problem by 1st order ODE©'s Method while (H_n>=1e-9) dif_H_n=-C*A*sqrt(2*g*H_n)/(2*pi*r*H_n-pi*H_n^2); H_nn_p=H_n+delta_t*dif_H_n; dif_H_nn_p=-C*A*sqrt(2*g*H_nn_p)/(2*pi*r*H_nn_p-pi*H_nn_p^2); dif_H_n_ave=0.5*(dif_H_nn_p+dif_H_n); H_nn_c=H_n+delta_t*dif_H_n_ave; H_n=H_nn_c; i=i+1; end % Compute the time to drain out the liquid in the tank. Totaltime=i*delta_t *******************The time to drain out the liquid in the tank is ********************* Totaltime = 15029 >> Problem 3 % Assign the initial parameter vaules u_0=200; v_0=200; c=0.002; g=9.8; h=0.01; i=0; flag=1;
% Solve the problem by A System of 1st Order ODE Method (Vertical 4th order
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % Solve the problem by A System of 1st Order ODE Method (Vertical 4th order % Runge-Kutta Method) % Note that, u_n means u(n), u_nn means u(n+1); u_n=u_0; v_n=v_0; while (flag) k1 = h*[-c*u_n*sqrt(u_n^2+v_n^2);-g-c*v_n*sqrt(u_n^2+v_n^2)]; k2 = h*[-c*(u_n+k1(1,1)/2)*sqrt((u_n+k1(1,1)/2)^2+(v_n+k1(2,1)/2)^2);-g-c*(v_n+k1(2,1)/2)*sqrt((u_n+k 1(1,1)/2)^2+(v_n+k1(2,1)/2)^2)]; k3 = h*[-c*(u_n+k2(1,1)/2)*sqrt((u_n+k2(1,1)/2)^2+(v_n+k2(2,1)/2)^2);-g-c*(v_n+k2(2,1)/2)*sqrt((u_n+k 2(1,1)/2)^2+(v_n+k2(2,1)/2)^2)]; k4 = h*[-c*(u_n+k3(1,1))*sqrt((u_n+k3(1,1))^2+(v_n+k3(2,1))^2);-g-c*(v_n+k3(2,1))*sqrt((u_n+k3(1,1))^ 2+(v_n+k3(2,1))^2)]; kavg=(k1+2*k2+2*k3+k4)/6; u_nn=u_n+kavg(1,1); v_nn=v_n+kavg(2,1); if (v_nn>0) i=i+1; t_n = i*h; u_n=u_nn; v_n=v_nn; else flag=0; end end % calculate the average value of t(n) and t(n+1) which the vertical % velocity changes its sign. t_nn=t_n+0.01; tavg=(t_n+t_nn)/2 ****************************The average value of t(n) and t(n+1) is******************** tavg = 7.1950 >>...
View Full Document

{[ snackBarMessage ]}

### Page1 / 5

HW9 Solution - Solve the problem by A System of 1st Order...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online