Math 610 Computing Assignment 4 Spencer Patty April 5, 2016

advertisement
Math 610 Computing Assignment 4
Spencer Patty
April 5, 2016
2D Boundary Value Problem with Dirichlet Data
Consider the elliptic boundary value problem: Find u ∈ H 1 (Ω) with Ω ⊂ R2 satisfying
−∆u + qu = f,
for x ∈ Ω
for x ∈ ∂Ω
u = g,
with q > 0 given and f ∈ L2 (Ω).
Exercise 1: 2D Laplacian with Dirichlet Data and Lower Order
Terms (50%)
Let Ω = (0, 1)2 , q = 5, boundary data g(x, y) = cos(πx) cos(πy), and right hand side f (x, y) = (5 +
2π 2 ) cos(πx) cos(πy) which has exact solution u(x, y) = cos(πx) cos(πy). Compute the L2 (Ω) and H 1 (Ω)
1
1
1
1
errors with the meshes defined by |T | ≤ 12 h2 with h = 16
, 32
, 64
, 128
. Use the linear finite element method
to compute your solution.
In addition to the table of rates, provide a log-log plot with x-axis mesh size (h) and y-axis the L2 and H 1
errors. Matlab provides a nice loglog() plotting function for doing this. Since you are using linear elements,
you should observe that the L2 norm has slope converging to 2 and the H 1 norm has slope converging to 1.
In order to set the Dirichlet values, you must make a list of boundary nodes and then you have two
options: The first is to create a smaller system which corresponds to the interior degrees of freedom where
we have moved the known values of Dirichlet boundary values to the right hand side. This is a more elegant
solution since it preserves good properties of the matrix system but it is more complicated to do.
The second and simplest approach and the one that I recommend for you to implement is to construct
the system as if there were no boundary conditions and then aftwards, loop through all of the degrees of
freedom that are specified by Dirichlet degrees of freedom and change the corresponding system matrix row
to represent the row in the identity matrix and the corresponding system rhs value to be the exact value.
Then solve the system as before, using the matlab backlash solver. This approach can be bad when we
are dealing with large systems that need the help of iterative methods to solve as it changes the condition
number of the matrix, but for us this is not an issue.
While you are doing this, you might (as an additional thought experiment but not for credit) think about
how you would implement a solution for dealing with mixed boundary conditions, ie where you have both
dirichlet and neumann data specified on different regions.
1
2D Time Dependent Parabolic Problem with Dirichlet Data
Consider the elliptic boundary value problem: Find u(t, x) ∈ C 1 [0, T ] ; H 1 (Ω) with Ω ⊂ R2 satisfying
∂u
− ∆u = f (t, x),
∂t
u(t, x) = g(t, x),
u(t, x) = u0 (x),
for x ∈ Ω and t ∈ [0, T ]
for x ∈ ∂Ω and t ∈ [0, T ]
for x ∈ Ω and t = 0
with f (t, x) ∈ C 0 [0, T ] ; L2 (Ω) .
Exercise 2: 2D Parabolic problem (30%)
Choose Ω = (0, 1)2 and T = 3 (ie 0 ≤ t ≤ 3). Calculate the right hand side and Dirichlet boundary data so
that the exact solution is
u(t, x) = te−t sin(4πx) sin(πy).
(1)
and initial condition u0 (x) = 0. Calculate the L2 and H 1 error norms of u(tn , x) − unh (t, x) for tn = 1 and
tn = 3. Present the convergence table and the log-log error plots for each of these two times.
Solve the given problem by using linear in space finite elements and using both explicit and implicit
1
Euler time stepping schemes with uniform time step ∆t. Consider meshes defined by |T | ≤ 21 h2 with h = 16
,
1
1
1
1
1
1
1
,
,
.
For
implicit
Euler
time
steps,
use
corresponding
time
steps
∆t
=
,
,
and
.
For
32 64 128
32 64 128
256
explicit Euler, use time steps that give stability and then also use time steps so that the scheme is not
stable. Report the time step sizes used in both explicit time stepping cases. Thus there are a total of three
approaches that must be logged (one implicit time step and two explicit time step) with their corresponding
tables of convergence and error plots.
Exercise 3: 2D Parabolic problem (20%)
Now compute the solution with Ω = [−1, 1]2 \(−1, 0)2 , the L-shaped domain from Lab 02. Let the right hand
side f (t, x) = 1 , the initial solution u0 (x) = 0 and the boundary Dirichlet data g(t, x) = 0 on ∂Ω on time
interval [0,3] (ie T=3). Plot the solutions at times t = 1 and t = 3. Consider meshes defined by |T | ≤ 12 h2
1
1
1
1
1
1
1
, 32
, 64
. For implicit Euler time steps, use corresponding time steps ∆t = 16
, 32
, 64
and 128
.
with h = 81 , 16
For explicit Euler, use time steps that give stability and then also use time steps so that the scheme is not
stable. Report the time step sizes used in both explicit time stepping cases.
Remark. Note that the steady state shape for this case (ie the one that you get as t → ∞) is the solution to
the Laplacian equation
−∆u = 1,
x∈Ω
x ∈ ∂Ω
u = 0,
You time solution should be tending toward this shape which you could easily produce as in exercise 1. You
do not need to do this but it is an interesting experiment.
2
Download