Presentation is loading. Please wait.

Presentation is loading. Please wait.

An Introduction to Computational Fluid Mechanics By Chuen-Yen Chow.

Similar presentations


Presentation on theme: "An Introduction to Computational Fluid Mechanics By Chuen-Yen Chow."— Presentation transcript:

1 An Introduction to Computational Fluid Mechanics By Chuen-Yen Chow

2 Numerical Solution of Ordinary Differential Equations: Initial-Value Problems

3 Chapter 2 2.2 Numerical Solution of Second-Order ODE Boundary Value Problems

4

5 * Linear second order ODE of the form * The approximation by the difference equation * Multiplying the equation by and grouping the terms

6 * It can be written in a more convenient form

7 * The preceding coefficients are known constants at any interior point in the specified range of x, applied at i=1,2,….,n * n linear algebraic equations to be solved simultaneously for n unknown  For i = 1 and n  Since and are known from the boundary conditions and constant * Therefore are moved to the right

8 * The coefficient matrix on the left-hand side is called a tridiagonal matrix * This matrix can be solved by using the Gaussian elimination method

9 * According to Gaussian elimination method, we multiply the second equation by and the first by and then take the difference of the two to eliminate * The resulting equation is * If we replace the following

10 * The same process is repeated for i = 3, 4, ….., n-1 * The remaining coefficients will be as following * Where i = 2,3,….,n-1 * The value of can immediately be found by solving simultaneously the last two equations

11 * The remaining unknowns can be calculated in a backward order the following formula j = n-1, n-2, ……., 2, 1

12 Constants declaration TMAX = 1.08; DT = 0.002; NM = (TMAX/DT) + 1; NU = 0.000217; DOMAINy = 40.0/1000.0; JM = 41; DY = DOMAINy/(JM-1); U0 = 40.0; D = NU * DT / (DY*DY); U(1) = U0; UO(1) = U0; for J=2:JM % Reset U and UO arrays U(J) = 0.0; UO(J) = 0.0; end

13 % Solution using LAASONEN Method N = JM - 2; JMM1= JM - 1; for K=1:NM for J=1:JM UO(J) = U(J); UP(J,K) = U(J); end

14 SPECIFY BOUNDARY CONDITIONS AND MODIFY SOME OF THE COEFFICIENTS for J=1:N C(J,1) = D; C(J,2) = -(1.0+2.0*D); C(J,3) = D; C(J,4) = -U(J+1); end C(1,4) = C(1,4) - C(1,1)*U(1); C(1,1) = 0.0; C(N,4) = C(N,4) - C(N,3)*U(JM); C(N,3) = 0.0; % TRIDIGONAL SOLUTION for J = 2:N-1 C(J,2) = C(J,2)*C(J-1,2) - C(J,1)*C(J-1,3); C(J,3) = C(J,3)*C(J-1,2); C(J,4) = C(J,4)*C(J-1,2) - C(J,1)*C(J-1,4); end

15 COMPUTE PHI AND U AT INTERIOR POINT F(N) = ( C(N,4)*C(N-1,2) - C(N,1)*C(N-1,4) ) / ( C(N,2)*C(N-1,2) - C(N,1)*C(N-1,3) ); for K = 1:(N-1) J = N - K; F(J) = ( C(J,4) - C(J,3)*F(J+1) ) / C(J,2); end for J = 2:JMM1 U(J) = F(J-1); end

16

17

18 END


Download ppt "An Introduction to Computational Fluid Mechanics By Chuen-Yen Chow."

Similar presentations


Ads by Google