← Back to team overview

dolfin team mailing list archive

Re: Computing resonant modes

 

On Thu, May 22, 2008 at 11:34:54AM +0200, Evan Lezar wrote:
> On Thu, May 22, 2008 at 12:42 AM, Anders Logg <logg@xxxxxxxxx> wrote:
> > 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);
> >
> >
> 
> Thanks for the reply - something is happening now at least :)
> 
> Now that I have the function - how do I specify at which coordinates
> it should be plotted?  At the moment, there are a couple of vectors
> being plotted, but I would like a higher density.

The builtin plotting (Viper) has very limited functionality (by
intention). For more options, save to .pvd format and open in Paraview.

> Also, is there a way to plot the mesh as well as the function in viper?

Yes:

  plot(mesh)

:-)

-- 
Anders


Follow ups

References