Boundary Conditions and MatZeroRows
Barry Smith
bsmith at mcs.anl.gov
Fri Nov 3 19:57:14 CST 2006
Manav,
MatZeroRows() only zeros the rows, it does not zero the columns or
remove them from the matrix.
You can use MatGetSubMatrix() to pull out the part you want and solve
with that smaller matrix.
Barry
On Fri, 3 Nov 2006, Manav Bhatia wrote:
> Hi,
>
> I am trying to apply dirichlet boundary conditions in an elliptic problem,
> and I followed the suggestions from section 3.4 (Other Matrix Operations) in
> the users manual.
> I use the command MatrixZeroRows() to zero out the rows corresponding to
> the dofs that are constrained, and pass PETSC_NULL as the last argument to the
> function to also remove the diagonal entry. However, it seems that I am
> missing a point somewhere, since when I call the KSPSolve routine, I get an
> error saying that an empty row was found.
>
> My matrix is SeqAIJ, and I am using direct solvers. In my understanding,
> calling this function should remove the rows (and also the columns) from all
> operations, so that these dofs do not play any role in the solution. Please
> correct me if I am wrong.
>
> I understand that I can place a 1.0 at the diagonal, and that would solve
> the problem. However, as I mentioned before, I want to remove the rows and
> columns corresponding to the constrained dofs. Is this the right function to
> use for such a task? The other method, as I understand, is to extract the
> submatrix from the main matrix and use that for the computations.
>
> I would appreciate any help on this issue.
>
> Regards
> Manav
>
>
More information about the petsc-users
mailing list