[petsc-users] DMCreatMatrix preallocation

Smith, Barry F. bsmith at mcs.anl.gov
Mon Sep 17 15:37:20 CDT 2018


  You can use DMDASetBlockFills() or DMDASetBlockFillsSparse(). 

   If you need any finer scale control then they offer you need to copy the PETSc source that does the preallocation for DMDA generated matrices and customize it exactly for your problem.


    Barry


> On Sep 17, 2018, at 3:31 PM, Oleksandr Koshkarov <olk548 at mail.usask.ca> wrote:
> 
> Hello All,
> 
> I have a question about preallocation of DMDA matrix. As I understand, it preallocates the number of nonzeros using the stencil width info. However, it seems it will not be efficient for me: I have a large dof (around 2000), where only some of those dof's are coupled, so those dof*dof blocks inside the DMMatrix would be also sparse. I also use this DMDA matrix as preconditioner, which has lower coupling than original DMDA array, so stencil is effectively smaller (I precondition higher order finite volume method with lower order FV method). Can I manually specify how many zeros needs to be preallocated for the DMDA matrix?
> 
> p.s. I do not want o use normal matrix, as I relay on dmda indexing (MatSetValuesStencil).
> 
> Thank you and best regards,
> 
> Oleksandr.
> 



More information about the petsc-users mailing list