Complex eigenvalues with PETSc/SLEPc

Hello!

I am trying to solve the generalised Laplace problem with mixed/robin boundary conditions. I ran a program on a single core but ran into issues with memory, so I tried using SLEPc and PETSc.

I expect complex eigenvalues, but the program in parallel is giving out real eigenvalues instead. I am a beginner in FreeFem and unsure where the problem stems from. I would really appreciate any input!
Thank you in advance.

load "msh3"
load "medit"
load "PETSc-complex"

int d = 3 ;
macro dimension()3//EOM
include "macro_ddm.idp"

// Build geometry (annulus)
real InnerRadius=1,OuterRadius=2,L=30;
border Inner(t=2*pi,0){x=InnerRadius*cos(t);y=InnerRadius*sin(t);label=0;};
border Outer(t=0,2*pi){x=OuterRadius*cos(t);y=OuterRadius*sin(t);label=1;};

// Build mesh
int nn=5;
mesh Th2=buildmesh(Outer(OuterRadius*OuterRadius*nn*nn)+Inner(InnerRadius*InnerRadius*nn*nn));
func zminT = 0;
func zmaxT = L;
int MaxLayer = L*nn;
int[int] LabelMid=[0,1,1,2];
int[int] LabelUp = [0,0];
int[int] LabelDown = [0,3];
mesh3 Th3=buildlayers(Th2,MaxLayer,zbound=[zminT,zmaxT],labelup=LabelUp, labelmid=LabelMid, labeldown=LabelDown);

// Creating finite element space
func Pk = P1;
fespace Vh(Th3, Pk);
Vh<complex> u, v;
buildDmesh(Th3);	// Split mesh onto the processes	
Mat<complex> A,B;	//Initialize parallel PETSc matrices

//Parallel finite element numbering
createMat(Th3,A,Pk);
createMat(Th3,B,Pk);

macro Grad(u) [dx(u), dy(u), dz(u)] //
int a1=0.5;
varf a(u,v) = int3d(Th3) (Grad(u)' * Grad(v)) + int2d(Th3,1) (a1*1i*u*v) + int2d(Th3,2) (a1*1i*u*v) + on(0,3,u=0);
varf b(u,v) = int3d(Th3) (u*v);

//Parallel finite element assembly
A = a(Vh,Vh);
B = b(Vh,Vh);

int NrRequestedEv = 10;
complex[int] Evalues(NrRequestedEv);
Vh<complex>[int] Efunctions(NrRequestedEv);

//Parameters for the distributed eigenvalue solver
string para =	" -eps_view_values" +
			" -eps_type krylovschur" +
			" -eps_nev " + NrRequestedEv +
			" -eps_target 0" +
			" -eps_target_magnitude" +
			" -st_type sinvert"
			;

EPSSolve(A,B, vectors=Efunctions, values=Evalues, sparams = para) ;

If you do ff-mpirun -n 1 test.edp -eps_view_mat0 -eps_view_mat1 -v 0 | grep "i)", you’ll see that both A and B are real. So the eigenvalues are real. There is something wrong with your boundary conditions.

Thank you for your response! I noticed a stupid mistake of mine … int a1 = 0.5;