← Back to team overview

dolfin team mailing list archive

Re: projection from one mesh to another

 

The interpolate() function (which is in the class Function) is only
implemented for the two cases that either the function being
interpolated to a cell can be evaluated at any given point (like when
you define a function like sin(x)*cos(y)) or the function being
interpolated is already defined on the same mesh. If the two functions
are defined on different meshes, the interpolate function won't help
you.

There is currently very little supporting functionality for doing
projections between meshes, so everything needs to be handled
manually: knowing how the degrees of freedom are ordered on the two
meshes and how the two meshes intersect.

/Anders


On Thu, Aug 24, 2006 at 12:42:16PM +0200, Dag Lindbo wrote:
> Thanks, that helps. Am I on the right track if I use the AffineMap class
> to dor the projection? (inspiration from the elasticity solver):
> 
> AffineMap map;
> (...)
> map.update(cell);
> phi.interpolate(coeff, map, element);
> element.nodemap(nodes, cell, mesh);
> 
> /Dag
> 
> On Thu, 2006-08-24 at 11:38, Anders Logg wrote:
> > There is no way to automatically project between meshes, so you have
> > to do it manually.
> > 
> > You can get the parent mesh of a refined mesh by doing
> > 
> >     ...
> >     mesh.refine();
> >     Mesh& parent = mesh.parent();
> > 
> > If you refine multiple times, you can get the whole hierarchy of
> > meshes by
> > 
> >     MeshHierarchy meshes(mesh);
> > 
> > I have just added a new and improved mesh library to DOLFIN. The base
> > class is NewMesh. After we have release 0.6.2, we will concentrate on
> > porting everything to the new mesh.
> > 
> > Automatic projection of functions between meshes should be added at
> > some point.
> > 
> > /Anders
> > 
> > 
> > On Thu, Aug 24, 2006 at 10:50:36AM +0200, Dag Lindbo wrote:
> > > Hi,
> > > 
> > > I have a question about the mesh class. I have a function defined on
> > > some mesh. This mesh is refined. What is the best way to project the
> > > function from the old to the new mesh?
> > > 
> > > As far as I can tell, this is not done automatically. To do this
> > > manually, I assume, involves allocating a new vector and computing the
> > > transformation between the two meshes. Where does the original mesh go,
> > > after being refined? How should I do the projection? 
> > > 
> > > Regards,
> > > Dag Lindbo
> > > 
> > > _______________________________________________
> > > DOLFIN-dev mailing list
> > > DOLFIN-dev@xxxxxxxxxx
> > > http://www.fenics.org/mailman/listinfo/dolfin-dev
> > _______________________________________________
> > DOLFIN-dev mailing list
> > DOLFIN-dev@xxxxxxxxxx
> > http://www.fenics.org/mailman/listinfo/dolfin-dev
> 


References