boundary conditions
Barry Smith
bsmith at mcs.anl.gov
Wed Jan 21 21:09:44 CST 2009
On Jan 21, 2009, at 8:47 PM, Manav Bhatia wrote:
> Hi,
>
> I am trying to solve an eigenproblem. I would like to apply
> boundary conditions by removing the rows and columns associated with
> these dofs (as opposed to retaining/zeroing them and setting the
> diagonal elements to unit values).
>
> Is there a way for me to tell the matrix data structure which dofs
> to ignore during the matrix operations?
This is possible, but tricky. Basically you can call those rows/
columns -1 in your MatSetValues() calls and then they are ignored
(nothing is put in the matrix for them). But this means you need to
make sure that only the "real" rows and columns have numbers.
For example, if your problem has three rows/columns and row 1 (the
second one cause PETSc starts at 0) is the dummy row, then
real row 0 would correspond to 0 as the row index you pass in, real
row 1 would correspond to -1 as the row index you pass in and
real row 2 would correspond to 1 as the row index you pass in.
> Or should I create a separate matrix by extracting the unconstrained
> dofs from the global matrix?
You can use MatGetSubMatrix() to pull out the part you want. Of
course, once you get the eigenvector you have to remember to
"put back in the boundary condition entries". For example with the 3
by 3 matrix above if the reduced eigenvalue is [1 2] then putting
it back in the original numbering would be [1 x 2] where x is whatever
that boundary value was.
Barry
>
>
> I would appreciate any inputs.
>
> Thanks,
> Manav
>
>
More information about the petsc-users
mailing list