[dune-fem] Interpolating a function of a 3D grid over a 2D grid
Sacconi, Andrea
a.sacconi11 at imperial.ac.uk
Wed Nov 20 15:42:40 CET 2013
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
More information about the dune-fem
mailing list