Maxwell Eigenmodes fail when dimensions are scaled

Firstly, a tremendous set of tools, only getting to know them but can already appreciate all the hard work that went into making them as fluent and accessible as they are and also all the effort towards educating us users – very much appreciated.

Ran into problems with example 2.4.1 Maxwell Eigenvalue Problem, modified to evaluate solutions for a pillbox cavity. It works and the eigenvalues make sense when the dimensions are around somewhere around 0.1…1. Reducing them towards GHz frequencies to O(1e-3), at some point one can see the eigenvalues get scrambled during the iteration process
So
cav = Cylinder((0,0,0),(0,0,1),0.5,0.1)
mesh = Mesh(OCCGeometry(cav).GenerateMesh(maxh=0.1))
results in
0 : [23.439197245809808, 62.9020061058114, 69.35666284239117, 136.9382664261447, 181.6975663103349, 223.83843984421023, 389.4049867476042, 587.7139139777493, 765.8340670725125, 885.3328267855106, 994.533337651803, 1173.7047754143641, 1211.3217988940162, 1561.9201475283455, 1687.481537523325]
1 : [23.295560522115707, 59.15823376912874, 59.18961747703152, 106.47233768769713, 106.67048529513677, 126.8207819975226, 167.99981709721246, 179.58147684462682, 237.90071370997242, 244.98477721236554, 293.4787373967374, 323.8834414839466, 349.1553183642872, 402.62078748608786, 512.1858750921243]
2 : [23.295355474578965, 59.140807879929326, 59.14105152118437, 106.24569491794199, 106.25178192817961, 123.0075595810028, 164.17890538842065, 165.09871425493785, 202.92129179479392, 205.1735094973602, 236.312205217233, 254.89213568331505, 290.0127394889208, 317.13923450038993, 346.3263142087147]
while
cav = Cylinder((0,0,0),(0,0,1),0.005,0.001)
mesh = Mesh(OCCGeometry(cav).GenerateMesh(maxh=0.001))
gives roughly the correct order of magnitude on the first iteration but goes rogue thereafter
0 : [187445.80251159944, 233358.27100672424, 251743.83009205185, 373309.4930534637, 397038.01574364974, 486413.9180961088, 534807.1955080605, 540688.486253479, 556010.3589091133, 591221.6358895726, 613433.8052136312, 650418.4643989062, 750547.5220161884, 791435.8367413398, 900628.1356527265]
1 : [76.2225351040987, 148.0939021383473, 466.7603980077673, 852.2139013664727, 1613.870741832458, 3314.4001590263747, 6728.399209544364, 8080.36164884383, 39835.20955284681, 61616.301020181454, 130544.50562310449, 232942.3331638795, 381645.66913799965, 515796.9428614597, 540764.532684032]
2 : [8.638080416875815e-09, 4.71094370599392e-08, 1.8844631872230872e-06, 1.219843184121517e-05, 0.0001289990125469736, 0.0011811818408735963, 0.010884949268607856, 0.022352612207865292, 4.055499347596517, 19.64207426458883, 259.10541000536386, 8871.482717293076, 117771.58299338326, 140631.09898937435, 232805.4217647853]
3 : [-1.8687573194971843e-09, -1.4391644196880576e-09, -6.964631818655394e-10, -1.5311492439334867e-11, 1.1624515911567723e-10, 3.0699277222621375e-10, 6.1516899164425e-10, 1.2336828338367263e-09, 1.6090536555773328e-09, 4.0419957590987065e-09, 1.918064262219191e-06, 0.06896521091555734, 284.8141266480088, 645.0758798490089, 232782.2376449444]
I did not expect scaling the numbers by a factor of 100 to produce such an effect.
Am I missing something obvious or does it look like a bug?

Hi Alyapin,

thank you for the nice words.

The point where the order of magnitude is coming in is the preconditioner, it is scaled for a shifted EVP with eigenvalues O(1):

apre = BilinearForm(curl(u)*curl(v)*dx + u*v*dx)

Try scaling the L2-term with the order of magnitude of the expected eigenvalues.

best, Joachim