Homework_5_2011

Homework_5_2011 - CS 111 - Introduction to Computational...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS 111 - Introduction to Computational Science Homework 5 Consider a domain Ω = [−1, 1] in one spatial dimension and the following linear advection equation: ∂u ∂u +c = 0, ∂t ∂x (1) where c is the velocity. We take the initial data for u to be u(x, 0) = cos(πx). In this case the exact solution at time t is given by u(x, t) = cos (π (x − ct)). 1. Using the upwind scheme, solve equation (1) with c = 1 to a final time tfinal = 2. We will assume that u is periodic in space as described in class. Take a time step restriction of t = .5 x and the number of grid points equal to 100. 2. Using the upwind scheme, solve equation (1) with c = −1 to a final time tfinal = 2. We will assume that u is periodic in space as described in class. Take a time step restriction of t = .5 x and the number of grid points equal to 100. What to turn in: (1) Your code; (2) On one figure plot the exact solution and the numerical solution at tfinal in the case where c = 1; (3) On another figure plot the exact solution and the numerical solution at tfinal in the case where c = −1. 1 ...
View Full Document

This note was uploaded on 12/29/2011 for the course CS 111 taught by Professor Staff during the Fall '08 term at UCSB.

Ask a homework question - tutors are online