ME/AE 339 Computational Fluid Dynamics K. M. Isaac Topic3_PDE 02/28/20 Topic 3 Discretization of PDE 1 Computational Fluid Dynamics (AE/ME 339) Isaac K. M. MAEEM Dept., UMR Dicretization of Partial Differential Equations (CLW: 7.2, 7.3) We will follow a procedure similar to the one used in the previous class We consider the unsteady vorticity transport equation, noting that the equation is non-linear. 02/28/20 Topic 3 Discretization of PDE 2 Computational Fluid Dynamics (AE/ME 339) Isaac

K. M. MAEEM Dept., UMR _ _ _ curl v v Vorticity vector: = j k x u y v

z w i Is a measure of rotational effects. 2 where is the local angular velocity of a fluid element. 02/28/20 Topic 3 Discretization of PDE 3 Computational Fluid Dynamics (AE/ME 339) Isaac K. M. MAEEM Dept., UMR For 2-D incompressible flow, the vorticity transport equation is given by

2 u v v t x y (1) 2 2 2 2 2 x y - kinematic viscosity 02/28/20 m2 s Topic 3 Discretization of PDE

4 Computational Fluid Dynamics (AE/ME 339) Isaac K. M. MAEEM Dept., UMR As in the case of ODE ,the partial derivatives can be discretized Using Taylor series u x h, y k u x, y h k u x, y y x 2 1 h k u x, y .................................. 2! x y 1 h k n 1 ! x y 02/28/20 n 1

u x, y Rn Topic 3 Discretization of PDE (2) 5 Computational Fluid Dynamics (AE/ME 339) Isaac K. M. MAEEM Dept., UMR n Rn O ( h k ) (3) We can expand in Taylor series for the 8 neighboring points of (i,j) using (i,j) as the central point. 02/28/20 Topic 3 Discretization of PDE 6 Computational Fluid Dynamics (AE/ME 339)

Isaac K. M. MAEEM Dept., UMR ui 1, j ui , j xu x x 2 u xx 2! ui 1, j ui , j xu x 02/28/20 x 2 2! u xx

x 3 3! x Topic 3 Discretization of PDE 3! u xxx (4) 3 u xxx (5) 7 Computational Fluid Dynamics (AE/ME 339) Isaac K. M. MAEEM Dept.,

UMR Here u 2u ux , u xx 2 x x etc. Note: all derivatives are evaluated at (i,j) Rearranging the equations yield the following finite difference formulas for the derivatives at (i,j). ui 1, j ui , j u O x x x 02/28/20 Topic 3 Discretization of PDE (6) 8 Computational Fluid Dynamics (AE/ME 339)

Isaac K. M. MAEEM Dept., UMR u ui , j ui 1, j O x x x (7) u ui 1, j ui 1, j 2 O x x 2x (8) u ui 1, j 2ui , j ui 1, j 2

O x 2 x 2 x (9) 2 02/28/20 Topic 3 Discretization of PDE 9 Computational Fluid Dynamics (AE/ME 339) Isaac K. M. MAEEM Dept., UMR Eq.(6) is known as the forward difference formula. Eq.(7) is known as the backward difference formula. Eq.(8) and (9) are known as central difference formulas. Compact notation:

u x ui , j 02/28/20 1 i , j 2 u 1 i , j 2 (10) x Topic 3 Discretization of PDE 10 Computational Fluid Dynamics (AE/ME 339) Isaac K. M. MAEEM Dept., UMR The Heat conduction problem (ID) x

T k x x x+x x T T k k x x x x x x Consider unit area in the direction normal to x. Energy balance for a CV of cross section of area 1 and length x: Volume of CV, dV = 1 x 02/28/20 Topic 3 Discretization of PDE 11 Computational Fluid Dynamics (AE/ME 339) Isaac K. M. MAEEM Dept.,

UMR Change in temperature during time interval t, = T Increase in energy of CV : T x 1 c p t HOT t This should be equal to the net heat transfer across the two faces T k t x x 02/28/20 T T k k x t HOT x x x x x Topic 3 Discretization of PDE 12

