← Back to team overview

dolfin team mailing list archive

Re: Computing resonant modes

 

On Tue, May 20, 2008 at 09:43:54PM +0200, Evan Lezar wrote:
> Hi there
> 
> As an initial attempt, I am trying to use fenics to compute the resonant
> modes of a rectangular waveguide - and as such I need to solve an
> eigenvalue problem of the form  [A]x = lambda[B]x where x represents a
> vector of coefficients of the basis functions used to calculate the
> entries of the stiffness ([A]) and mass ([B]) matrices.
> 
> It is easy to assemble the matrices, and I have solved the eigenvalue
> problem using eigs() ... but now I have the calculated coefficients and
> I would like to plot the weighted sum of the basis functions (the finite
> element solution).  
> 
> Any help on the matter would be much appreciated.
> 
> Thanks
> Evan

Are you doing this in Python or C++?

If x is the vector, then you can do

  Function u(mesh, x, a);

where a is the form in C++.

In Python, you need to do

  Function u(element, mesh, x);

where element is the FiniteElement you have used for the trial space.

To plot the solution, just do

  plot(u);

-- 
Anders


Follow ups

References