Hi everyone,
i have a question about defining the number of eigenvalues in a simple eigenvalue problem in dolfin-x.
in this code:
import numpy as np
import matplotlib.pyplot as plt
from dolfinx.plotting import plot
from mpi4py import MPI
from dolfinx import DirichletBC, Function, FunctionSpace, UnitSquareMesh, RectangleMesh
from dolfinx.fem import assemble_matrix, Form
from ufl import TrialFunction, TestFunction, grad, dx, dot
from slepc4py import SLEPc
from dolfinx.cpp.mesh import CellType
import dolfinx
from dolfinx.io import XDMFFile
from math import sqrt
from dolfinx.mesh import locate_entities_boundary
from dolfinx.fem import (apply_lifting, assemble_matrix, assemble_vector,
locate_dofs_topological, set_bc)
nev=38
mesh = RectangleMesh(
MPI.COMM_WORLD,
[np.array([0, 0, 0]), np.array([1, 1, 0])], [10, 10],
cell_type=CellType.triangle)
V = FunctionSpace(mesh, ("CG", 2))
u = TrialFunction(V)
v = TestFunction(V)
a = dot(grad(u), grad(v))*dx
A = assemble_matrix(a,[])
A.assemble()
eigensolver = SLEPc.EPS().create(MPI.COMM_WORLD)
eigensolver.setDimensions(nev)
eigensolver.setWhichEigenpairs(2)
eigensolver.setOperators(A)
eigensolver.solve()
for i in range (nev):
l = eigensolver.getEigenpair(i)
print(l.real)
there is some problems with some specific numbers.
for example for " nev = 38 " or " nev = 39 " there is this error:
---------------------------------------------------------------------------
Error Traceback (most recent call last)
<ipython-input-10-8401c9868766> in <module>
38
39 for i in range (nev):
---> 40 l = eigensolver.getEigenpair(i)
41 print(l.real)
SLEPc/EPS.pyx in slepc4py.SLEPc.EPS.getEigenpair()
Error: error code 63
[0] EPSGetEigenpair() line 411 in /usr/local/slepc/src/eps/interface/epssolve.c
[0] Argument out of range
[0] Argument 2 out of range
but for the numbers lower than 38 or more than 40 it can compute the eigenvalues and there is not any error.
so, I can not understand the reason of the error for some specific numbers.
Thanks