Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Finite Difference Methods in 2d Heat Transfer V.Vuorinen Aalto University School of Engineering Heat and Mass Transfer Course, Autumn 2016 November 2nd 2016, Otaniemi [email protected] Overview • Previously you learned about 0d and 1d heat transfer problems and their numerical solution • Here we extend things into 2d (3d) cases which is straightforward • We consider the simple case of a square domain but the idea can be extended and generalized to arbitrary domains using standard CFD methods like finite volume methods or finite element methods Discretization by Finite Difference Method General form of heat equation Terms opened in 2d ∂T ∂ T ∂ ∂T ∂ = α + α ∂t ∂x ∂ x ∂ y ∂ y ∂T =∇⋅α ∇ T ∂t Time derivative in cell (i, j) at timestep n n n+1 n T i , j −T i , j ∂T ≈ ∂ t i, j Δt ( ) Second space derivatives at at cell (i,j) ∂ T ∂ x2 n 2 n 2 X: Y: ( ) ( ) ∂ T 2 ∂y n ≈ i, j n Δ x2 i, j n ≈ n T i +1, j−2 T i , j +T i−1, j n n T i , j +1−2 T i , j +T i , j−1 Δy 2 Discretization by Finite Difference Method CFL= Explicit Euler timestepping for 2d heat equation: n T n+1 i,j n i, j =T + Δ t α n n T i +1, j −2 T i , j +T i −1, j Δx 2 n +Δ t α n n T i , j+1 −2 T i , j +T i , j−1 Δ y2 Which is equal to the “delta” form: n i, j Δ T =Δ t α T n i +1, j n i, j 2 −2 T +T Δx Where: Δ T ni , j=T ni ,+1j −T ni , j n i−1, j +Δ t α T αΔ t Δ x2 n i , j+ 1 n i, j 2 −2 T + T Δy n i , j −1 Visualization of 2d Cartesian Grid x=0 x=Lx Ghost cells where y=Ly boundary conditions given. For example: Zero gradient: n n ghost i−1, j T T =T Ghost cells where boundary conditions given T ni , j +1 n ghost T n i−1, j T n i,j T This corner cell would be “idle”/useless n i+1, j Fixed temperature: T nghost =2 T target −T ni−1, j T ni , j −1 y=0 Δy Cell face center Cell center Δx Summary of the Numerical Solution Scheme for 2d Heat Equation 1) Set boundary conditions (BC's) to the ghost cells using T from step n. 2) Update new temperature at timestep n+1 in the internal cells 3) Update time according to t = t + dt 4) Go back to 1) T ni , j T n+1 i,j n i, j =T +Δ t α T ni +1, j −2 T ni , j +T in−1, j Δ x2 (Known and hence BC update possible) +Δ t α T ni , j+1 −2 T ni , j +T ni , j−1 T n+1 i,j t n+1 =t n +Δ t Δ y2 Also This Scheme is Extremely Short to Program in Matlab Program: /Examples2d/HeatDiffusion2d.m Execution: >> HeatDiffusion2d What it does: Solves 2d heat equation in Cartesian grid, various BC's possible. It is also possible to simulate materials with variable heat diffusivity to simulate conduction in e.g. “layered” materials. The “heart” of this 2d code is the computation of dT in the .m file computedT.m dT=dt*DivDiv(T,nu,east,west,north,south,inx,iny,dx,dy); - In short the “cryptic” function DivDiv.m is needed to evaluate ∇⋅α ∇ T divergence of the diffusive flux (conservatively) i.e. - The contents of the function DivDiv.m looks lengthy but it is so only to account for the fact that the code assumes diffusivity (x,y) - dependent. The function solveTemperature.m applies the 4th order Runge-Kutta method (for better stability than Euler) to evaluate dT several times and finally accumulates them together to end up in essentially the same outcome as Euler method. T new =T old + Δ T Tleft =500K Tright=293K Tleft = Ttop = 500K Tright = 293K Bottom and top walls are zero gradient keeping solution 1d Tleft =500K Bottom wall is zero gradient i.e. isolated Tright=293K Top & Bottom zero gradient Isolated area In the domain Conducting Nonconducting Thank you for your attention!