Tutorials for Numerical Methods for Partial Differential Equations

Lecturer: Dr. Clemens Pechstein
This tutorial will be given in english.

Time and Room: Thursday 13.45 – 15.15, T 212

pdf
TutorialDateAssignment
01 14 Oct. 2010 pdf
02 21 Oct. 2010 pdf
03 28 Oct. 2010 pdf C++ Hints
04 4 Nov. 2010 pdf results for f=2x+1 and 20 elements (to validate your program)
05 11 Nov. 2010 pdf plot hints   results (to validate your program)
06 18 Nov. 2010 pdf richardson.hh (corrected since 12.Nov 8:30)
07 25 Nov. 2010 pdf cg.hh
08 2 Dec. 2010 pdf mds.hh
09 9 Dec. 2010
10 16 Dec. 2010 pdf
11 13 Jan. 2011 pdf
12 20 Jan. 2011 pdf
13 27 Jan. 2011 pdf

In the tutorials, we study the material in the lecture in more detail, which usually helps a lot in understanding. This is done in form of homework assignments (for the Austrian students: "Kreuzerlübung" style).

About half of the homeworks are theoretical assignments that you can solve with pencil and paper. In class, you should mark which exercises you have prepared, and be ready to present your solution on the blackboard. The solution needn't be 100% perfect to put a mark, but you should show that you investigated the problem and found a solution to the best of your knowledge. For many of the problems, I will give hints anyway.

Please present for the whole audience, not only to me. I would like to have a mathematical discussion among all of us.

In the remaining 50% we will implement some of the methods from the lecture on the computer, more precisely in C++ (basic knowledge of C should be enough to attend the tutorial). This will be guided and split into small assignments. Also these homeworks will be discussed in class.

C++ examples

C++ Links / Literature

Plot hints

If you would like to plot your solution, you can output

to a file using something like

#include <fstream>
using namespace std;

...

void FileOutput (const Mesh& mesh, const Vector& u, const char* file)
{
  if (u.size() != mesh.numNodes())
    {
      cerr << "ERROR: size of vector doesn't match"
           << " with number of nodes in mesh" << endl;
      abort();
    }
  ofstream ofs;
  ofs.open (file);
  for (int i=0; i<mesh.numNodes(); ++i)
    {
      ofs << mesh.coord (i) << "\t" << u[i] << endl;
    }
  ofs.close();
}

...

FileOutput (mesh, u, "u.dat");

Then you may use Mathematica, matlab or gnuplot (there is even WGnuplot for Windows) for plotting.

Example for matlab

Call matlab and type


  data = load('u.dat');
  plot (data(:,1), data(:,2));

Example for gnuplot

Call gnuplot and type


  plot 'u.dat' using 1:2 w lp

You can also use a gnuplot script file: u.gp and type gnuplot u.gp from your shell.

link to the Lecture


top
last change: 2013-12-05