<div dir="ltr">Hi all,<div><br></div><div>I'm currently coding a finite element problem in PETSc. I'm computing all of the matrices by myself and would prefer to do it that way. I want to parallelize the assembly of the global matrices. This is a simplified version of the assembly routine (pseudocode):</div>
<div><br></div><div>for (k = 0; k < nelements; ++k)</div><div>{</div><div> get_index(k,ie,je); /* ie and je are arrays that indicate where to place A_local */</div><div> compute_local_matrix(A_local,...);</div><div>
<br></div><div> MatSetValues(A_global, nlocal, ie, nlocal, je, A_local, ADD_VALUES);</div><div>}</div><div><br></div><div>This is for DG finite elements and I know the matrix easily be assembled in parallel. Even on my laptop, this would allow me to significantly speed up my code. The only problem is, I'm not sure how to do this in PETSc. I'd assume I need to use MatCreateMPIAIJ instead of MatCreateSeqAIJ, but wasn't able to find any using tutorials on how I might do this. </div>
<div><br></div><div>Sincerely,</div><div>Justin</div></div>