# [petsc-users] working-with-submatrix

Julian Andrej juan at tf.uni-kiel.de
Wed Oct 7 07:27:09 CDT 2015

```Especially in eigenproblems, I would suggest using Matthews approach, or
applying Dirichlet boundary conditions via the penalty method (penalized
robin for example). This would avoid spurious eigenvalues which occur when
you use MatZeroRows().

On Wed, Oct 7, 2015 at 2:17 PM, Matthew Knepley <knepley at gmail.com> wrote:

> On Wed, Oct 7, 2015 at 7:08 AM, Giuntoli Guido Alfredo <
> ggiuntoli at tecna.com> wrote:
>
>> Hi! I have a problem of the form Ax=kBx were x is a scalar variable that
>> is 0 in the border of a domain (x_D=0).
>>
>> Using FEM the problem that you have to solve is a reduced problem were
>> you don’t have to include the coefficients of the matrix that multiply the
>> x_Ds. So, I have two alternatives here, one is to construct a reduce matrix
>> A and B from the beginning… this could result in a slow code. The other
>> alternative I want to try is to use a sub matrix of A and B and pass them
>> to slepc. How can I do this is I have Mat A and Mat b ?
>>
>
> 1) Can't you just use MatZeroRows() or MatZeroRowsColumns() to apply your
> BC?
>
> 2) I am not sure why you think eliminating variables will be slower. My
> experiments and theoretical understanding say it is at least as fast as
> zeroing the rows.
>
> 3) If you want to extract a submatrix, you can use MatGetSubmatrix().
>
>   Thanks,
>
>      Matt
>
>
>>
>>
>> Thank you, Guido!
>>
>> ------------------------------
>> [image: Argentina Oil & Gas Expo] <http://www.aogexpo.com.ar> *¡Venga a
>> visitarnos!* *en Argentina Oil & Gas Expo*
>> 5 – 8 Octubre, 2015 La Rural Predio Ferial
>> Stand 2F-30 - Hall 2
>>
>> Trabajamos con seguridad y velamos por la protección del Medio Ambiente.
>> Antes de Imprimir este mail confirme que sea necesario. Gracias
>>
>> El presente e-mail y cualquier documento adjunto al mismo, pertenecen al
>> emisor y puede contener información confidencial legalmente protegida. La
>> información contenida en este e-mail es remitida únicamente para uso del
>> destinatario indicado en el mismo. La divulgación, copia, distribución o
>> cualquier otro uso de la información contenida en el presente e-mail por
>> parte de personas distintas al destinatario se encuentra prohibido. Si Ud.
>> ha recibido este e-mail por error, rogamos borrar el mismo e informar dicha
>> circunstancia por mail a la dirección info at tecna.com Muchas gracias.
>>
>> This electronic mail transmission and any attached documents contain
>> information belonging to the sender which may be confidential and legally
>> privileged. The information is intended for the use of the named
>> recipient(s) only. If you are not the intended recipient(s), any
>> disclosure, copying, distribution or action taken regarding the information
>> on this email is strictly prohibited. If you have received this email in
>> error please notify info at tecna.com and delete the email from your
>> computer. Thank you.
>> ------------------------------
>>
>>
>
>
> --
> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which their
> experiments lead.
> -- Norbert Wiener
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20151007/10af7d14/attachment.html>
```

More information about the petsc-users mailing list