<div dir="ltr"><div><div><div><div>Hi all,<br></div>In solving problems such as laplacian/poisson equations with dirichlet boundary conditions with finite difference methods, I set explicity the required values to the diagonal of the boundary rows of the system matrix, and the corresponding rhs vector.<br>
</div>i.e. typically my matrix building loop would be like:<br></div><br>e.g. in 2d problems, using DMDA:<br><br>FOR (i=0 to xn-1, j = 0 to yn-1)<br></div><div> set row.i = i, row. j = j<br></div><div> IF (i = 0 or xn-1) or (j = 0 or yn-1) <br>
set diagonal value of matrix A to 1 in current row. <br></div><div> ELSE<br></div><div> normal interior points: set the values accordingly<br></div><div> ENDIF<br></div><div>ENDFOR<br><br></div>
<div>Is there another preferred method instead of doing this ? I saw functions such as MatZeroRows()<br></div><div>when following the answer in the FAQ regarding this at:<br><a href="http://www.mcs.anl.gov/petsc/documentation/faq.html#redistribute">http://www.mcs.anl.gov/petsc/documentation/faq.html#redistribute</a><br>
</div><div><br></div><div>but I did not understand what it is trying to say in the last sentence of the answer "An alternative approach is ... into the load" <br><br></div><div>Thanks,<br></div><div>Bishesh<br>
</div></div>