[dune-fem] Interpolating a function of a 3D grid over a 2D grid

Tobias Malkmus tomalk at mathematik.uni-freiburg.de
Wed Nov 20 15:51:10 CET 2013


Hi Andrea

They key ingrediens for a fast interpolation is to compute the 
intersection between the 3D and the 2D grid.

 > 	{ phi3D_.evaluate (x, y); }

searches in the 3D grid the element in which x is located.
So for each evaluation of your interface function at most a grid 
traversal over the 3D grid is needed.

If you can find a way to couple a 3D and 2D grid you can speed up this 
interpolation. Since i deal with similar problems i would write 
something like an IntersctionGridPart which chaches the pairs of 
entities of the 2D and 3D grid which have a non empty intersection.

As far as i know there is no official implementation to this.

Best Tobias


On 11/20/2013 03:42 PM, Sacconi, Andrea wrote:
> Hi everyone,
>
> I would like to ask you a question about interpolation.
> I am dealing with a coupled domain-interface problem, where a function (the electric potential) defined over the 3D domain grid has to be evaluated on a 2D grid which represents the interface.
> Now, I cannot use the usual interpolation because the two functions are defined over different grids (with different dimensions, too), so I am currently following this way: I create a function that has only
> the global evaluate method:
>
> template < class DiscreteFunction3DType , class ScalarCurvatureFunctionSpaceType >
> class Phi3D : public Dune::Fem::Function < ScalarCurvatureFunctionSpaceType, Phi3D < DiscreteFunction3DType , ScalarCurvatureFunctionSpaceType > >
> {
> public:
>
> 	typedef typename DiscreteFunction3DType :: DomainType DomainType;
> 	typedef typename DiscreteFunction3DType :: RangeType RangeType;
>
> 	Phi3D ( const DiscreteFunction3DType & phi3D_original ) : phi3D_ ( phi3D_original ) {}
> 	
> 	void evaluate (const DomainType & x, RangeType & y) const
> 	{ phi3D_.evaluate (x, y); }
>
> private:
> 	DiscreteFunction3DType phi3D_;
> };
>
> then I can interpolate an instance of the Phi3D class using the Lagrange interpolation over the 2D grid.
> Is there a faster/cleverer way of doing it? With tetrahedra and triangles it really takes ages, especially when the grid is refined.
>
> Cheers,
> Andrea
> __________________________________________________________
>
> Andrea Sacconi
> PhD student, Applied Mathematics
> AMMP Section, Department of Mathematics, Imperial College London,
> London SW7 2AZ, UK
> a.sacconi11 at imperial.ac.uk
>
> _______________________________________________
> dune-fem mailing list
> dune-fem at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune-fem
>
>


-- 
Tobias Malkmus                 <tomalk at mathematik.uni-freiburg.de>

Mathematisches Institut               Tel: +49 761 203 5627
Abt. für Angewandte Mathematik        Universität Freiburg
Hermann-Herder-Str. 10
79104 Freiburg





More information about the dune-fem mailing list