<div dir="ltr">Dear All,<div><br></div><div>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.</div><div><br></div><div>I am now tryig to improve its performace and I have a question on matrix in MPIAij format.</div><div><br></div><div>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:</div><div><br></div><div>- fill each matrix using <i>matSetValues</i> row by row </div><div>- finalize each matrix assembly with<i> MatAssemblyBegin </i>and<i> MatAssemblyEnd</i></div><div><br></div><div>I am wondering if would be possible  to build just one matrix doing <i>MatAssemblyBegin/</i><i>MatAssemblyEnd</i>  and for

the  other two change the diagonal values locally, thus avoiding the parallel communications.</div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">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.</span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Thank you very much for your help,</span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div>Edoardo</div><div><br></div><div><br></div></div>