Due Tuesday, November 23 nd, 12:00 midnight This challenging but very rewarding homework is considering the finite element analysis of advection-diffusion and incompressible fluid flow problems. Problem 1 can be addressed by modifying the 1DBVP MatLab programs to include SUPG stabilization. Problems 2 and 3 need the FEM libraries provided here that are based on a stabilized second-order fractional-step method FEM implementation for the solution of incompressible unsteady Navier-Stokes equations (read the provided Readme file for the theory, implementation and examples). Finally, Problem 4 requires that you modify the 2DBVP libraries for scalar fields (to include time dependence and advection terms) and couple them with the provided fluid flow libraries in order to address natural convection problems. An overall algorithm for the needed computational approach is provided. Problem 1 Advection-Diffusion problems using SUPG (streamline upwind Petrov- Galerkin) methods (MatLab) Consider a one-dimensional stationary diffusion equation: with boundary conditions as 2 d c dc u 0 2 dx dx c(0) 0, c(1) 1 a) Show that by applying classical Galerkin formulation the solution shows wiggles 2 as long as x Pe, where the Peclet number Pe is defined as u Pe. Plot the computed solution and the exact solution for h=x = 0.1, u = 1 and ε = 0.01. Repeat the calculation for number of nodes 6, 11 and 21 and 1,0.1,0.005 For each of these cases tabulate the finite element error in max-norm. b) Modify your 1DBVP and repeat the above calculation by considering an SUPG formulation. In this case, the weak form is as follows: Ne dch dch dwh dch u wh d phu d 0 dx dx dx dx k1 e k h dwh The stabilization parameter is taken as ph 2 dx where Finite Element Analysis for Mechanical & Aerospace Design Page 1 of 24
1 uh coth( ), Element Peclet Number 2 Repeat the calculation from case (a) above (h=x=0.1,u=1,=0.01) and show that the wiggles disappear. Repeat the calculation for number of nodes 6, 11 and 21 and =1, 0.1,0.005 and show the accuracy of the method is now practically O(h 2 ) for small. Analytical Solution: Since the equation is a standard ordinary differential equation, let Thus, the characteristic equation is, And the roots are: c = e rx r εr + u = 0 r 1 = 0 and r 2 = u ε The general solution now is: c = c 1 + c 2 e u ε x Applying the boundary conditions and solving for the constants c 1 and c 2, The analytical solution becomes: c 0 = c 1 + c 2 = 0 c 1 = c 1 + c 2 e u ε = 1 c 1 = 1 e u, c 2 = 1 ε 1 e u ε 1 c = eu ε x 1 e u ε 1 Derivation of the Weak Form: From the original equation, multiply by an arbitrary weight function w(x) and integrate on the domain 1 u dc w dx 0 dx Performing integration by parts on the second term, 0 1 ε d2 c w dx = 0, w in 0 < x < 1 dx2 Finite Element Analysis for Mechanical & Aerospace Design Page 2 of 24
0 1 u dc w dx dx ε dc dx w 0 1 + 0 1 ε dc dx dw dx dx = 0, w in 0 < x < 1 Since the displacements at the boundaries are defined, w(0) = w(1) = 0, and we can simplify the weak form as: 1 u dc w dx 0 dx For each element, using the approximations: 1 + ε dc dw dx dx dx = 0, w in 0 < x < 1 0 w e = w et N et, c e = N e c e, Substitution into the weak form gives: e w et 1 B et ε B e dx 0 Thus, for the MATLAB code modifications, The results are as follows: K e = c e + dw dx dc dx T = w et B et = Be c e 1 un et B e dx 0 p x = ε, q x = u, f x = 0 1 B et p(x) B e + q(x)n et B e dx 0 c e = 0 The figure shows that the FE solutions show wiggles, and these wiggles will be present as long as Δx > 2, Pe = u. Δx > 2 ε => 0.1 > 0.02. Pe ε u Finite Element Analysis for Mechanical & Aerospace Design Page 3 of 24
The following figures, however, do not have wiggles because ε is equal to 1 instead of 0.01, which means Δx > 2 is not satisfied. Pe The figure shows that FE solutions approximate the exact solutions very smoothly. no SUPG (bold - no wiggles & plain - wiggles) Element size, h ε FE error in max-norm 1/5 1 4.8033E-03 1/5 0.1 1.3338E-01 1/5 0.01 7.0425E-01 1/5 0.005 7.4919E-01 1/10 1 1.2566E-03 1/10 0.1 4.9612E-02 1/10 0.01 5.2073E-01 1/10 0.005 7.3737E-01 1/20 1 3.2167E-04 1/20 0.1 1.5743E-02 1/20 0.01 3.5048E-01 1/20 0.005 5.2684E-01 The above table displays that the finite element errors in maximum norm decrease as the element size gets smaller and ε increases to 1. b) Ω e u dc dx w + ε dc dw dx dx N e dc dω + pu dx dω = 0 k=1 p = hξ 2, ξ = coth α 1 α Ω e k & α = uh 2ε Finite Element Analysis for Mechanical & Aerospace Design Page 4 of 24
To take the stabilization parameter into account (SUPG), I have modified integrands.m extensively by adding the following code: B = felm.dn; alpha = qq(felm.x)/(n*2*pp(felm.x)); Ke = Ke + (pp(felm.x)*b'*b + qq(felm.x)*felm.n'*b+... 1/n*qq(felm.x)/2*(coth(alpha)-1/alpha)*B'*B)* felm.detjxw; fe = fe + ff(felm.x) * felm.n' * felm.detjxw; The results are as follows: Unlike previous figures, this figure does not show any wiggles after applying an SUPG formulation. The following table also lists finite element errors with SUPG formulation. SUPG Element size, h ε FE error in max-norm 1/5 1 4.8686E-03 1/5 0.1 1.6197E-01 1/5 0.01 7.7407E-01 1/5 0.005 7.8846E-01 1/10 1 1.2664E-03 1/10 0.1 5.6909E-02 1/10 0.01 6.6784E-01 1/10 0.005 7.7407E-01 1/20 1 3.2301E-04 1/20 0.1 1.7123E-02 1/20 0.01 4.4247E-01 1/20 0.005 6.6784E-01 Finite Element Analysis for Mechanical & Aerospace Design Page 5 of 24
This table shows that the finite element errors change relative to the element size for small ε. With this method, there are no wiggles anymore as shown in figures below. Problem 2 A lid-driven cavity flow (MatLab) Finite Element Analysis for Mechanical & Aerospace Design Page 6 of 24
This problem has become a standard benchmark test for incompressible flow. The fluid motion generated in a square cavity by the uniform translation of the upper surface of the cavity is a classical example of recirculating fluid flows in a confined area. From a purely computational view point, the cavity flow is an ideal prototype non-linear problem which is readily posted for numerical solution. Its geometric simplicity, comparatively minor singularity, well-defined boundary conditions and no preferred flow directions makes it very attractive as a benchmark problem for new numerical techniques. The problem definition is shown in the above figure. There is discontinuity in the boundary conditions at the two upper corners of the cavity. Here the two corner points are assumed to belong to the fixed vertical walls (non-leaky). Finally, it should be noticed that Dirichlet boundary conditions are imposed on every boundary in this example. Thus at an arbitrary point, the lower left corner of the cavity, the reference value p 0is prescribed. The problem has been studied by many investigators but probably the most detailed investigation was that of Ghia 1 et al. in which they quote many solutions and data for different Reynolds numbers. We shall use those results for comparison. The criterion for convergence to steady-state was generally taken to be No.Nodes n1 i1 4 No.Nodes n1 i1 u u u 2 n 2 1.010 In this problem, we will use a 6464 uniform mesh and take t 0.1. In the example, we have already seen the steady state solutions for Re = 100. Now repeat the calculations and compare the steady-state solutions with those of Ghia et al. for Re = 400 and 1000. (1) The streamline function, pressure and vorticity contour (2) The velocity vector plot Finite Element Analysis for Mechanical & Aerospace Design Page 7 of 24
(3) Plot u velocity along the line x 0.5, v velocity along the line y 0.5 and vorticity along moving boundary. Compare your results with that listed in Table I, II and IV of the paper Ghia 1. [1]. U. Ghia, K. N. Ghia and C. T. Shin, High-resolution for incompressible flow using the Navier-Stokes equations and multigrid method, Journal of Computational Physics. 48: 387-411, 1982. Solution: Re = 400: Finite Element Analysis for Mechanical & Aerospace Design Page 8 of 24
Re = 1000: Finite Element Analysis for Mechanical & Aerospace Design Page 9 of 24
Finite Element Analysis for Mechanical & Aerospace Design Page 10 of 24
Problem 3 Unsteady flow past a circular cylinder at Reynolds number 100 (MatLab) Simulation of flow past a circular cylinder is one of the most challenging problems in CFD as unlike other typical numerical tests all the terms in the governing equations are significant in this case. The problem consists of a circular cylinder immersed in a flowing viscous fluid. At Reynolds number below about 40, a pair of symmetrical eddies forms on the downstream side of the cylinder. At higher Reynolds numbers, the symmetrical eddies become unstable and periodic vortex shedding occurs. The eddies are transported downstream, resulting in the well-known Karman vortex street. A Reynolds number of 100 is considered to be the standard for testing FEM algorithms on the cylinder problem. It is high enough for vortex shedding to occur, but low enough that the boundary layers can be easily resolved. The domain and the boundary conditions are shown in the figure. The inlet flow is uniform and the cylinder is placed at the centerline between two slip walls. The distance from the inlet and slip walls to the center of the cylinder are 4.5. A no-slip condition is applied on the cylinder surface. In order to simulate the outflow condition, we take p 0at the outflow (right) boundary. Take time step as 0.05. The initial condition is that of zero velocity. Initially, a pair of symmetric attached eddies grew behind the cylinder and the flow reach a steady state. At this state, the flow has not developed fully yet, and the flow appears symmetric, with twin vortices forming behind the cylinder. As time progresses, the flow becomes asymmetric and periodic vortex shedding over the cylinder is attained. In the present problem, generate your own mesh from ANSYS. Make sure your mesh is fine enough near the cylinder. Since our code is very stable, you may choose a time step t 0.05 and run the problem up to t 70. (1) Plot the time history of vertical v velocity at the mid-point of exit. Identify the steady state at t=9 and shedding period. Compute the dimensionless shedding D frequency, or Strouhal number S, where u0 1in present problem. u 0 Finite Element Analysis for Mechanical & Aerospace Design Page 11 of 24
Velocity (2) Give the velocity vector plot, pressure, vorticity and streamline contours at the steady state at t=9. Clearly identify the symmetric twin vortex behind the cylinder. (3) Give the same plots as in (2) during a half period of vortex shedding when the flow has fully developed yet, i.e. at the beginning, ¼, ½ of the period,. Clearly identify the asymmetric vortex shedding behind the cylinder. Compare your results with following two literatures or any other papers you can find: [2]. T. E. Tezduyar, S. Mittal, S. E. Ray and R. Shih, Incompressible flow computations with stabilized bilinear and linear equal-order-interpolation velocity pressure elements, Computer Methods in Applied Mechanics and Engineering 95 (1992) 221-242. [3]. R. Sampath and N. Zabaras, A diffpack implementation of the Brooks/Hughes Streamline-upwind/Petrov-Galerkin FEM formulation of the incompressible Navier- Stokes equations, Research Report MM-97-01, Cornell University, March 21. 1997 Solution: (1) The time history of vertical velocity at the midpoint of exit is: 0.3 Vertical velocity at the middel exit 0.2 0.1 0-0.1-0.2-0.3-0.4 0 10 20 30 40 50 60 70 Time Therefore, it is clear that after time t=30, the flow has fully developed. The steady state is achieve around t=9. The shedding period is about 6.Therefore, the Strouhal number is 1 S 0.1667. 6 (2) The flow achieved steady state at t=9: Finite Element Analysis for Mechanical & Aerospace Design Page 12 of 24
Finite Element Analysis for Mechanical & Aerospace Design Page 13 of 24
It is seen that, at this time, the flow has not developed fully yet, and the flow appears symmetric, with twin vortices forming behind the cylinder. (3) From the time history plot, we identify the following three times during half cycle of the period. Finite Element Analysis for Mechanical & Aerospace Design Page 14 of 24
Finite Element Analysis for Mechanical & Aerospace Design Page 15 of 24
Finite Element Analysis for Mechanical & Aerospace Design Page 16 of 24
Finite Element Analysis for Mechanical & Aerospace Design Page 17 of 24
It is seen from the result that at t = 60.5 and t = 63.5, the flow separate at the leading edge, and the vortex is detached from the cylinder. At t = 62, the growing vortex is ready to depart from the cylinder. Problem 4 Natural convection flow in a cavity (MatLab) Finite Element Analysis for Mechanical & Aerospace Design Page 18 of 24
To illustrate the use of the flow in another incompressible flow problem, we shall describe the splitting-up approximate solution of unsteady natural convection problems. Such problems involve a coupling between the Navier-Stokes equations describing the fluid motion and the thermal energy equation governing the space-time evolution of the temperature. The forces which induce natural convection are in fact spatially variable gravity forces generated by (buoyancy) density variations in the fluid due to the nonuniformity of the temperature. The dimensionless equations, in vector form, are u 2 u u p Pr u Pr RaT eg in [0, T] t u 0 in [0, T] T 2 u T T in t where Pr is the Prandtl number, Ra is the Rayleigh number and eg is the unit vector in the direction of gravity. The problem of interest here is the unit square cavity containing a viscous fluid. The walls are solid and subjected to no-slip velocity boundary conditions (zero-velocity components). One of the vertical walls is subjected to a higher temperature ( T 1) than the other vertical wall ( T 0 ). Both the top and bottom walls are assumed to be insulated (zero heat flux). The steady state solution to this problem is sought herein. In this calculation the Prandtl number is kept constant at 0.71 (air) and the problem is solved for 3 4 5 6 four different Rayleigh numbers : 10,10,10,10. Please choose a smaller time step when the Rayleigh numbers increases. (1) Develop the finite element code based on the fluid flow solver and heat solver based on the following time discretization: Finite Element Analysis for Mechanical & Aerospace Design Page 19 of 24
u n1 u dt n n n1 n1 2 n1 n u u p Pr u Pr RaT eg u n1 0 n1 n T T n1 n1 2 n1 u T T dt In other words, first solve the fluid velocity given temperature from last time step using the given fluid solver and then use the velocity at this time step to update the temperature. (2) Plot the streamlines, vorticity contours, pressure contours and isothermal lines for each case. Compare your results with those in [4]. (3) Compare the quantitative results with that of de Vahl Davis 5,6 in the following table: Ra Maximum stream function magnitude Maximum horizontal velocity Maximum vertical velocity 3 10 1.170 3.649 3.697 4 10 5.071 16.178 19.617 5 10 9.612 34.73 68.59 6 10 16.750 64.3 219.36 [4]. H. G. Choi, H. Choi and J. Y. Yoo, A fractional four-step finite element formulation of the unsteady incompressible Navier-Stokes equations using SUPG and linear equalorder element methods, Comput. Methods Appl. Mechrg, 143 (1997) 333-348. [5] G. devahl Davis, Natural convection on air in a square cavity: A benchmark numerical solution, International Journal of Numerical methods fluids, 3 (1982) 249-264. [6] P. L. Quere and T. A. DE Roquefort, Computation of natural convection in twodimensional cavities with chebyshev polynomials, Journal of Computational Physics, 57 (1985) 210-228. Solution: (2) Finite Element Analysis for Mechanical & Aerospace Design Page 20 of 24
Finite Element Analysis for Mechanical & Aerospace Design Page 21 of 24
Finite Element Analysis for Mechanical & Aerospace Design Page 22 of 24
Discussion: For Ra = 10 3 and 10 4 no distinct boundary layers can be seen. The flow at Ra = 10 4 shows the onset of a stratified core in the cavity, a behavior characteristic of higher Rayleigh number flows. At Ra = 10 5 three major changes can be seen: 1. Secondary circulation exists in the core. 2. There is a substantial temperature gradient near the vertical walls. 3. The lower and upper right corners have become much more active than the other two. Also, it is expected that the pressure field is influenced by the For high Ra the pressure becomes more uniform across the cavity, except near the corners. The vorticity plots generally show a central negative area (rotation in the direction of the main circulation) separated by a zero contour from positive vorticity regions adjacent to the walls. By Ra = Finite Element Analysis for Mechanical & Aerospace Design Page 23 of 24
10 4 there are two distinct valleys of vorticity in the central area; with increasing Ra these move apart, leaving a central area with little action. (3) The finite element solution is : Ra Maximum stream function magnitude Maximum horizontal velocity Maximum vertical velocity 3 10 1.17285 3.64601 3.70729 4 10 5.07381 16.2511 19.6964 5 10 9.60661 43.9062 68.9105 6 10 16.7319 127.767 216.763 From the table, the finite element solutions are accurate for low Rayleigh numbers. For high Rayleigh numbers, the horizontal velocity lost accuracy. This is possibly due to the lack of stabilization of the convection terms since in these cases the magnitude of the velocity is quite big. Therefore, it is possible to add SUPG onto the current algorithm to make the solution more stable. Finite Element Analysis for Mechanical & Aerospace Design Page 24 of 24