Hello, Sorry that I misunderstood. Now I have a problem with "Wrong value of eps" Traceback (most recent call last): File "basin_modes_qg.py", line 45, in <module> es.solve() # solve system File "SLEPc/EPS.pyx", line 1107, in slepc4py.SLEPc.EPS.solve (src/slepc4py.SLEPc.c:28270) petsc4py.PETSc.Error: error code 1 [0] EPSSolve() line 80 in /home/fpoulin/software/firedrake/src/slepc/src/eps/interface/epssolve.c [0] EPSSetUp() line 175 in /home/fpoulin/software/firedrake/src/slepc/src/eps/interface/epssetup.c [0] EPSSetUp_KrylovSchur() line 99 in /home/fpoulin/software/firedrake/src/slepc/src/eps/impls/krylov/krylovschur/krylovschur.c [0] Wrong value of eps->which I have part of my code copied below. # Create solver es = SLEPc.EPS().create(comm=COMM_WORLD) es.setProblemType(es.ProblemType.GHEP) # Generalized eigenvalue problem es.setWhichEigenpairs(es.Which.SMALLEST_IMAGINARY) # type of eigenvalues to find es.setDimensions(num_eigenvalues) es.setOperators(petsc_a, petsc_m) # Build Operators es.solve() # solve system I presume that there is something else that i did not set up correctly? Sorry for the bother. Cheers, Francis ------------------ Francis Poulin Associate Professor Department of Applied Mathematics University of Waterloo email: fpoulin@uwaterloo.ca Web: https://uwaterloo.ca/poulin-research-group/ Telephone: +1 519 888 4567 x32637 ________________________________________ From: firedrake-bounces@imperial.ac.uk [firedrake-bounces@imperial.ac.uk] on behalf of Lawrence Mitchell [lawrence.mitchell@imperial.ac.uk] Sent: Wednesday, November 30, 2016 2:33 PM To: firedrake@imperial.ac.uk Subject: Re: [firedrake] eigenvalue problems with SLEPc On 30/11/16 19:30, Francis Poulin wrote:
Hello David,
Thanks again!
I modified your code an think I have set it up correctly.
One issue is that you define your petsc_a/m using M.handle. I don't know what that means but I presume I don't change it.
Also, since I only integrate by parts on the mass matrix I impose those Dirichlet BCs on that matrix. If I impose it on both I get an eigenvalue of 1. Not sure why but there is probably a good reason to explain that.
The good news is that it runs, the bad news is that it does not converge to any eigenvalues.
Besides that I like the setup. Seems generic enough that one can apply it to a variety of problems.
If you have any thoughts I'd be curios to hear them.
Francis
# Set up Eigenvalue Problem: QG Basin modes a = beta*phi*psi.dx(0)*dx m = -inner(grad(psi), grad(phi))*dx - F*psi*phi*dx
petsc_a = assemble(a).M.handle petsc_m = assemble(m, bcs=bc).M.handle
# Create solver es = SLEPc.EPS().create(comm=COMM_WORLD) es.ProblemType.GHEP # Generalized eigenvalue problem
You need to write: es.setProblemType(es.ProblemType.GHEP) Lawrence