Boundary Conditions and MatZeroRows

Jozsef Bakosi jbakosi at gmu.edu
Fri Nov 3 22:39:06 CST 2006


Manav,

I'm just curious. Why don't you want to place a 1.0 in the main diagonal
and solve it like that? Why do the boundary rows and columns have to be
specifically removed?

Jozsef

On Fri, Nov 03, 2006 at 07:57:14PM -0600, Barry Smith wrote:
> 
>   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
> > 
> > 
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20061103/5ca768ff/attachment.pgp>


More information about the petsc-users mailing list