On 07/12/16 15:57, Shipton, Jemma wrote:
Hi Francis,
Your code doesn't assign anything to em_real and em_imag.
# Find eigenvalues an eigenvectors vr, vi = petsc_a.getVecs() for i in range(nconv): lam = es.getEigenpair(i, vr, vi) print lam eval_real.append(lam.real) eval_imag.append(lam.imag)
u_real, eta_real = em_real.split() #u_imag, eta_imag = em_imag.split()
p = plot(eta_real) p.show()
Also, em_real is a MixedFunctionSpace, not a Function. I think you want: em_real, em_imag = Function(Z), Function(Z) then you can do: for i in range(nconv): with em_real.dat.vec as vr: with em_imag.dat.vec as vi: lam = es.getEigenpair(i, vr, vi) print lam u_real, eta_real = em_real.split() plot(eta_real) Unfortunately we don't currently support plotting of vector-valued Functions (u_real) in this example. You could output them for visualisation in paraview instead: output = File("eigenmodes.pvd") u_real, eta_real = em_real.split() u_real.rename("R(u)") eta_real.rename("R(eta)") for i in range(nconv): ... output.write(u_real, eta_real, time=i) LAwrence