Convolution operator?

Hey everyone,

I want to operate a convolution on a function.
After a short investigation in the documentation, it appears to me that this was not implemented. I am quite surprise about it. Maybe I am wrong and the convolution operator is named differently ? Have you ever face the need for a convolution operator, and, if yes, how did you manage to deal with that issue ?

Thanks a lot,

Simon

U;m curious too although with an unpredictable mesh not sure it is
as easy to define as a grid. You can access FFT via fftw and do it int
the frequency domain I suppose. I was just curious about simple shifts
but again with a nonuniform grid I guess that involves an interpolation
etc.

Does this example for Green function solves your problem? Convolution is of course costly

1 Like

Hi,

I am also interested.
A tentative is below.
etaeps is the mollifier.
But it is very slow !

Cornel

real epsmol=0.2;

func real eta(real x, real y){
real tmp;

if ( x^2+y^2 < (1-0.001)^2)
tmp=exp( 1/(x^2+y^2-1) );
else
tmp=0;

return tmp;
}

cout << eta(0,0) << endl;

real C;
C=1/int2d(Th)(eta(x,y));
cout << C << endl;

fespace VhP1(Th,P1);

VhP1 etah=eta(x,y);

//plot(etah, wait=1,value=1,fill=1, dim=3, cmm=“eta”);

func real etaeps(real x, real y){
real tmp;

tmp=C*eta(x/epsmol,y/epsmol) /(epsmol)^2;

return tmp;
}

VhP1 dir1P1, dir1nonP1;

dir1nonP1=abs(x)*abs(y);

for (int i=0;i<Th.nv;i++){

cout << “i=” << i << endl;

dir1P1[i]= int2d(Th)(etaeps(Th(i).x -x, Th(i).y -y)*dir1nonP1(x,y) ) ;

};

plot(dir1P1, wait=1,value=1,fill=1, dim=3, cmm="dir1P1 mollifer ");

1 Like

Yes I guess you’re right : it should be more difficult to implement with a non uniform grid. It could explain why it has not been implemented in FF+ so far. Mine is uniform, so the responses given by julienG and murea (below) works as far as I’m concern !

Yes it works, thanks ! Nevertheless (and as you mentionned it), it is very slow as soon as you work with fine meshes (which was expected obviously haha)

Thanks, it works too ! It is more or less the same as what JulienG referred to !
Yes sadly, I guess nothing more sophisticated (ie faster) has been implemented for now :frowning: