Teoretisk Fysik KTH Hand-in Problem, 5A1305, autumn 2006 (D)1

advertisement
Teoretisk Fysik KTH
Hand-in Problem, 5A1305, autumn 2006 (D)1
Hand in your solution before November 24, 13.00h, in a box outside the “studentexpedition”.2 After that check the course homepage regularly for further instructions: expect to be called for an oral presentation of your solution or to be asked to do corrections/completions. We expect the results to be available by Dec. 5.
The problem: Consider the stationary temperature in a rectangular plate which is
isolated on the plane upper- and lower sides so that the temperature u(x, y) only depends
on 0 ≤ x ≤ 3, 0 ≤ y ≤ 2 (in some length units). The plate is inhomogeneous, i.e., the
heat conductivity K(x, y) is position dependent, and it is heated by a stationary heat
source ρ(x, y). The temperatures is fixed at the boundaries.
More specifically, we assume that the temperature u(x, y) is determined by the following
differential equation:
∇ · (K(x, y)∇u(x, y)) = −ρ(x, y)
together with the boundary conditions
u(x, 0) = 0,
u(0, y) = 0,
u(x, 2) = x(3 − x)(x − 12/7)
1
u(3, y) = (2 − |2y − 2|)
2
where | · | is the absolute value (i.e. |x| = x for x ≥ 0 and −x for x < 0). The functions
K, ρ are
5
tanh(m(2x − 3)),
6
ρ(x, y) = 25 Θ(1 − 20(2x − 3)2 − 20(2y − 2)2 )
K(x, y) = 1 +
with the Heaviside function Θ, where m is determined by your birthday m−d (=month−
day); e.g. m = 2 and if you are born on the 14th of February).
Use the finite difference method (FDM) and Liebmann’s method 3 (as described in the
pdf file available as http://courses.theophys.kth.se/5A1305/num.pdf; we refer to
this is the following as [num.pdf]) to solve this problem. Present your solution in a
concise written report which should be understandable by an average physics student
who is familiar with differential equations but does not know about numerical methods.
More detailed instructions: Write a MATLAB program to solve the mathematical
program above. Do not use any PDE-solver but write your program from
scratch! Test your program by considering two simple exactly solvable cases: as a first
test cases use
K(x, y) = 1, ρ(x, y) = 0, u(x, 0) = sin(πx/3)
u(x, 2) = u(0, y) = u(3, y) = 0,
1
Obligatorisk inlämningsuppgift, 5A1305 Fysikens matematiska metoder, ht06.
Roslagstullsbacken 21, utanför rum B5:1016
3
finita differensmetod, Liebmanns metod.
2
1
but you should also choose another case which has a simple analytical solution. Compare
the exact analytical solution with the approximate numerical solution in both cases. Try
out different values for the number of nodes (= lattice points) to find suitable values.
Check always that your iteration has converged. A good measure for how much your
numerical and analytical solutions differ is the ratio of the lattice sums (i.e. the Riemann
sum approximating the integral) of [unumeric (x, y) − uanalytic (x, y)]2 and uanalytic (x, y)2 .
Your report should contain the following:
• A self-contained presentation of the problem.
• A detailed description of the method and a derivation of the equation system which
you use to numerically solve the problem. Describe explicitly how the boundary
conditions are taken into account.
• Present some representative results where you compare analytical and numerical
solutions for at least two test cases, to convince the reader that your program
works and that the value for the number of nodes and number of iterations you
choose are appropriate. Include a concise derivation of the analytical solutions
you use.
• Present your solution of the problem. Your solution should contain at least the
following figures: (i) plots of u as a function of x for the fixed values y/2 =
0, 0.2, 0.4, 0.6, 0.8 and 1 (all plots in one figure) (ii) plots of u as a function of y
for the fixed values x/3 = 0, 0.2, 0.4, 0.6, 0.8, and 1, (iii) a 3D plot u as a function
of x and y.
• Include a print-out of your MATLAB code. Your MATLAB code should be documented so that fellow students of yours should be able to understand it.
Note that figures in a report should have figure captions (explaining what the
plot(s) in the figure shows) and a description of the axes (you can write the axis
labels hand). If one figure contains several plots the reader should be clearly informed
about ‘who is who’.
Your report can be in English or Swedish (we have no preference). Note that your
report should be self-contained and concise, i.e. understandable without needing
to consult a reference, and it should contain only interesting results.4 Your report should
be hand-written (except for your MATLAB code and plots, of course) — if you write it
otherwise expect to be called to an oral presentation of your solution. A report should
be clear and in full sentences. Fix your papers together and do not forget to
write your name, Email address, and personal number.
Advise: Write your report and your MATLAB program such that you will be able to
understand them even in a year. A good report is short but still contains all the relevant
information.
Remember that we might decide to ask you to demonstrate your MATLAB program and
your solution to one of us in an oral discussion: be prepared for that.
4
You will probably have to make many more plots than the ones which you hand in: we do not want
to see all your test plots.
2
Further hints
• The iteration referred to in [num.pdf] is, of course,
(n+1)
ui,j
=
h2
1 (n)
(n)
(n)
(n)
ui+1,j + ui−1,j + ui,j+1 + ui,j−1 − Fij .
4
4
(0)
for n = 0, 1, 2, . . ., where uij is your initial guess.
To check convergence monitor (i.e. compute and check) the ratio of the lattice sums
(n+1)
(n)
(n)
of (uij
− uij )2 and (uij )2 over all lattice sites: this should become sufficiently
small before you stop your iteration.
• You first have to derive a generalization of this iteration for non-constant K(x, y)
appearing in ∇ · (K∇u) = (Kux )x + (Kuy )y . As discussed in [num.pdf], one can
approximate the partial derivative ux numerically by
(∂x+ u)(x, y) =
1
(u(x + h, y) − u(x, y))
h
or
1
(u(x, y) − u(x − h, y)).
h
We advise to approximate (Kux )x by
(∂x− u)(x, y) =
1 +
(∂ (K∂x− u) + ∂x− (K∂x+ u)),
2 x
and similarly for the y-derivatives.
• You can get nice 3D plots using the MATLAB command ‘mesh’, e.g.
3
Download