dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #08105
Re: Applying Boundary conditions for eigenvalue problems
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.
Thanks
Evan
--
visit http://randomestrandom.blogspot.com
Follow ups
References