You need to create a perturbation function (uh
) in the example above, that is the difference between the deformed domain and the reference domain (if you want to use +=), or you can simply use
mesh.geometry.x[:, :mesh.geometry.dim] = your_transformation_function(mesh.geometry.x)
where the my_transformation_function(x)
takes in an x that is (3, num_points), i.e. each column will be the x,y,z coordinate of a node in the mesh.
You could also see: Changing the shape in the surface normal directions - #6 by dokken for more code explaining different deformation techniques.