# hw4 - Homework 4 PHZ 5156 Due Thursday, October 1 1....

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
This is the end of the preview. Sign up to access the rest of the 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 Crank-Nicholson 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.

### Page1 / 2

hw4 - Homework 4 PHZ 5156 Due Thursday, October 1 1....

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online