On this page a number of points of
attention will be given which might help when something is not going
the way you want it to go. These points will be split into two
categories. First a number of points concerning programming will be
given and then the more fundamental spectral subjects will be touched.
Programming
points of attention
- Make sure enough memory is allocated for every variable. How this
is done can be seen for example in the
dvector
function
in the code of
exercise1a or
in the dmatrix
function in the code of exercise3a.
- Try to enter double precision numbers in decimal notation,
sometimes rounding to integers will occur when this is not the case.
- Compilation in the way noted in the provided codes only works
when polylib.c and polylib.h are in the same directory as your code.
- Include the right files, including iostream.h, stdio.h, math.h
and polylib.h might help.
- To use the polylib library use the line:
using namespace
polylib;
- To use the
cout
function it might be necessary to
use the line: using namespace std;
- Using Lapack the right way is explained here.
- Don't forget saving before you compile.
Spectral
points of attention
- Enter the right matrix dimension, this changes with different
boundary conditions (when an element has a Dirichlet boundary on one
side, the boundary node at this side will be known and the matrix will
have size
P
instead of P+1
).
- Enter the right boundary conditions. When using for example -(pi^2+lambda)*sin(pi*x)
as forcing remember that the Neumann boundary condition at x=0
is bc(0)=pi and not bc(0)=1 (the solution is u=sin(pi*x)).
- Take care of the changes in signs when going from the projection
problem to the differential equation. You can find the weak form of the
differential equation here.
- When applying the lifting of the solution of the differential
equation, don't forget the extra factor of lambda and also
don't forget the extra term due to the Laplacian.
- When constructing the global solution and thus summing the
contributions of the different polynomials remember that at the element
boundaries (except for the first and last element) the solution at this
boundary is given by both elements, so don't sum them.
- Implementing Dirichlet boundary conditions changes the size of
the element mass matrix whereas implementing Neumann boundary
conditions doesn't.