[petsc-users] question on ksp
    Barry Smith 
    bsmith at mcs.anl.gov
       
    Wed May  7 22:27:05 CDT 2014
    
    
  
  Use DMCreateMatrix() and it will return the correctly sized matrix, with the correct parallel layout and the the correct nonzero preallocation for  the given DM.
   After these changes let us know if you have any problems.
   Barry
On May 7, 2014, at 10:11 PM, <likunt at caltech.edu> <likunt at caltech.edu> wrote:
> 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