![]() |
![]() |
We present a program to compute eigenvalues and eigenvectors of the Laplace equation with homogeneous Dirichlet boundary conditions, discretized by the P1 finite element method.
#include "OFELI.h" #include "Laplace.h" using namespace OFELI; int main(int argc, char *argv[]) { IPF data(argv[1]); Mesh ms(data.getMeshFile()); int nb = data.getInteger("nb"); |
Laplace2DT3 eq(ms); EigenProblemSolver e(eq); e.run(nb); |
cout << "Nb. of iterations: " << e.getNbIter() << endl; Vect<double> v(ms); for (int i=1; i<=nb; i++) { cout << "Eigenvalue #" << i << ": " << e.getEigenValue(i) << endl; e.getEigenVector(i,v); saveField(v,ms,data.getPlotFile(i),GMSH); } return 0; } |
We give here an example of a project file.
<?xml version="1.0" encoding="ISO-8859-1" ?>
<OFELI_File>
<info>
<title>EigenMode Project</title>
<date>January 1, 2016</date>
<author>R. Touzani</author>
</info>
<Project name="eigen">
<mesh_file value="test.m" />
<parameter label="nb" value="5" />
<plot_file value="test-1.pos" />
<plot_file value="test-2.pos" />
<plot_file value="test-3.pos" />
<plot_file value="test-4.pos" />
<plot_file value="test-5.pos" />
</Project>
</OFELI_File>