Hi, everybody. I am a newer to fenics, so anyone's help will be greatful !
Run the below code, I got an error like this:
Error: Unable to extract eigenvalue from SLEPc eigenvalue solver.
*** Reason: Requested eigenvalue (0) has not been computed.
*** Where: This error was encountered inside SLEPcEigenSolver.cpp.
*** Process: 0
*** DOLFIN version: 2016.2.0
*** Git changeset: unknown
The source code is below,
from fenics import *
mesh = UnitCubeMesh(10, 10, 10)
cell = "tetrahedron"
P0 = FiniteElement('DG',cell,0)
P1 = FiniteElement('P',cell,1)
P3_vec = VectorElement('P',cell,1)
Nedelec_1st = FiniteElement('N1curl',cell,1)
element=MixedElement([P0,P1,P1,P3_vec,Nedelec_1st,P1])
V=FunctionSpace(mesh,element)
z,v,q,eta,deta,s=TestFunctions(V)
y,u,p,zeta,gamma,r=TrialFunctions(V)
# define the 2 bilinear forms
alpha=Constant(1.3)
beta=Constant(1.5)
a = y*z*dx-inner(grad(r),grad(v))*dx+inner(gamma,grad(q))*dx+\
alpha*div(zeta)*div(eta)*dx+inner(curl(zeta),curl(eta))*dx+inner(curl(gamma),curl(eta))*dx+\
inner(grad(r),eta)*dx+inner(grad(p),deta)*dx+\
inner(curl(zeta),curl(deta))*dx-inner(grad(u),grad(s))*dx+\
inner(zeta,grad(s))*dx
b=beta*u*z*dx-alpha*(y+div(zeta))*v*dx+inner(grad(alpha*beta*u),eta)*dx
# forming the eigenvalue problem
A=PETScMatrix()
B=PETScMatrix()
assemble(a, tensor=A)
assemble(b, tensor=B)
# define a solver of general eigenvalue problem
solver = SLEPcEigenSolver(A, B)
solver.parameters["spectrum"] = "largest magnitude"
solver.parameters['solver'] = "power"
print solver.parameters.str(True)
print("begin...................................")
solver.solve(10)
print('the number of converged eigenvalues is :', solver.get_number_converged())
for i in range(10):
r,c = solver.get_eigenvalue(i)
print r,c
print("end.....................................")