Eigenvalue problems

29. Eigenvalue problems#

The Helmholtz equation (with hard boundary conditions) is singular when \(\omega^2\) is an eigenvalue of the negative Laplace operator, i.e.

\[ -\Delta u = \lambda u \]

The weak form is to find eigen pairs \((\lambda, u) \in {\mathbf R} \times H^1\) such that

\[ \int \nabla u \nabla v \, dx = \lambda \int u v \, dx \]

Finite element discretization leads to the generalized matrix eigenvalue problem

\[ A u = \lambda M u. \]
from ngsolve import *
from ngsolve.webgui import Draw

mesh = Mesh(unit_square.GenerateMesh(maxh=0.1))

fes = H1(mesh, order=3, dirichlet=".*")
u,v = fes.TnT()
a = BilinearForm(grad(u)*grad(v)*dx).Assemble()
m = BilinearForm(u*v*dx).Assemble()

Eigenvectorsare stationary points of the Rayleigh quotient

\[ \frac{\left< A u, u \right> }{ \left< M u, u \right> } \]

This characterization is used in the LOBPCG (Locally Optimal Block Preconditioned Conjugate Gradient) method.

import ngsolve.solvers

pre = a.mat.Inverse(freedofs=fes.FreeDofs())
evals, evecs = solvers.LOBPCG(a.mat, m.mat, pre=pre, num=12, maxit=20, printrates=True)

for lam in evals:
    print (lam/pi**2)
0 : [19.811240988945357, 54.33837125703231, 59.25128716058536, 128.1268173298218, 140.08299253960814, 170.82416393341532, 199.30981821142302, 322.822178323747, 356.67867106629285, 461.5903135037953, 517.387088963323, 625.7205006216205]
1 : [19.73930160325086, 49.388063501929636, 49.39964851873485, 80.26947296223783, 99.91354180553705, 101.16717245415629, 130.9479928050343, 150.73757278117577, 180.39373250563915, 199.29706697891567, 243.37890518685438, 275.0069022159231]
2 : [19.73920973610779, 49.34817916499012, 49.3482392486327, 78.97556274229082, 98.71753152603885, 98.77541632451644, 128.51404525146256, 129.49669541838634, 168.96924037508083, 173.53824643623236, 184.9648307575316, 204.3762061328141]
3 : [19.739209703758853, 49.34805057616789, 49.34805663276613, 78.95714216946544, 98.69661976740993, 98.69738490103252, 128.31140649384966, 128.3278604191589, 167.8358599192325, 168.23479011439846, 177.96647880523116, 197.80933793642444]
4 : [19.739209703752923, 49.34805036204248, 49.348056346966395, 78.95704924286488, 98.6964890154529, 98.69653276278294, 128.30635539909946, 128.30659054351088, 167.78848149696734, 167.8214223840424, 177.6866957832178, 197.43802071565617]
5 : [19.73920970375296, 49.348050361663205, 49.34805634657524, 78.95704877857003, 98.6964879939007, 98.69652648656158, 128.30613642309692, 128.30637471269003, 167.78711949677736, 167.79291728487345, 177.66540362582717, 197.4022738153613]
6 : [19.739209703752934, 49.34805036166307, 49.34805634657481, 78.95704877665463, 98.69648798064465, 98.69652639235404, 128.3061300213858, 128.3063699744857, 167.78703931305085, 167.7876279365935, 177.659370086788, 197.39974063609887]
7 : [19.739209703752937, 49.348050361663404, 49.348056346574836, 78.95704877664544, 98.6964879804717, 98.69652639140125, 128.30612985593964, 128.30636985368764, 167.78693710579938, 167.7871472800013, 177.65812005785713, 197.39944829785537]
8 : [19.739209703752937, 49.34805036166282, 49.34805634657502, 78.95704877664538, 98.69648798046995, 98.69652639139217, 128.30612985146684, 128.30636985120017, 167.78690760063927, 167.78713025283935, 177.65792227340188, 197.39942301494597]
9 : [19.739209703752934, 49.348050361662644, 49.34805634657433, 78.95704877664498, 98.69648798047007, 98.69652639139191, 128.30612985137915, 128.30636985113998, 167.7869056989142, 167.78712940540117, 177.65790629210636, 197.39942162295966]
10 : [19.73920970375293, 49.34805036166332, 49.34805634657415, 78.95704877664525, 98.69648798047052, 98.69652639139213, 128.30612985137566, 128.30636985113694, 167.78690552924817, 167.78712932947406, 177.65790471210175, 197.39942140841893]
11 : [19.739209703752916, 49.34805036166265, 49.34805634657419, 78.95704877664545, 98.69648798046985, 98.69652639139163, 128.30612985137563, 128.30636985113733, 167.78690551912104, 167.78712932501563, 177.65790457998293, 197.39942136895337]
12 : [19.739209703752916, 49.34805036166264, 49.34805634657427, 78.9570487766449, 98.69648798046977, 98.69652639139174, 128.3061298513756, 128.30636985113773, 167.78690551837164, 167.7871293246746, 177.65790456934147, 197.39942134218603]
13 : [19.739209703752923, 49.34805036166305, 49.348056346574836, 78.95704877664532, 98.69648798046964, 98.69652639139197, 128.30612985137608, 128.30636985113748, 167.78690551829624, 167.78712932463966, 177.6579045685248, 197.39942124195952]
14 : [19.739209703752923, 49.348050361662516, 49.34805634657387, 78.957048776645, 98.69648798047021, 98.6965263913922, 128.30612985137563, 128.30636985113742, 167.78690551829246, 167.7871293246379, 177.65790456847208, 197.39942073426934]
15 : [19.739209703752923, 49.348050361662615, 49.34805634657511, 78.95704877664518, 98.69648798047, 98.69652639139207, 128.3061298513754, 128.3063698511374, 167.78690551829195, 167.78712932463765, 177.6579045684665, 197.39941564251959]
16 : [19.739209703752923, 49.34805036166312, 49.348056346574296, 78.95704877664542, 98.69648798046994, 98.69652639139242, 128.3061298513754, 128.3063698511378, 167.78690551829183, 167.7871293246377, 177.65790456846597, 197.39936560565414]
17 : [19.739209703752927, 49.34805036166338, 49.34805634657608, 78.95704877664532, 98.6964879804699, 98.69652639139223, 128.30612985137597, 128.30636985113733, 167.78690551829155, 167.78712932463748, 177.6579045684663, 197.39914621800554]
18 : [19.739209703752934, 49.34805036166295, 49.348056346574786, 78.95704877664568, 98.6964879804699, 98.69652639139245, 128.30612985137537, 128.30636985113745, 167.7869055182918, 167.7871293246378, 177.65790456846705, 197.39905741746816]
19 : [19.739209703752923, 49.3480503616628, 49.348056346575, 78.95704877664512, 98.69648798046946, 98.69652639139228, 128.3061298513757, 128.306369851138, 167.786905518292, 167.78712932463728, 177.6579045684658, 197.39904702269536]
2.000000091348566
5.00000287308537
5.000003479483758
8.000021638955483
10.00004498352293
10.000048875363095
13.000128945108873
13.000153262168864
17.00036786679844
17.00039054312225
18.000509174294443
20.000705094208985
gfu = GridFunction(fes, multidim=0)
for evec in evecs:
    gfu.AddMultiDimComponent(evec)

Draw (gfu, min=-2, max=2);