This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Homework 4 PHZ 5156 Due Thursday, October 1 1. Consider the diffusion equation in one spatial dimension, u ( x,t ) t = D 2 u ( x,t ) x 2 with boundary conditions u ( x = 0 ,t ) = u ( x = L,t ) = 0. Write a code that uses the CrankNicholson method, as discussed in class, to integrate the diffusion equation with the given boundary and initial conditions. First, convince yourself that we can write the algorithm as, 1 2 ( u n +1 j + u n j ) ( u n +1 j +1 + u n j +1 ) + 2 ( u n +1 j + u n j ) ( u n +1 j 1 + u n j 1 ) = u n j where = D t 2 x 2 , the j represent the discrete spatial step, and n represent the discrete time step. Take x j = j x for the spatial discretization, with x = L N +1 . Then the boundary conditions are u n j =0 = 0 and u n j = N +1 = 0. Write the above N linear equations as a matrix equation, Q n = U n where Q is an N N square matrix and n and U n are both column vectors with length N . Show that Q is a symmetric, tridiagonal matrix, with diagonal elements...
View
Full
Document
This note was uploaded on 08/08/2011 for the course PHZ 5156 taught by Professor Johnson,m during the Fall '08 term at University of Central Florida.
 Fall '08
 Johnson,M

Click to edit the document details