mordechaiy
(Mordechai Yaakov)
October 6, 2020, 6:27pm
1
Hi everyone,
I would like to ask please,
I defined the following functions :
h1(z)=(abs(z)-1)^2*(1+2*abs(z)), for -1<z<1 otherwise h1(z)=0.
z(x,y)=((x-x0)*cos(theta)+(y-y0)sin(theta)+c t)/lambda.
and would like to compose h1(z(x,y))
I created two functions in FF++ but when I composed them, FF++ doesn’t compute the composed function.
real theta=pi/4;
real c=1;
real lambda=1;
real xr=3,yr=3;
real x0=xr+lambdacos(theta),y0=yr+lambda sin(theta);
func h1= ((abs(z)-1)^2*(1+2abs(z))) (z>-1 && z<1);
func z=((x-x0)*cos(theta)+(y-y0)sin(theta)+c t)/lambda;
func utilde=h1(z(x,y));// compse h1(z)
but FF++ tells me that there is an error in the definition of utilde.
Thank you!
Mordechai.
julienG
(Julien)
October 6, 2020, 7:38pm
2
Hi. naively there are most likely missing types and arguments , you define func z
with no arguments… maybe something like
func real h1(real zz)= ((abs(zz)-1)^2*(1+2abs(zz))) (zz>-1 && zz<1);
func real z0(real xx, real yy)=((xx-x0)*cos(theta)+(yy-y0)sin(theta)+c t)/lambda;
func real utilde=h1(z0(x,y));// compse h1(z)
Note that maybe z is a reserved word. Also you could simply use macros like
macro z(xx,yy)=((xx-x0)*cos(theta)+(yy-y0)sin(theta)+c t)/lambda //EOM
mordechaiy
(Mordechai Yaakov)
October 6, 2020, 7:43pm
3
Thank you so much Julien, for your reply! I appreciate it.
.
mordechaiy
(Mordechai Yaakov)
October 6, 2020, 9:17pm
4
Hi,
I tried to use the macro command.
the code runs but, it doesn’t give the right result.
the right result should be that from the right, top and left edges of the square there should be a wave propagating in one direction.
Could you please check where is the problem?
Thank you,
Mordechai.
u incident.edp (1.4 KB)