Mat-1.174 Computational Partial Differential
Equations, spring 1999
13-Apr-1999
Suggestions for final projects
Various options
See here for more details.
- Suggest yourself, can also be related to Cooper's etc. stuff
- Implement some part of a FEM-solver, include some interesting applications, study errors. Partly with PDEtool/Femlab
- Study time-dependent problems (parabolic, hyperbolic). Perhaps less
implementation and more applications
- Combinations of (a subset of) the above items
Why FEM-solver - isn't it enough to have toolbox
- To learn to understand the method implement some parts of it
- Add new features. Toolbox/Femlab contains only linear basis functions,
which can be regarded as a major limitation.
- You might think of other possibilities as well like
post-proseesing tools,
tools that help understand the various FEM ingredients (FEM-learning/teaching
tools) etc.
Fem-solver for elliptic problems
Here is a slightly edited version of the "FEM-solver assignment for 1997"
including pointers to useful PDEtool tools and some codes written by
Jan v. Pfaler . We don't need to be quite so ambitious, especially
concerning the implementation. I suggest you start with a problem, like
Problem 3.16 pp. 175-176 in Celia-Grey
(These 2 pages are not needed, all is here): Write a Matlab-code for Poisson's equation given the boundary conditions of Fig. 3.15 (handouts) and
f(x,y)=0. Create the triangular mesh with PDEtool.
The flow of the program
The flow of the program should be the following.
- Define the domain and create the triangularization in pdetool .
- Define the equation somehow (you) .
- Assemble the linear system including the boundary conditions. Result should be a linear system of type Au=b.
- Solve the system using matlab sparse commands (simply
u=A\b or use pcg).
- To visualize the results create a function that evaluates the solution
on given canonical coordinates within a given triangle
(=index in matrix t). (We'll see if we
can do the rest)
Set up of the differential equation
We consider here only equations in two dimensions. Set up the
differential equation in a relatively parametrized form. For example
you may consider
div( c grad u) + d u = f
Here c,d ja f are matlab functions (R2 -> R), of type
function f=foo(x,y)
Give the names of the functions as parameters to the assemby part.
Use the feval function, to evaluate functions.
Elements
Please restrict the solver to elements based on
triangularization of the domain. This way you may work with some of
the pde-toolbox functions. Use if possible the same datastructures of
points (p), triangles (t) and boundaries (e) as created by
toolbox. Note that these can be used in passive way, in the sense that
they can be created by the pde-toolbox functions. I.e. you need not
understand all the data in (t) -matrix.
For the start, we recommed you to start with linear and quadratic
elements. See the handouts.
Rectangular elements
In spite of the above recommendation
we will give some hints on working with rectangular elements. In this case
you can't use the toolbox-data structures directly. On the other hand the
data structures are simpler. Also, you might consider using the "poi"-
"rectangular triangulation" functions.
Boundaries and boundary conditions
You may want to study the example file for boundaries
/p/edu/mat-1.174/source/boundariesex.m to see one way of defining the
boudaries.
Fix (initial) sections of the boundary name them. Give them a
parametrization (approximatively the curve length). Pdetool updates the
E-matrix accordingly automatically. It even evaluates this right if given
to initmesh.m
Write a separate file for evaluation of the boundary-conditions, pass the
relative position on that edge as a parameter. (From this the
corresponding parameter value can be computed.) The values of the function
$u$ and the orthogonal derivative $u_n$ has to be passed.
This way you deserve the maximal freedom of writing different boundary
conditions. Also many of the difficulties of the parameter passing are
circumvented.
See also pdedemo3.m demo.
Assembling the system
It is suggested that you create separate assembly functions for different
types of elements. The functions should be very alike, and thus easily
created, once one, say linear, case is done.
It is important to note that there are three different types of
basis functions, classified on their continuity properties over the
triangles:
- Elements associated with nodes
- Elements associated with sides of triangles
- Elements associated with triangles.
It is natural to consider these cases separately. (Why?)
An example: the traditional linear elements form an 'pyramid' like
element around a node. For quadratic elements a degree of freedom
corresponding to the value of function on an edge is of second kind. For
every degree of freedom the is one linear equation.
Note that the boundary nodes should be treated here as well, although, they
are releveant only in the first two cases.
Integration
Normally the calculation of the innerproducts is done analytically for a
basic element. Do this with a Maple or Mathematica (see
/p/edu/mat-1.174/ex3/elemstiff.mws ). The formulas for a
canonical triangle are then stored in a matlab file. In using them you
still have to convert the integral corresponding to the area of the
integral. The numerical integration of the linear functionals use some
appropriate Gaussian quadrature described in the handouts.
The integration of the basis elements should be done for only one type of
triangle. Use canonical coordinates (see handouts??) and transform the
results afterwards. (see codes below).
Helpful Matlab functions
I have created some matlab code for you in
/p/edu/mat-1.174/source.
If there are any suggestions for codes to be included here, please
notify me. There should be a viewing code added later.
- onboundary.m
Tests whether a node, edge or a triangle is on boundary.
- inwhichtri.m
Finds a triangle, which has the point inside it. Returns also the
canonical coordinates.
- pdeplotn.m
Plots the geometry given by pdetool with numbering. (Anybody know if this
is already implemented?)
Also following functions in the toolbox directory
file:/p/appl/math/matlab/toolbox/pde/ might turn out helpful. E.g.
- pdetrg.m
returns the area of each triangle
- pdetridi.m
Side lengths and areas of triangles
- pdesubix.m
Find indices in index vector
- pdeent.m
For a given triangle find indices of the neighbouring triangles.
This page originally created by
<Jan.von.Pfaler@hut.fi>.
Last update 13th April 1999 by
Heikki.Apiola@hut.fi