I am trying to solve the eigenvalue problem of a 1st-order ODE system using NDEigenvalue. It should be finite difference method for ODE. And I want to tune the the DifferenceOrder and also the number of mesh points.
The relevant option I found in NDEigenvalue seems to be PDEDiscretization that probably descretizes the spatial part and in my case there's only a spatial part. After some searching, I still cannot find the correct way to set the DifferenceOrder and the number of mesh points.
The following is my stupid try (the particular ODE maybe not so important for this question?)
eps0 = 1*^-10; points = 500;
f[R_, r_] := Exp[r/R] - 1(*Tan[π/2r/R]*);
m0[R_, r_] := 1.0/R f[R, r]; A[l_, B_, r_] := l/r + B/2 r;
Fop1[y_, l_, pm_] := I (-D[y, r] + pm A[l, B, r] y);
variables = {α, β, γ, δ};
lhs = {Fop1[δ[r], l + 1, -1] + kz γ[r] +
m0[R, r] α[r],
Fop1[γ[r], l, 1] - kz δ[r] + m0[R, r] β[r],
Fop1[β[r], l + 1, -1] + kz α[r] -
m0[R, r] γ[r],
Fop1[α[r], l, 1] - kz β[r] - m0[R, r] δ[r]};
bc = DirichletCondition[
Table[component@r == 0, {component, variables}], True]
l = -2; R = 2; B = 20; kz = 2; Rcutoff =
1.0 Min[6 R, 16/Sqrt[B]]; Nless = 50;
Re@NDEigenvalues[{lhs, bc}, variables, {r, eps0, Rcutoff}, Nless,
Method -> {"PDEDiscretization" -> {"MethodOfLines",
"SpatialDiscretization" -> {"TensorProductGrid",
"MaxPoints" -> points, "MinPoints" -> points,
"DifferenceOrder" -> 2}}}]
NDEigensystem. This is shown here. – user21 Apr 13 '18 at 05:44NDEigenvaluesuses difference order 2 in FEM sense. Hmm,,, It gives the same pattern asDifferenceOrder4 in the FDM based on your code (theDifferenceOrderdependent problem I mentioned previously). Probably I will post a separate question simply addressing this strange problem itself. – xiaohuamao Apr 13 '18 at 09:11