dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #08104
Re: Applying Boundary conditions for eigenvalue problems
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
Follow ups
References