[petsc-users] better way of setting dirichlet boundary conditions
Bishesh Khanal
bisheshkh at gmail.com
Tue Aug 20 07:19:41 CDT 2013
Hi all,
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.
i.e. typically my matrix building loop would be like:
e.g. in 2d problems, using DMDA:
FOR (i=0 to xn-1, j = 0 to yn-1)
set row.i = i, row. j = j
IF (i = 0 or xn-1) or (j = 0 or yn-1)
set diagonal value of matrix A to 1 in current row.
ELSE
normal interior points: set the values accordingly
ENDIF
ENDFOR
Is there another preferred method instead of doing this ? I saw functions
such as MatZeroRows()
when following the answer in the FAQ regarding this at:
http://www.mcs.anl.gov/petsc/documentation/faq.html#redistribute
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"
Thanks,
Bishesh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130820/c4038bbd/attachment.html>
More information about the petsc-users
mailing list