Computational Fluid Dynamics (AE/ME 339) Isaac K. M. MAEEM Dept., UMR Equating the two and canceling t x gives T T cp k t x x Note: higher order tems (HOT) have been dropped. If we assume k=constant, we get 2 T T cp k 2 t x 02/28/20 Topic 3 Discretization of PDE

13 Computational Fluid Dynamics (AE/ME 339) Isaac K. M. MAEEM Dept., UMR 2 Or 2 T k T T 2 2 t c p x x Where k cp is the thermal diffusivity.

Letting = x/L, and = t/L2, the above equation becomes T 2T 2 02/28/20 Topic 3 Discretization of PDE 14 Computational Fluid Dynamics (AE/ME 339) Isaac K. M. MAEEM Dept., UMR The above is a Parabolic Partial Differential Equation. 2 u u 2 t x 02/28/20 Topic 3 Discretization of PDE (11)

15 Computational Fluid Dynamics (AE/ME 339) Isaac K. M. MAEEM Dept., UMR Physical problem A rod insulated on the sides with a given temperature distribution at time t = 0 . Rod ends are maintained at specified temperature at all time. Solution u(x,t) will provide temperature distribution along the rod At any time t > 0. u 2u 2 t x 02/28/20 0 x l , 0 t t1 Topic 3 Discretization of PDE 16 Computational Fluid Dynamics (AE/ME 339) Isaac

K. M. MAEEM Dept., UMR IC: u ( x, 0) f ( x) 0 x l (12) BC: u (0, t ) g 0 (t ) u (l , t ) g1 (t ) 02/28/20 Topic 3 Discretization of PDE 0 t t1 0 t t1 (13) 17 Computational Fluid Dynamics (AE/ME 339) Isaac

K. M. MAEEM Dept., UMR Difference Equation Solution involves establishing a network of Grid points as shown in the figure in the next slide. Grid spacing: 02/28/20 l x , M Topic 3 Discretization of PDE t1 t N 18 02/28/20 Topic 3 Discretization of PDE 19 Computational Fluid Dynamics (AE/ME 339)

Isaac K. M. MAEEM Dept., UMR M,N are integer values chosen based on required accuracy and available computational resources. Explicit form of the difference equation ui , n 1 ui ,n t Define 02/28/20 ui 1,n 2ui ,n ui 1, n x 2 (14) t 2 ( x ) Topic 3 Discretization of PDE

20 Computational Fluid Dynamics (AE/ME 339) Isaac K. M. MAEEM Dept., UMR Then ui ,n1 ui 1,n 1 2 ui ,n ui 1,n (15) Circles indicate grid points involved in space difference Crosses indicate grid points involved in time difference. 02/28/20 Topic 3 Discretization of PDE 21 Computational Fluid Dynamics (AE/ME 339) Isaac K. M. MAEEM Dept., UMR Note:

At time t=0 all values ui ,0 f xi are known (IC). In eq.(15) if all ui , n are known at time level tn, can be calculated explicitly. ui ,n1 Thus all the values at a time level (n+1) must be calculated before advancing to the next time level. Note: If all IC and BC do not match at (0,0) and (l , 0) , it should be handled in the numerical procedure. Select one or the other for the numerical calculation. There will be a small error present because of this inconsistency. 02/28/20 Topic 3 Discretization of PDE 22 Computational Fluid Dynamics (AE/ME 339) Isaac K. M. MAEEM Dept., UMR Convergence of Explicit Form. Remember that the finite difference form is an approximation.

The solution also will be an approximation. The error introduced due to only a finite number of terms in the Taylor series is known as truncation error, The solution is said to converge if x, t 0 when Error is also introduced because variables are represented by a finite number of digits in the computer.This is known as roundoff error. 0 02/28/20 Topic 3 Discretization of PDE 23 Computational Fluid Dynamics (AE/ME 339) Isaac K. M. MAEEM Dept., UMR For the explicit method, the truncation error, is O[t ] The convergence criterion for the explicit method is as follows: 1 0<

2 02/28/20 where t ( x ) 2 Topic 3 Discretization of PDE 24 Program Completed University of Missouri-Rolla Copyright 2002 Curators of University of Missouri 02/28/20 Topic 3 Discretization of PDE 25