Boundary Conditions and MatZeroRows

Manav Bhatia manav at u.washington.edu
Fri Nov 3 23:59:00 CST 2006


Well, the primary reason is that I am using the same matrices for a  
linear solution, as well as an eigen solution. The problem with  
keeping 1.0 at the diagonal is that it induces spurious modes and  
eigenvalues in the eigensolution, and might even hide an actual  
eigenvalue. Also, in my recent experience, this method has been  
giving me convergence problems for both linear as well as eigen  
solutions. (I use slepc for eigensolution).

This was my motivation to remove the constrained dofs, and work with  
a reduced matrix.

I thank Barry Smith for his response to my question.

Reagrds,
Manav


On Nov 3, 2006, at 8:39 PM, Jozsef Bakosi wrote:

> 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
>>>
>>>
>>




More information about the petsc-users mailing list