Hello again, Jemma was able to point out that if I defined my eigenvectors as Functions, not mixed functions, then that works much better in terms of generating plots. em_real, em_imag = Function(Z), Function(Z) #em_real, em_imag = MixedFunctionSpace(Z, vr), MixedFunctionSpace(Z, vr) I guess the outstanding problem is how to get slepc to converge to an imaginary target. 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 Francis Poulin [fpoulin@uwaterloo.ca] Sent: Wednesday, December 07, 2016 9:46 AM To: firedrake@imperial.ac.uk Subject: Re: [firedrake] eigenvalue problems with SLEPc Hello Lawrence, Thanks for the reply. 1) Sadly no. I commented out the lines because they weren't working. If you uncomment them you will see that plotting gives an error. Traceback (most recent call last): File "basin_modes_sw.py", line 86, in <module> p = plot(eta_real) File "/home/fpoulin/software/firedrake/src/firedrake/firedrake/plot.py", line 125, in plot raise TypeError("Unexpected type") TypeError: Unexpected type 2) The version that I have posted now uses lapack and when I run that i get numbers I believe. Some zero eigenavalues but the first non-zero ones have an imaginary part of 3.14, and then they increase. The fact that lapack gives the correct answers tells me that the weak form is set up correctly. The problem is that when I use krylovschur, which is fast, specify we want a target imaginary, with value 3.14, it gives the eigenvalue with the largest magnitude. I know that these are the easiest to converge to but SLEPc should allow us to pick a target. I am not sure if the options are being set correctly. opts.setValue("eps_type", "krylovschur") opts.setValue("eps_spectrum", "target imaginary") opts.setValue("eps_tol", 1e-10) opts.setValue("spectral_shift", 3.14) 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, December 07, 2016 9:36 AM To: firedrake@imperial.ac.uk Subject: Re: [firedrake] eigenvalue problems with SLEPc Hi Francis, On 06/12/16 04:24, Francis Poulin wrote:
Hello,
Sorry for the bother but I am wondering if anyone had any advice on my problem. The code can be found at the following:
https://github.com/francispoulin/firedrakeQG/blob/master/basin_modes_sw.py
There are two problems:
1) I can't seem to plot the eigenfunctions. Maybe I didn't split them correctly? I'm not sure.
From your submitted demo, it seems that you can now plot these, is that right?
2) The eigenvalues are not at all the ones I'm looking for. I know from the fenics version that there is an eigenvalue with an imaginary part of 3.14. These might be valid but I suspect that they are very noisy and not physically interesting.
I'm not sure about that. If I run a small problem and compute all the eigenvalues using scipy.linalg.eig, the maximum value of the computed real and imaginary parts are 0.108... which agrees, I think with your firedrake and fenics code. Thanks, Lawrence _______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake