MTH 654/659 (Numerical Analysis) Fall 2013
Finite Element Methods for Partial Differential Equations
Links

General information
Textbook and resources
Assignments
Assignment 2:
Install and run ACF code.
It needs the files coordinates.dat elements3.dat, dirichlet.dat and neumann.dat. Also, it needs the actual Dirichlet and Neumann boundary data, as well as the load data. [Read the paper accompanying the ACF code].
Get familiar with the process of solving a new BVP using FE.
  1. Define your region Ω and create a grid Th covering it.
    1. Create the grid in one of the ways before (or some other)
      • by hand,
      • with distmesh written by Olof Persson,

        Note that distmesh sometimes has problems, so check the grid out before using it it FE

        DISTMESH uses meshdemo2d to demonstrate its features.

        To create a grid over unit square, use
        >> fd = @(p)(drectangle(p,0,1,0,1));
        >> [p,t]=distmesh2d(fd,@huniform,0.5,[-1,-1; 1,1],[0,0;0,1;1,0;1,1]);

      • with MESH2D stored at Matlab File Exchange .

        Note that MESH2D needs a fix to replace tsearch by something else, e.g., as pointed out by users ... mytesearch.m Line 68: i(j)=tsearchn([x y],t,[xi(j) yi(j)]); meshfaces.m Line 199: i = tsearchn(ph,th,p);

        MESH2D uses meshdemo to demonstrate its features.

        To create a grid over unit square, use
        >> pv = [0 0; 1 0; 1 1; 0 1];
        >> hdata = [];
        >> hdata.hmax = 0.1;
        >> mesh2d(node,[],hdata,[]);

        A more exotic region with grid:
        >> plarge = [-1 -1; 4 -1; 4 4; -1 4];
        >> pall =[plarge,pv];
        >> [pm,tm]=mesh2d(pall,[ 1 2; 2 3; 3 4; 4 1; 5 6; 6 7; 7 8; 8 5]);
    2. Note that

      MESH2D and distmesh produce a list of points p and of triangular elements t.

    3. Next, you need to write p and t in a format recognized by the FE code you will use.
      Here we use ACF code, thus we need the files coordinates.dat and elements3.dat. These are easy to create.
      You also need a list of boundary nodes so you can produce dirichlet.dat and neumann.dat.

      I wrote a piece of code mesh2acf.m to assist in this. It checks the orientation of triangles, warns if elements are degenerate, extracts boundary nodes etc., and saves p and t in an appropriate format. (The code also does uniform mesh refinement, if needed).

      mesh2acf(p,t);

    [p,t]=distmesh2d(@dpoly,@huniform,0.1,[-120 40; -100 46],pv,pv); Check for orientation of triangles and save p,t in fem2d.m format ... need to code this ...

  2. Next you need to make sure you encode the problem data (right hand side=load, and Dirichlet and/or Neumann data) correctly.

  3. Run ACF which should produce a plot of the solution.

  4. Postprocess the solution: estimate and/or compute the error.

  5. Refine the grid if error is too big ? Go to STEP 1.


Actual assignment: produce figure like that in class announcement: What is Ω ? Generate the grid. What f would you use ? What boundary conditions ?