A guide to FE lab
Purpose
To illustrate the finite element method
for the solution of Poisson type problems
What you can do
1. Create a (plane) domain in which the partial differential equation
is to be solved. The domain is specified by its boundary, which may
include
interior parts.
2. Define the data f and a of the Poisson equation - div(a grad u) = f
to be solved.
3. Define the boundary conditions to be taken into account. These are
of Robin type, of the form a n.grad u = k (g - u), where n is
the exterior unit normal to the boundary, and k and g is to be specified.
Here a n.grad u = (-n).(- a grad u) corresponds to the influx through
the boundary.
4. Compute and plot the solution u to the given Poisson equation and given boundary data.
5. View level curves and/or the flux field - a grad u.
6. View the residual error f + div (a grad u).
How to do it
1. To run FE lab, move to the directory ~kenneth/matlab, start matlab,
and type FE at the matlab prompt.
2. To define a new domain, press the "new domain" button.
3. Specify the (outer) boundary of the domain by point-clicking the
boundary curve in the counter-clockwise direction. Note that here you
have to point-click both end-points of each line segment of the
boundary! Alternatively, you may specify parts of the boundary by a
suitable
parametrization by defining "x=" and "y=" as functions of a
parameter s which runs from 0 to 1, and then press "ok".
4. To define an "inner boundary", press the "inner bdry" button and
specify the desired inner boundary curve by point-clicking or parametrizing a
clock-wise (!) inner boundary curve.
5. To modify the boundary curves, press the "modify" button and
mouse-drag the nodes to the desired positions.
6. To define and mesh the parameter domain D, press "mesh".
7. Enter the data f and a for the Poisson equation to be solved in the indicated text boxes.
8. The k and g data in the Robin boundary condition a n.grad u = k (g - u)
must be entered to each boundary segment individually by typing the k
and g data in the indicated text boxes, clicking the "apply to .." button, and then clicking at the boundary segment to which the data applies. Different data can be applied to different segments, of course.
9. To compute u, press the "solve" button.
10. To view the level curves of u and/or the flux field - a grad u,
check the indicated boxes.
11. To view the residual error f + div (a grad u) of the computed solution,
press the "residual" button.
12. To obtain a finer mesh for improved resolution press "refine" and
recompute by pressing "solve".
Example tours
A test example
Compute the solution of div(- grad u) = 1 in the unit square with boundary
conditions u=0 for x = 0 and x = 1, and n.grad u = 0 for y = 0 and y =
1. Enter the domain by pressing the "new domain" button and clicking
at (0,0) and (1,0) for the bottom side, then at (1,0) and (1,1) for the
right boundary, and so on, or by defining "x=" s and "y=" 0 and press
"ok", for the bottom side, then "x=" 1 and "y=" s and press "ok" for
the right boundary, and so on. To define and mesh the domain press "mesh".
Enter the f and a data, then the boundary data k and g. To enter the
Neuman boundary condition n.grad u = 0, type 0 in the "k=" text box,
press the "apply to .." button and click on the lower and upper
boundary segments. To enter the Dirichlet boundary condition u = 0,
type 0 in the "g=" text box, and a big number (like 1000000) in the
"k=" text box (which is a way of approximately imposing the condition
u = 0), press the "apply to .." button again and click at the left and
right boundary segments. To obtain the solution, press
"solve". Does the solution look right? Compare to Example 59.1 in the book.
Application problems
Heat transport 1
Consider a domain corresponding to a two dimensional "house" with a
base horizontal floor, vertical walls and a (two-sided) roof. Assume
that
the house is heated through a given heat flux through the floor
(depending on the temperature) by
applying the condition a n.grad u = 25 - u to the bottom
boundary. Assume further that no heat is produced inside the house,
and that heat is lost through the walls according to the condition
n.grad u = (10 - u) and through the roof according to n.grad u = .1
(10 - u), corresponding to an exterior temperature of 10 degrees. Find
the temperature distribution inside the house and plot the
corresponding level curves and heat flux. If you would like to spend
some money on improving the economy of the house, what would you do in
the first place?
Heat transport 2
Compute the heat flux from a hot water pipe in the ground. Assume the
pipe has a circular cross-section and carries water of given
temperature g. Create a domain corresponding to (part of) the
ground surrounding the pipe and up to the surface of the ground,
and compute its temperature distribution. Impose suitable
boundary conditions at the pipe boundary, at the surface of the ground
(depending on the air temperature -10 degrees, say), and in the ground
far away from the pipe. Is the ground frozen at the surface above the pipe?
Heat transport 3
Study the temperature distribution and heat flux in a domain with
different heat conductivity in different parts of the
domain, with f = 0 and suitable boundary conditions. If a is
discontinuous, what can be said about (a) u, (b) grad u, (c) -a grad u?
Potential flow around an obstacle in a channel
Enter a box domain corresponding to a section of the channel with a
"hole" inside corresponding to the obstacle. Enter data corresponding
to divergence free potential flow with velocity v = - grad u, with
boundary conditions corresponding to given inflow to the left and
outflow to the right of the channel.
Electric field
Compute the electrostatic potential and field in the air gap between
the electrodes of a sparc plug of suitable geometry. Recall that the
electric field is irrotational and divergence free in the air gap,
according to Maxwells equations, and apply suitable boundary
conditions on the two electrodes and the isolating material separating them.