I try to solve the waveguide problem in a two-dimensional plane, as described in chapter 34 of the fenics book.
Blockquoteimport dx
from dolfin import *
half_cube_mesh = RectangleMesh(Point(0, 0), Point(pi, 2pi), 40, 40)
cell = triangle
ele_type = FiniteElement(‘N1curl’,cell,2)
ele_type1 = FiniteElement(‘P’,cell,2)
V_N_half_cube = FunctionSpace(half_cube_mesh,ele_type * ele_type1)
(N_i,L_i) = TestFunctions(V_N_half_cube)
(N_j,L_j) = TrialFunctions(V_N_half_cube)
s_tt = dot(curl(N_i), curl(N_j))
t_tt = dot(N_i, N_j)
s_zz = dot(grad(L_i), grad(L_j))
t_zz = L_iL_j
b_tt = dot(N_i, N_j)
b_tz = dot(N_i, grad(L_j))
b_zt = dot(grad(L_i), N_j)
a_tt = s_tt - t_tt
b_zz = s_zz - t_zz
a1 = (a_tt ) *dx
b1 =(b_zz+b_tt+b_zt+b_tz)*dx
bcs1 = [DirichletBC(V_N_half_cube, Expression((‘0.0’, ‘0.0’,‘0.0’),degree=0),
DomainBoundary())]
dummy1 = N_j[0] * dx
A = PETScMatrix()
assemble_system(a1, dummy1, bcs1, A_tensor=A)
B = PETScMatrix()
assemble_system(b1, dummy1, bcs1, A_tensor=B)
[bc.zero(B) for bc in bcs1]
solver = SLEPcEigenSolver(A, B)
solver.parameters[“solver”] = “krylov-schur”
solver.parameters[“problem_type”] = “gen_hermitian”
solver.parameters[“spectrum”] = “target magnitude”
solver.parameters[“spectral_transform”] = “shift-and-invert”
solver.parameters[“spectral_shift”] =5.0
neigs = 1
solver.solve(neigs)
q = solver.get_number_converged()
computed_eigenvalues =
for i in range(q-1):
r, c, rx, cx = solver.get_eigenpair(i)
r1, c1, rx1, cx1 = solver.get_eigenpair(0)
I get a error:
Blockquote*** Error: Unable to extract eigenpair from SLEPc eigenvalue solver.
*** Reason: Requested eigenpair (0) has not been computed.
Can you tell me where the problem is