PETSc crashes for more than one process

Hello,

I have run into unexpected trouble with the following SLEPc code :

fiber-SLEPc.edp (4.5 KB)

which is a modification of the eigenvalue problems :

schrodinger-harmonic-oscillator-1d-SLEPc.edp
schrodinger-harmonic-oscillator-2d-SLEPc.edp

the code runs correctly for :

ff-mpirun -np 1 fiber-SLEPc.edp -lx 100 -ly 50

but crashes for
ff-mpirun -np 2 fiber-SLEPc.edp -lx 100 -ly 50

— global mesh of 4364 elements (prior to refinement) partitioned with metis --metisA: 2-way Edge-Cut: 3, Balance: 1.00 Nodal=0/Dual 1
(in 7.626669e-03)
— partition of unity built (in 2.123956e-02)
double free or corruption (out)
[meso-pl7524:1176801] *** Process received signal ***
[meso-pl7524:1176801] Signal: Aborted (6)
[meso-pl7524:1176801] Signal code: (-6)
[meso-pl7524:1176801] [ 0] /lib/x86_64-linux-gnu/libpthread.so.0(+0x14420)[0x7f3c5b743420]

except for a difference in geometry, the code is identical to the Schrodinger code which runs without crashing so I am not sure what goes wrong.

Thanks a lot for your suggestions,
Alexei

the mistake was to have
{
mesh Th=buildmesh( D1(Lx) + D2(Ly) );
}
instead of
{
Th=buildmesh( D1(Lx) + D2(Ly) );
}
overshadowing the global mesh variable

That’s subtle, good catch!