Hi,
I’m working with the dolfinx and dolfinx_mpc, in CPP interface, from the Poisson demo, I learn that we should assemble the vector as follows:
b.set(0.0);
fem::assemble_vector(b.mutable_array(), *L);
fem::apply_lifting(b.mutable_array(), {a}, {{bc}}, {}, 1.0);
b.scatter_rev(std::plus<T>());
fem::set_bc(b.mutable_array(), {bc});
then I want to impose periodic BC, since there is no demo for dolfinx_mpc in CPP, so I tried to write my own code, and I do something like this:
b.set(0.0);
dolfinx_mpc::assemble_vector(b.mutable_array(), *L, mpc);
dolfinx_mpc::apply_lifting(b.mutable_array(), {a}, {{bc}}, {}, 1.0, mpc);
b.scatter_rev(std::plus<T>());
fem::set_bc(b.mutable_array(), {bc});
The main difference is the second and third lines, the problem is that: when I run my code in 1 process, it works very well, the solution is as expected, but if I try to work in parallel, the error is reported:
[1]PETSC ERROR: ------------------------------------------------------------------------
[1]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range
[1]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger
[1]PETSC ERROR: or see https://petsc.org/release/faq/#valgrind and https://petsc.org/release/faq/
[1]PETSC ERROR: configure using --with-debugging=yes, recompile, link, and run
[1]PETSC ERROR: to get more information on the crash.
[1]PETSC ERROR: Run with -malloc_debug to check if memory corruption is causing the crash.
Abort(59) on node 1 (rank 1 in comm 0): application called MPI_Abort(MPI_COMM_WORLD, 59) - process 1
and this never happen when PBC is not applied. So I’m really confused, could anyone tell me is this part of code corret?
Thanks in advance!