Parabolic Partial Differential Equations http://numericalmethods.eng.usf.edu Transforming Numerical Methods Education for STEM Undergraduates 4/9/2015 http://numericalmethods.eng.usf.edu 1 Defining Parabolic PDE’s The general form for a second order linear PDE with two independent variables and one dependent variable is 2u 2u 2u A 2 B C 2 D 0 x xy y Recall the criteria for an equation of this type to be considered parabolic B 2 4 AC 0 For example, examine the heat-conduction equation given by 2T T 2 t x , where A , B 0, C 0, D 1 Then B 2 4 AC 0 4( )(0) 0 thus allowing us to classify this equation as parabolic. Physical Example of an Elliptic PDE The internal temperature of a metal rod exposed to two different temperatures at each end can be found using the heat conduction equation. T T 2 t x 2 Discretizing the Parabolic PDE x x x i 1 i i 1 Schematic diagram showing interior nodes For a rod of length L divided into n 1 nodes x L n The time is similarly broken into time steps of t Hence Ti j corresponds to the temperature at node i x i x and time t j t ,that is, The Explicit Method x i 1 If we define x x x L n i 1 i we can then write the finite central divided difference approximation of the left hand side at a general interior node ( i ) as 2T 2 x i, j Ti j1 2Ti j Ti j1 x 2 where ( j ) is the node number along the time. The Explicit Method x x x i 1 i i 1 The time derivative on the right hand side is approximated by the forward divided difference method as, T t i, j Ti j 1 Ti j t The Explicit Method Substituting these approximations into the governing equation yields Ti j1 2Ti j Ti j1 x2 Ti j 1 Ti j t Solving for the temp at the time node j 1 gives Ti j 1 Ti j choosing, t j j j T 2 T T i 1 i i 1 (x) 2 t (x) 2 we can write the equation as, Ti j 1 Ti T 2Ti T j j i 1 j j i 1 . The Explicit Method j 1 j j j j Ti Ti Ti1 2Ti Ti1 •This equation can be solved explicitly because it can be written for each internal location node of the rod for time node j 1 in terms of the temperature at time node j . •In other words, if we know the temperature at node j 0 , and the boundary temperatures, we can find the temperature at the next time step. •We continue the process by first finding the temperature at all nodes j 1 , and using these to find the temperature at the next time node, j 2 .This process continues until we reach the time at which we are interested in finding the temperature. Example 1: Explicit Method Consider a steel rod that is subjected to a temperature of 100 C on the left end and 25 C on the right end. If the rod is of length 0.05 m ,use the explicit method to find the temperature distribution in the rod from t 0 and t 9 seconds. Use x 0.01m , t 3s . Given: k 54 J W kg , 7800 3 , C 490 kg K mK m The initial temperature of the rod is 20 C . i0 1 2 T 100 C 3 4 5 T 25 C 0.01m Example 1: Explicit Method Recall, Number of time steps, t final t initial t k C therefore, 54 7800 490 3. 1.4129105 m2 / s. Then, x 2 0.4239 . Boundary Conditions T0 j 100C for all j 0,1,2,3 j T5 25C t 1.4129 105 90 3 3 0.01 2 All internal nodes are at 20 C for t 0 sec . This can be represented as, Ti 0 20C, for all i 1,2,3,4 Example 1: Explicit Method Nodal temperatures when t 0 sec , j 0: T00 100C T10 20C T20 20C Interiornodes T30 20C T40 20C T50 25C We can now calculate the temperature at each node explicitly using the equation formulated earlier, Ti j 1 Ti T 2Ti T j j i 1 j j i 1 Example 1: Explicit Method Nodal temperatures when t 3 sec (Example Calculations) i0 T01 100C Boundary Condition setting i 1 j0 T11 T10 T20 2T10 T00 20 0.423920 2(20) 100 i2 20 0.423980 T21 T20 T30 2T20 T10 20 0.423920 2(20) 20 20 0.42390 20 33.912 20 0 53.912C 20C Nodal temperatures when t 3 sec , j 1 : T01 100C Boundary Condition T11 53.912C T21 20C Interiornodes 1 T3 20C T41 22.120C T51 25C Boundary Condition Example 1: Explicit Method Nodal temperatures when t 6 sec (Example Calculations) i0 T02 100C Boundary Condition setting i 1 j 1 , i 2 T22 T21 T31 2T21 T11 53.912 0.423920 2(53.912) 100 20 0.423920 2(20) 53.912 53.912 0.423912.176 20 0.423933.912 T12 T11 T21 2T11 T01 53.912 5.1614 20 14.375 59.073C 34.375C Nodal temperatures when t 6 sec , j 2: T02 100C Boundary Condition T12 59.073C T22 34.375C Interiornodes 2 T3 20.889C T42 22.442C T52 25C Boundary Condition Example 1: Explicit Method Nodal temperatures when t 9 sec (Example Calculations) i0 i 1 T03 100C Boundary Condition setting j 2 , T13 T12 T22 2T12 T02 59.073 0.423934.375 2(59.073) 100 59.073 0.423916.229 i2 T23 T22 T32 2T22 T12 34.375 0.423920.899 2(34.375) 59.073 34.375 0.423911.222 59.073 6.8795 34.375 4.7570 65.953C 39.132C Nodal temperatures when t 9 sec , j 3 : T03 100C BoundaryCondition T13 65.953C T23 39.132C Interiornodes 3 T3 27.266C T43 22.872C T53 25C Boundary Condition Example 1: Explicit Method To better visualize the temperature variation at different locations at different times, the temperature distribution along the length of the rod at different times is plotted below. The Implicit Method WHY: •Using the explicit method, we were able to find the temperature at each node, one equation at a time. •However, the temperature at a specific node was only dependent on the temperature of the neighboring nodes from the previous time step. This is contrary to what we expect from the physical problem. •The implicit method allows us to solve this and other problems by developing a system of simultaneous linear equations for the temperature at all interior nodes at a particular time. The Implicit Method T T 2 t x 2 The second derivative on the left hand side of the equation is approximated by the CDD scheme at time level j 1 at node (i ) as 2T x 2 i , j 1 Ti j11 2Ti j 1 Ti j11 x 2 The Implicit Method T T 2 t x 2 The first derivative on the right hand side of the equation is approximated by the BDD scheme at time level j 1 at node ( i ) as j 1 j i i T t i , j 1 T T t The Implicit Method T T 2 t x 2 Substituting these approximations into the heat conduction equation yields Ti j11 2Ti j 1 Ti j11 x 2 Ti j 1 Ti j t The Implicit Method From the previous slide, Ti j11 2Ti j 1 Ti j11 x2 Ti j 1 Ti j t Rearranging yields Ti j11 (1 2)Ti j 1 Ti j11 Ti j given that, t x 2 The rearranged equation can be written for every node during each time step. These equations can then be solved as a simultaneous system of linear equations to find the nodal temperatures at a particular time. Example 2: Implicit Method Consider a steel rod that is subjected to a temperature of 100 C on the left end and 25 C on the right end. If the rod is of length 0.05 m ,use the implicit method to find the temperature distribution in the rod from t 0 and t 9 seconds. Use x 0.01m , t 3s . Given: k 54 J W kg , 7800 3 , C 490 kg K mK m The initial temperature of the rod is 20 C . i0 1 2 T 100 C 3 4 5 T 25 C 0.01m Example 2: Implicit Method Recall, Number of time steps, t final t initial t k C therefore, 54 7800 490 3. 1.4129105 m2 / s. Then, x 2 0.4239 . Boundary Conditions T0 j 100C for all j 0,1,2,3 j T5 25C t 1.4129 105 90 3 3 0.01 2 All internal nodes are at 20 C for t 0 sec . This can be represented as, Ti 0 20C, for all i 1,2,3,4 Example 2: Implicit Method Nodal temperatures when t 0 sec , j 0: T00 100C T10 20C T20 20C Interiornodes T30 20C T40 20C T50 25C We can now form our system of equations for the first time step by writing the approximated heat conduction equation for each node. T j 1 i 1 (1 2)Ti j 1 T j 1 i 1 Ti j Example 2: Implicit Method Nodal temperatures when t 3 sec , i0 T 100C Boundary Condition i 1 T01 (1 2 )T11 T21 T10 (Example Calculations) 1 0 For the interior nodes setting j 0 and i 1, 2, 3, 4 gives the following, (0.4239100) (1 2 0.4239)T11 (0.4239T21 ) 20 42.39 1.8478T11 0.4239T21 20 1.8478T11 0.4239T21 62.390 i2 T11 (1 2 )T21 T31 T20 0.4239T11 1.8478T21 0.4239T31 20 For the first time step we can write four such equations with four unknowns, expressing them in matrix form yields 0 0 1.8478 0.4239 T11 62.390 0.4239 1.8478 0.4239 1 20 0 T2 1 0 0.4239 1.8478 0.4239 T3 20 1 0 0 0 . 4239 1 . 8478 30 . 598 T 4 Example 2: Implicit Method 0 0 1.8478 0.4239 T11 62.390 0.4239 1.8478 0.4239 1 20 0 T2 1 0 0.4239 1.8478 0.4239 T3 20 1 0 0 0 . 4239 1 . 8478 30 . 598 T 4 The above coefficient matrix is tri-diagonal. Special algorithms such as Thomas’ algorithm can be used to solve simultaneous linear equation with tri-diagonal coefficient matrices.The solution is given by T11 39.451 1 24 . 792 T 2 1 T3 21.438 1 T4 21.477 Hence, the nodal temps at t 3 sec are T01 100 1 39 . 451 T 1 1 T2 24.792 1 21 . 438 T 3 T 1 21.477 41 25 T 5 Example 2: Implicit Method Nodal temperatures when t 6 sec , i0 (Example Calculations) T 100C Boundary Condition 2 0 For the interior nodes setting j 1 and i 1, 2, 3, 4 gives the following, i 1 T02 (1 2 )T12 T22 T11 (0.4239 100) (1 2 0.4239)T12 0.4239T22 39.451 42.39 1.8478T12 0.4239T22 39.451 1.8478T12 0.4239T22 81.841 i2 T12 (1 2 )T22 T32 T21 0.4239T12 1.8478T22 0.4239T32 24.792 For the second time step we can write four such equations with four unknowns, expressing them in matrix form yields 0 0 1.8478 0.4239 T12 81.841 0.4239 1.8478 0.4239 2 24.792 0 T2 0 0.4239 1.8478 0.4239 T32 21.438 2 0 0 0 . 4239 1 . 8478 32 . 075 T4 Example 2: Implicit Method 0 0 1.8478 0.4239 T12 81.841 0.4239 1.8478 0.4239 2 24.792 0 T2 2 0 0.4239 1.8478 0.4239 T3 21.438 2 0 0 0 . 4239 1 . 8478 32 . 075 T 4 The above coefficient matrix is tri-diagonal. Special algorithms such as Thomas’ algorithm can be used to solve simultaneous linear equation with tri-diagonal coefficient matrices.The solution is given by T12 51.326 2 30 . 669 T 2 2 T3 23.876 2 T4 22.836 Hence, the nodal temps at t 6 sec are T02 100 2 51 . 326 T 1 2 T2 30.669 2 23 . 876 T3 T 2 22.836 42 T5 25 Example 2: Implicit Method Nodal temperatures when t 9 sec , i0 (Example Calculations) T 100C Boundary Condition 3 0 For the interior nodes setting j 2 and i 1, 2, 3, 4 gives the following, i 1 T03 (1 2 )T13 T23 T12 (0.4239 100) (1 2 0.4239)T13 (0.4239T23 ) 51.326 42.39 1.8478T13 0.4239T23 51.326 1.8478T13 0.4239T23 93.716 i2 T13 (1 2 )T23 T33 T22 0.4239T13 1.8478T23 0.4239T33 30.669 For the third time step we can write four such equations with four unknowns, expressing them in matrix form yields 0 0 1.8478 0.4239 T13 93.716 0.4239 1.8478 0.4239 3 30.669 0 T2 3 0 0.4239 1.8478 0.4239 T3 23.876 3 0 0 0 . 4239 1 . 8478 33 . 434 T 4 Example 2: Implicit Method 0 0 1.8478 0.4239 T13 93.716 0.4239 1.8478 0.4239 3 30.669 0 T2 3 0 0.4239 1.8478 0.4239 T3 23.876 3 0 0 0 . 4239 1 . 8478 33 . 434 T 4 The above coefficient matrix is tri-diagonal. Special algorithms such as Thomas’ algorithm can be used to solve simultaneous linear equation with tri-diagonal coefficient matrices.The solution is given by T13 59.043 3 36 . 292 T 2 3 T3 26.809 3 24 . 243 T 4 Hence, the nodal temps at t 9 sec are T03 100 3 59 . 043 T 1 3 T2 36.292 3 26 . 809 T 3 3 T 24.243 43 25 T5 Example 2: Implicit Method To better visualize the temperature variation at different locations at different times, the temperature distribution along the length of the rod at different times is plotted below. The Crank-Nicolson Method WHY: 2T Using the implicit method our approximation of was of x 2 accuracy, while our approximation of T t O(x) 2 was of O(t ) accuracy. The Crank-Nicolson Method One can achieve similar orders of accuracy by approximating the second derivative, on the left hand side of the heat equation, at the midpoint of the time step. Doing so yields 2T x 2 i, j Ti j1 2Ti j Ti j1 2 x 2 Ti j11 2Ti j 1 Ti j11 2 x The Crank-Nicolson Method The first derivative, on the right hand side of the heat equation, is approximated using the forward divided difference method at time level j 1 , T t i, j Ti j 1 Ti t j The Crank-Nicolson Method •Substituting these approximations into the governing equation for heat conductance yields Ti j1 2Ti j Ti j1 Ti j11 2Ti j 1 Ti j11 Ti j 1 Ti j 2 x 2 x 2 t giving Ti j11 2(1 )Ti j 1 Ti j11 Ti j1 2(1 )Ti j Ti j1 where t x 2 •Having rewritten the equation in this form allows us to descritize the physical problem. We then solve a system of simultaneous linear equations to find the temperature at every node at any point in time. Example 3: Crank-Nicolson Consider a steel rod that is subjected to a temperature of 100 C on the left end and 25 C on the right end. If the rod is of length 0.05 m ,use the CrankNicolson method to find the temperature distribution in the rod from t 0 to t 9 seconds. Use x 0.01m , t 3s . Given: k 54 J W kg , 7800 3 , C 490 kg K mK m The initial temperature of the rod is 20 C . i0 1 2 T 100 C 3 4 5 T 25 C 0.01m Example 3: Crank-Nicolson Recall, Number of time steps, t final t initial t k C therefore, 54 7800 490 3. 1.4129105 m2 / s. Then, x 2 0.4239 . Boundary Conditions T0 j 100C for all j 0,1,2,3 j T5 25C t 1.4129 105 90 3 3 0.01 2 All internal nodes are at 20 C for t 0 sec . This can be represented as, Ti 0 20C, for all i 1,2,3,4 Example 3: Crank-Nicolson Nodal temperatures when t 0 sec , j 0: T00 100C T10 20C T20 20C Interiornodes T30 20C T40 20C T50 25C We can now form our system of equations for the first time step by writing the approximated heat conduction equation for each node. Ti j11 2(1 )Ti j 1 Ti j11 Ti j1 2(1 )Ti j Ti j1 Example 3: Crank-Nicolson Nodal temperatures when t 3 sec , i0 (Example Calculations) T01 100C Boundary Condition For the interior nodes setting j 0 and i 1, 2, 3, 4 gives the following i 1 T01 2(1 )T11 T21 T00 2(1 )T10 T20 (0.4239 100) 2(1 0.4239)T11 0.4239T21 (0.4239)100 2(1 0.4239)20 (0.4239)20 42.39 2.8478T11 0.4239T21 42.39 23.044 8.478 2.8478T11 0.4239T21 116.30 For the first time step we can write four such equations with four unknowns, expressing them in matrix form yields 0 0 2.8478 0.4239 T11 116.30 0.4239 2.8478 0.4239 1 40.000 0 T2 1 0 0.4239 2.8478 0.4239 T3 40.000 1 0 0 0 . 4239 2 . 8478 52 . 718 T4 Example 3: Crank-Nicolson 0 0 2.8478 0.4239 T11 116.30 0.4239 2.8478 0.4239 1 40.000 0 T2 1 0 0.4239 2.8478 0.4239 T3 40.000 1 0 0 0 . 4239 2 . 8478 52 . 718 T 4 The above coefficient matrix is tri-diagonal. Special algorithms such as Thomas’ algorithm can be used to solve simultaneous linear equation with tri-diagonal coefficient matrices.The solution is given by T11 44.372 Hence, the nodal 1 23 . 746 T 2 temps at t 3 sec are T31 20.797 1 21 . 607 T 4 T01 100 1 44 . 372 T 1 1 T2 23.746 1 20 . 797 T 3 T 1 21.607 41 T5 25 Example 3: Crank-Nicolson Nodal temperatures when t 6 sec , i0 (Example Calculations) T02 100C Boundary Condition For the interior nodes setting j 1 and i 1, 2, 3, 4 gives the following, i 1 T02 2(1 )T12 T22 T01 2(1 )T11 T21 (0.4239 100) 2(1 0.4239)T12 0.4239T22 (0.4239)100 2(1 0.4239)44.372 (0.4239)23.746 42.39 2.8478T12 0.4239T22 42.39 51.125 10.066 2.8478T12 0.4239T22 145.971 For the second time step we can write four such equations with four unknowns, expressing them in matrix form yields 0 0 2.8478 0.4239 T12 145.971 0.4239 2.8478 0.4239 2 54.985 0 T2 2 0 0.4239 2.8478 0.4239 T3 43.187 2 0 0 0 . 4239 2 . 8478 54 . 908 T4 Example 3: Crank-Nicolson 0 0 2.8478 0.4239 T12 145.971 0.4239 2.8478 0.4239 2 54.985 0 T2 2 0 0.4239 2.8478 0.4239 T3 43.187 2 0 0 0 . 4239 2 . 8478 54 . 908 T 4 The above coefficient matrix is tri-diagonal. Special algorithms such as Thomas’ algorithm can be used to solve simultaneous linear equation with tri-diagonal coefficient matrices.The solution is given by T12 55.883 2 31 . 075 T 2 2 T3 23.174 2 22 . 730 T 4 Hence, the nodal temps at t 6 sec are T02 100 2 55 . 883 T 1 2 T2 31.075 2 T3 23.174 T 2 22.730 42 25 T 5 Example 3: Crank-Nicolson Nodal temperatures when t 9 sec , i0 (Example Calculations) T 100C Boundary Condition 3 0 For the interior nodes setting j 2 and i 1, 2, 3, 4 gives the following, i 1 T03 2(1 )T13 T23 T02 2(1 )T12 T22 (0.4239 100) 2(1 0.4239)T23 0.4239T23 (0.4239)100 2(1 0.4239)55.883 (0.4239)31.075 42.39 2.8478T13 0.4239T23 42.39 64.388 13.173 2.8478T13 0.4239T23 162.34 For the third time step we can write four such equations with four unknowns, expressing them in matrix form yields 0 0 2.8478 0.4239 T13 162.34 0.4239 2.8478 0.4239 3 69.318 0 T2 3 0 0.4239 2.8478 0.4239 T3 49.509 3 0 0 0 . 4239 2 . 8478 57 . 210 T 4 Example 3: Crank-Nicolson 0 0 2.8478 0.4239 T13 162.34 0.4239 2.8478 0.4239 3 69.318 0 T2 3 0 0.4239 2.8478 0.4239 T3 49.509 3 0 0 0 . 4239 2 . 8478 57 . 210 T 4 The above coefficient matrix is tri-diagonal. Special algorithms such as Thomas’ algorithm can be used to solve simultaneous linear equation with tri-diagonal coefficient matrices.The solution is given by T13 62.604 Hence, the nodal 3 37 . 613 T 2 temps at t 9 sec are T33 26.562 3 24 . 042 T 4 T03 100 3 T1 62.604 T23 37.613 3 26 . 562 T 3 3 T 24.042 43 T5 25 Example 3: Crank-Nicolson To better visualize the temperature variation at different locations at different times, the temperature distribution along the length of the rod at different times is plotted below. Internal Temperatures at 9 sec. The table below allows you to compare the results from all three methods discussed in juxtaposition with the analytical solution. Node Explicit Implicit CrankNicolson Analytical T13 T23 T33 T43 65.953 59.043 62.604 62.510 39.132 27.266 36.292 26.809 37.613 26.562 37.084 25.844 22.872 24.243 24.042 23.610 THE END