## RF cavity eigen solver

Numerical methods and mathematical models of Elmer
robnil
Posts: 19
Joined: 13 Apr 2023, 11:05
Antispam: Yes

### RF cavity eigen solver

Hi!

Is it possible to combine the eigen solver with the EM modules such as VectorHelmholtz, EMWaveSolver or WhitneyAVSolver (AV) solvers?
Essentially I would like to do something similar to what was discussed here: [viewtopic.php?t=7153] and discussed here: [https://computational-acoustics.gitlab. ... ed-part-3/], but for electromagnetics thus for RF cavities.

I created a simple case of a cylinder which have known solutions (can be found in most microwave books, e.g. Pozar) and would like to find the eigenvalues (or Modes) using Elmer. For simple forms such as rectangles and cylinders it is simple to both find and create solutions yourself, for instance see wolphram demonstartion project: [https://demonstrations.wolfram.com/Cyli ... Resonator/], but for more complex cases/geometries I hope Elmer would be a better fit!

I found this example using the WhitneyAV solver in your testcases: [https://github.com/ElmerCSC/elmerfem/bl ... n/case.sif].
But could not get it to work. I have also tried using the VectorHelmholtz solver since the helmholtz equation (eq 20.3 in the Elmer ModuleManual) naturally becomes a eigenproblem with w^2 as eigenvalue:
curl curl E = w^2 E assuming J = 0 and epsilon = mu = 1

For the AV solver I get error:
EigenSolveComplex: . Error occurred in umf4num: -1.0000000000000000

And for the Helmholtz I get error:
ERROR:: EigenSolveComplex: Unknown linear system method:

Robin
Attachments
simpleCylinderMeshed.step
case_WhitneyAV.sif
case_Helmholtz.sif
raback
Posts: 4851
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

### Re: RF cavity eigen solver

Hi

Look at test case "emwave_eigen".

There is a peculiarity in that solver due to the Coulomb gauge not being enforced. There would be ~n/4 almost zero eigenmodes where n is the number of edges. To overcome these there needs to be an offset for eigenvalues.

Funnily the transient solvers in Elmer are easier to utilize as eigensolvers. This is because there the Mu''+Du'+Ku=F system exists. For harmonic cases K is already K:=K+iw*D-w^2M and there is no easy way to go back and have the matrices individually.

-Peter
robnil
Posts: 19
Joined: 13 Apr 2023, 11:05
Antispam: Yes

### Re: RF cavity eigen solver

Thanks for suuper quick response!

Simulation Type = Transient
Timestep Intervals = 100 ! just for compiler to be happy at the moment
Timestep Sizes = 0.1
to/in Simulation section, and
Eigen System Shift = Real \$ n / 4
in Solver 1 could help?

In this case I retrieve n from Model -> summary -> Edge elements in the GUI (approx 11700).

I still get using the AV solver:
EigenSolveComplex: . Error occurred in umf4num: -1.0000000000000000

Best,
Robin
kevinarden
Posts: 2417
Joined: 25 Jan 2019, 01:28
Antispam: Yes

### Re: RF cavity eigen solver

Error occurred in umf4num: -1.0000000000000000
is out an out of RAM error, umfpack requires a lot of memory.
If you have Mumps you can try Mumps instead, if not you can try an iterative solver instead of direct.
raback
Posts: 4851
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

### Re: RF cavity eigen solver

Hi Robin,

Why not start from the test case and make one variation at a time. I meant that modules that have been coded for transient use easily lent themselves also to eigenvalues. The test case has the setting defined.

-Peter
robnil
Posts: 19
Joined: 13 Apr 2023, 11:05
Antispam: Yes

### Re: RF cavity eigen solver

Hi Peter and Kevin, thank you for your help

I tried starting the emwave_eigen test case; loading the channel.grd file in the GUI and copy pasting the sif (only changing >Mesh DB "." "channel"< to >Mesh DB "." "."<) results in the error:

EigenSolveComplex: .ERROR:: EigenSolveComplex: Error with DNAUPD, info = -9

Reading the dnuapd.f file : [https://github.com/opencollab/arpack-ng ... C/dnaupd.f] it reads that (row 274)
"= -9: Starting vector is zero.".

I tried several changes on BC and body force, but nothing worked ... any idea here?

Kevin, I tried adding the parts such as
Linear System Solver = Iterative ! Direct
Linear System Iterative Method = BiCGStab ! CG
Linear System Convergence Tolerance = 1e-5
Linear System Max Iterations = 100
BiCGstabl polynomial degree = 2
Linear System Preconditioning = ILUO
to solver 1. I mainly end up with IEEE_DIVIDE_BY_ZERO errors, which I assume is the same problem as above. Trying Mumps gave me
>>ERROR:: CheckLinearSolverOptions: MUMPS solver has not been installed.<< so I guess it is not installed. I run the windows GUI mpi version

Best,
Robin
kevinarden
Posts: 2417
Joined: 25 Jan 2019, 01:28
Antispam: Yes

### Re: RF cavity eigen solver

I ran the test case the same way you did, no errors.
robnil
Posts: 19
Joined: 13 Apr 2023, 11:05
Antispam: Yes

### Re: RF cavity eigen solver

hmm, then I probably make some very basic mistakes. I apologize for the inconvenience, but is it ok to still ask for help regarding this?

This is the files I use, and the SolverLog is the output I get, still with the DNUAPD error. At this point it is 99.9 % copy-paste so I don't really understand were it goes wrong. I must miss something very obvious ...
Attachments
SolverLog.txt
channel.grd
case.sif
kevinarden
Posts: 2417
Joined: 25 Jan 2019, 01:28
Antispam: Yes

### Re: RF cavity eigen solver

I downloaded your files, and they ran just fine. There must be something about the installation. I am assuming you are using windows.
Did you install it according the instructions in this document?
https://www.nic.funet.fi/pub/sci/physic ... dElmer.pdf
kevinarden
Posts: 2417
Joined: 25 Jan 2019, 01:28
Antispam: Yes

### Re: RF cavity eigen solver

I see your version was compiled last August, there were code updates to these solvers just 3 weeks ago. So an update to the latest may resolve it.