[petsc-users] question on ksp

likunt at caltech.edu likunt at caltech.edu
Wed May 7 22:11:33 CDT 2014


Dear Petsc developers,

I am solving a linear system Ax=b. The rhs vector b and the matrix A are
defined as follows,

DMDACreate1d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,M,3,1,NULL,&da);
DMCreateGlobalVector(da, &b);

MatCreate(PETSC_COMM_WORLD, &A);
MatSetSizes(A, PETSC_DECIDE, PETSC_DECIDE, M*3, M*3);
MatMPIAIJSetPreallocation(A, 7, NULL, 7, NULL);
MatSetUp(A);

There is a Memory corruption problem when calling
KSPSetOperators(ksp, A, A, DIFFERENT_NONZERO_PATTERN);
KSPSolve(ksp, x, b);

since the partition of A and b are not consistent. Should I use

KSPSetDM and KSPSetComputeOperators

for sovling this problem?

Thanks,








More information about the petsc-users mailing list