[petsc-users] KSP ex65 and DMShell context

Anton Popov popov at uni-mainz.de
Fri Nov 18 05:29:46 CST 2016


Hi all,

KSP ex65 fails with -pc_type mg -pc_mg_galerkin

[0]PETSC ERROR: Nonconforming object sizes
[0]PETSC ERROR: Matrix dimensions are incompatible, 129 != 65

This can be fixed either by adding MatTranspose after 
DMCreateInterpolation in CreateRestriction, or by commenting out 
DMShellSetCreateRestriction.

Replacing DMCreateInterpolation with DMCreateRestriction in 
CreateRestriction also fails with a segfault:

[0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, 
probably memory access out of range
[0]PETSC ERROR: [0] DMCreateRestriction line 1064 
/home/anton/LIB/petsc-3.7.4-debug/src/dm/interface/dm.c

This example uses DMDA objects as context variables, and calls destroy 
on them right after creating coarse DMShell. Due to PETSc reference 
counting mechanism they are not destroyed immediately, so everything 
works without access violations and memory leaks.

I wander how I should destroy my ordinary user contexts. One option is 
keeping a pointer to coarse context in the fine context, and destroying 
hierarchy recursively.

Is there anything better (e.g. something like DMShellSetDestroyContext)?

Thanks,
Anton


More information about the petsc-users mailing list