Movemesh with level set defined geometry

Hello everyone,

I have compiled the developer version of FreeFem to have my hands on mmg2d function and created the attached mesh where the flower like geometry is defined by a level set function as:
A = x^2 + y^2;
ls = sqrt(A) - 0.27 - 0.27 * 2cos(3atan2(x, y));

Now what I want is to rotate the flower counterclockwise and see the deformed mesh after this rotation. When I use movemesh function, the square mesh is rotated rather than the flower gometry, hence no deformation occurs, as seen in attached figure.

Can anyone know how to rotate the level set defined flower geometry and create a deformed mesh while keeping the square mesh stable?

Here is the code I use:

load “mmg”
real x0 = -1.0;
real x1 = 1.0;
real y0 = -1.0;
real y1 = 1.0;
int n = 100;
real m = 100;
mesh Th = square(n, m, [x0+(x1-x0)x, y0+(y1-y0)y]);
fespace Vh(Th, P1);
Vh A = x^2 + y^2;
Vh ls = sqrt(A) - 0.27 - 0.27 * 2
cos(3
atan2(x, y));
Th = mmg2d(Th, iso = 1, ls = 0.0, metric = ls[ ], hmax = 0.1);
func phi1=x * cos(10) + y * sin(10);
func phi2=-x * sin(10) + y * cos(10);
Th = movemesh(Th, [phi1, phi2]);
Th = trunc(Th, region == 2);
plot(Th);

Thank you

What is wrong with just adding theta to the atan2 term and re-creating the mesh?
Do you want to do in effect an infintesimal rotation and be able to
have old and new points correspnd to each other?
Edit : Probably you need a function that moves points near the surface in the
direction of the surface motion while leaving the outer boundary elements in place.
If you have fluid flow solution that may help :slight_smile:
Can you solve some differential equation and use that solution to deform the mesh?

@marchywka If I just add theta to atan2 term I will get a new mesh (not deformed, nicely adapted to the flower) over the moved flower geometry not a deformed mesh.

to use movemesh you need a function that moves the points on the surface
the desired amount while leaving the outer rectangle in place. Can you describe
that with a differential equation and boundary conditions?