← Back to team overview

dolfin team mailing list archive

Re: Applying Boundary conditions for eigenvalue problems

 

Is it possible to have a matrix as a right hand side?

So that I can call something like  bc.apply(S, T, form) where T and S
are the system matrices?

THanks
Evan

On Sun, Jun 8, 2008 at 11:01 PM, Anders Logg <logg@xxxxxxxxx> wrote:
> On Thu, Jun 05, 2008 at 11:10:58AM +0200, Johan Hoffman wrote:
>> > On Tue, Jun 3, 2008 at 11:31 PM, Anders Logg <logg@xxxxxxxxx> wrote:
>> >> On Tue, Jun 03, 2008 at 11:24:54PM +0200, Evan Lezar wrote:
>> >>> The problem is that I am not quite sure how to use it ...
>> >>> The code I have at the moment is as follows:
>> >>>     mesh = UnitSquare(1,1)
>> >>>     mesh.refine()
>> >>>     mesh.refine()
>> >>>     element = FiniteElement("Nedelec", "triangle", order);
>> >>>     v = TestFunction(element)
>> >>>     u = TrialFunction(element)
>> >>>     # assemble the mass and stiffness matrices
>> >>>     # the bilinear form is defined as the transverse curl since it is
>> >>> a two dimensional problem
>> >>>     # a = dot(curl(v), curl(u))
>> >>>     a = (vec(v.dx(0))[1] - vec(v.dx(1))[0])*(vec(u.dx(0))[1] -
>> >>> vec(u.dx(1))[0])
>> >>>     (S) = assemble(a*dx, mesh)
>> >>>     (T) = assemble(dot(v, u)*dx, mesh)
>> >>> I then use S and T to solve the eigenvalue system S x = lambda T x The
>> reason I am having trouble is that this does not use the pde class and
>> I have not found an example that uses the DirichletBC class to specify
>> the boundary conditions for matrix assembly.
>> >>> Thanks for the quick reply
>> >>> Evan
>> >> Hmm... I realize now I don't know how to set boundary conditions for an
>> eigenvalue problem (other than by eliminating unknowns). For
>> homogeneous boundary conditions, I guess one could zero out a row in S,
>> insert a 1 on the diagonal and zero out the corresponding row in T.
>> There is an example of applying boundary conditions in
>> >>  demo/pde/convection-diffusion/python/demo.py
>> >> but it is for a linear system Ax = b. There is also a function zero()
>> in DirichletBC which can be used to zero out a row in a matrix. --
>> >> Anders
>> >> _______________________________________________
>> >> DOLFIN-dev mailing list
>> >> DOLFIN-dev@xxxxxxxxxx
>> >> http://www.fenics.org/mailman/listinfo/dolfin-dev
>> >
>> > Well, eliminating unknowns is exactly what I need to do.  Typically in
>> my own code I would not even create matrix entries for the edges on the
>> boundary, thus eliminating the rows and columns associated with those
>> degrees of freedom.  I think I did come across the zero()
>> > function in my search, but how would I actually remove the rows or not
>> have them assembled in the first place?
>> >
>> > I will have a look at the demo and see where that takes me.
>>
>> Maybe you can solve this by using the subDomain classes?
>> See the thread: "FFC implementation over a subdomain of \Omega" on the
>> dolfin-dev mailing list.
>>
>> /Johan
>
> This doesn't help. The big problem here is we can't eliminate degrees
> of freedom. This is something we should add at some point, along with
> static condensation. I haven't thought much about it but it's
> basically the same problem: express some degrees of freedom in terms
> of others or given values, eliminate, solve, then add back the values
> (or we might directly assemble the smaller system).
>
> Until this has been implemented, you have to live with how we handle
> Dirichlet conditions currently in DOLFIN, which is to zero out the
> row, insert 1 on the diagonal and put the Dirichlet value in the
> right-hand side. This is all handled by the DirichletBC class.
>
> --
> Anders
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
>
> iD8DBQFITEinQp2CVMGvcgcRAoO9AJ4jUah2oJf5xWO21R19gGW7oLdZLwCdFHwA
> 99YcLV9s3/98yZygu6g4qA8=
> =KJJ+
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> DOLFIN-dev mailing list
> DOLFIN-dev@xxxxxxxxxx
> http://www.fenics.org/mailman/listinfo/dolfin-dev
>
>


Follow ups

References