Math I22 Sec S08N03 - Test 3
Mar 31 2008
Question 1:
^ut" fn ,F*
to
rule on four subintervals, approxi
Use,Sa,
Simpson's
v
(") [r points]
frx) =
t'r
rl"' (")
Jn
A r= V
I + st,tlrrx)
=l
+
1 L ' ' t ( o ) 1 'f ( r ) + 2 f ( z ) + 4 + ( 3 ) t
t
rl
t | +'t+ L
Notice that the PDE of Exercise 1 is the one that we encountered for density waves. It
also describes the ow of trac in a very simple model for which the speed of all vehicles is
c. In this case, the velocity eld is given by u() = c and the ow is q() = c.
Integrating the last equation with respect to t from t = 1 to t = 2 gives
2
N(2 ) N(1 ) =
1
q(X1 , t) q(X2 , t) dt.
Combining this with Equation (1), we see that
X2
X1
X2
(x, 2 ) dx
2
(x, 1 ) dx =
X1
1
q(X1 , t) q(X2 , t) dt.
(3)
This just expresses the
{7)
K) Q3712 {W rwxjé J W:
{){Xsc\
2k «v§\
.m
m
Kw UL >
{X é 1%
:3}
m. a, (gfjfgét? (E 5 c
\
km, lam-é (gain
{7 5
E >
g f f
3 f.
if A 5/
m. W W M» VVVVV
J
3.
C
\j /
l Jwa
m W2. Himaa 55 int.
GIKWL jock a (Umkk Maa! Mi mm! 2; 56%? Law 11» [A T/Z
im
case2 = pleft > ps & ps > pright;
case3 = not(case1 | case2);
Q = case1 .* min(qleft,qright) + case2 * qmax + case3 .* max(qleft,qright);
% We need to specify the flow into the stretch of road (at x=a) and
% prepend it to the vector Q. We also need to spe
3.3
Running and plotting the solution
Here is how the program is run from the command window. Also shown is a method for
plotting the solution for a specic time; in this case t = 2.5 seconds:
>godunov
>plotgodunov(2.5)
This produces the graph:
density at
Numerical Solution of Trac Flow PDEs
Maths 367: Advanced Applied and Computational Mathematics
1
Introduction
In most of our examples involving the trac ow PDEs (e.g.the green light and red light
problems) the initial data has been constant or piece-wise
% Specify the x gridpoints:
x = transpose(0:h:L);
% Initialise R as a M+1 by N+1 matrix:
R=zeros(M+1,N+1);
% Compute the first column of R:
R(:,1) = x.*exp(-x);
% Compute the first row of R:
R(1,:) = 0;
% Compute the remaining columns of R:
for j=1:N
R(2:
3r ( Wag? Mk: m £3714
s * , rzv ;( w
{ 6M: Mk: 1,: {Mg fbwwg
g' ; » \ {1 it]?
«NR I]
y Eh L «E xxx
39> 6 £119.93; Mk Ln K i k
i
E
f,
mi
a
F
xi}
2m (2m m Vi. m if} (1" (31%
170 W M7U 1;»;
GIL]
1:53) 3m air/9%
NW3 dwkiAw L (:MQ-Ekam Law W [63} >4] / wl