← Back to team overview

dolfin team mailing list archive

Re: [Question #141904]: Eigenproblem for integral operator

 

Question #141904 on DOLFIN changed:
https://answers.launchpad.net/dolfin/+question/141904

Raphael Kruse gave more information on the question:
Part 2 of the code:

# Compute all eigenvalues of Q x = \lambda M x
print "Computing eigenvalues...",
eigensolver.solve(Qh,M)
print "Done"

# Extract largest (first) eigenpair

i = 0
while i < dof:
    r, c, rx, cx = eigensolver.get_eigenpair(i)
    print "%2i. eigenvalue: %g" % (i+1, r)
    i += 1
    if abs(r) < tol:
        i = dof

# Plot eigenfunction corresponding to the largest eigenvalue
r, c, rx, cx = eigensolver.get_eigenpair(2)
print "Eigenvalue corresponding to the plotted eigenfunction is: %g" \
        % r

eigfct = Function(V, rx)
plot(eigfct, title='Eigenfunction')


# Testing the eigenfunction
Qu = np.zeros( dof )  # holds all values of convolutions of q with
                                  # testfunctions
for i in range(dof):
    q_1d.y = coor[i][0]     # y runs through the coordinates of the mesh
    L = q_1d*eigfct*dx
    Qu[i] = assemble(L, mesh=mesh)

Qufct = Function(V)
Qufct.vector()[:] = np.array(Qu)

plot(Qufct, title='Qu')

interactive()

-- 
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.