2
$\begingroup$

I'm using "NDEigensystem" to calculate a Sturm-Liouville problem, for which the first 100 eigenvalues are needed. The code is like this:

Needs["NDSolve`FEM`"]
a = 10*10^-3; b = 50*10^-3; s0 = 12*10^6; omega = 
 2*10^5*Pi; mu0 = 4*10^-7*Pi; mur = 1;
sm = s0;
sa = 0;
mum = mur*mu0;
mua = mu0;
s = 
  With[{sm = sm, sa = sa}, 
   If[0 <= r <= a, sm, sa]];
mu = With[{mum = mum, mua = mua}, 
   If[0 <= r <= a, mum, mua]];
L = F''[r] + F'[r]/r - (1/r^2 + I*omega*s*mu)*F[r];
B = DirichletCondition[F[r] == 0, True];
{vals, funs} = 
  NDEigensystem[{L, B}, F[r], {r, 0, b}, 100 (*100 eigenvalues*), 
   Method -> {"PDEDiscretization" -> {"FiniteElement", 
       "MeshOptions" -> {"MaxCellMeasure" -> 0.00001, 
         "MaxBoundaryCellMeasure" -> 0.000001, "MeshOrder" -> 2}}}];
Sort[(-vals)^(1/2), Re@#1 < Re@#2 &] (*Sorting the eigenvalues with ascending order of the real part*)

Reasonable results can be obtained by this code, but Mathematica gave a warning: "Eigensystem::maxit2: Warning: maximum number of iterations, 1000, has been reached by the Arnoldi algorithm without convergence to the specified tolerance, but the current best computed value has been returned. You can use method options with Method -> {Arnoldi, opts} to increase the size of basis vectors, the maximum number of iterations, reduce the tolerance, or use an estimate as a shift, any of which may help."

I think the accuracy of the eigenvalues cannot be assured owing to the occurrence of this warning.

And this warning occurs only when the number of eigenvalues is relatively large (e.g. 100). So my question is how to set the option "Method -> {Arnoldi, opts}" in the NDEigensystem?

$\endgroup$
4
$\begingroup$

The documentation has examples of how to set the options for the solver. This works:

a = 10*10^-3; b = 50*10^-3; s0 = 12*10^6; omega = 2*10^5*Pi; mu0 = 
 4*10^-7*Pi; mur = 1;
sm = s0;
sa = 0;
mum = mur*mu0;
mua = mu0;
s = With[{sm = sm, sa = sa}, If[0 <= r <= a, sm, sa]];
mu = With[{mum = mum, mua = mua}, If[0 <= r <= a, mum, mua]];
L = F''[r] + F'[r]/r - (1/r^2 + I*omega*s*mu)*F[r];
B = DirichletCondition[F[r] == 0, True];
{vals, funs} = 
  NDEigensystem[{L, B}, F[r], {r, 0, b}, 100 (*100 eigenvalues*), 
   Method -> {
     "Eigensystem" -> {"Arnoldi", "MaxIterations" -> 2000},
     "PDEDiscretization" -> {"FiniteElement", 
       "MeshOptions" -> {"MaxCellMeasure" -> 0.00001}}}];
Sort[(-vals)^(1/2), Re@#1 < Re@#2 &]
$\endgroup$
  • 1
    $\begingroup$ I added a link to the relevant section of the documentation, hope that's ok. $\endgroup$ – Carl Woll May 8 at 16:39
  • $\begingroup$ @CarlWoll, absolutely! Thanks for the effort. Much appreciate it. $\endgroup$ – user21 May 8 at 16:50
  • $\begingroup$ Many thanks for this helpful answer! It is really heuristic. $\endgroup$ – Otto SturmGeschütz May 9 at 13:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.