[petsc-users] Question on assembling matrix in parallel

Edoardo alinovi edoardo.alinovi at gmail.com
Thu Mar 1 10:24:03 CST 2018


Dear All,

thanks to your suggestions and Petsc, I have finished to program my finite
volume code for CFD that runs in parallel and this is great.

I am now tryig to improve its performace and I have a question on matrix in
MPIAij format.

Basically after the discetization, I have one matrix for each velocity
component and they are equal except for the diagonal elements which changes
because of the boundary conditions. What I am doing now is:

- fill each matrix using *matSetValues* row by row
- finalize each matrix assembly with* MatAssemblyBegin *and* MatAssemblyEnd*

I am wondering if would be possible  to build just one matrix doing
*MatAssemblyBegin/**MatAssemblyEnd*  and for the  other two change the
diagonal values locally, thus avoiding the parallel communications.

Also can I put a matrix object in a module and make it a global variable?
Can you provide/link me an example? I am using Fortran.

Thank you very much for your help,

Edoardo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20180301/2189040f/attachment.html>


More information about the petsc-users mailing list