This first version of our finite element solver is quite minimalistic. Its purpose to illustrate the implementation of FEM in the simplest possible form—Poisson's equation in 2D, zero Dirichlet data, linear elements on triangles—and to build a basis for future extensions.
The coding of this project will take quite a bit of work. Start early. Don't leave things for the last moment.
Chances are that the trangulation produced by your program may be slightly different from what I have shown in the transcript of the interactive session in the book. Differences arise due to the way floating point approximations are handled on various platforms.
Usually floating point approximation artifacts go unnoticed if the ultimate result of the computation is just a floating point number. However, in the case of Triangle, the ultimate outcome is a discrete structure, that is, the domain's triangulation. Even tiny floating point differences in computating platforms may result in meshes with different numbers of triangles.
Triangle's web page at http://www.cs.cmu.edu/~quake/robust.pc.html addresses this issue and offers possible remedies. In my experiments I have found that none of these avoid the floating point uncertainties entirely, so that's something that we will have to live with.
The platform-dependence of Triangle's mesh does not diminish its usefulness since it always produces a quality mesh consistent with its specifications and constraints, as advertised. Just don't assume that the meshes is unique!
Here are my test results with the square()
domain and
the command ./fem-demo 10 0.002
:
On my department's machines (32-bit Linux):
nodes = 428, edges = 1217, elems = 790 errors: L^infty = 0.00995973, L^2 = 0.00289579, energy norm = 0.168067
triangle.c
:
nodes = 431, edges = 1226, elems = 796 errors: L^infty = 0.00907222, L^2 = 0.00283523, energy norm = 0.166045
On my laptop (64-bit Linux):
nodes = 431, edges = 1226, elems = 796 errors: L^infty = 0.0103488, L^2 = 0.00290014, energy norm = 0.168413
On a Sun Solaris with the Solaris compiler:
nodes = 437, edges = 1244, elems = 808 errors: L^infty = 0.014034, L^2 = 0.00291961, energy norm = 0.168135
Programming Projects in C |