Compute elements surface after deformation

Hy Community,
I want to compute the surface elements after deformation, I do this :

mesh.SetDeformation(gfset)
surfaces=ngs.Integrate(ngs.CF(1),mesh,element_wise=True)

But it didn’t work.

What does not work?


from ngsolve import *

r = Rectangle(1,1).Face().Move((-0.5,-0.5,0))

geo = OCCGeometry(r, dim=2)
mesh = Mesh(geo.GenerateMesh(maxh=0.1))

fes = VectorH1(mesh)

gfu = GridFunction(fes)

gfu.Set((x, 0))

mesh.SetDeformation(gfu)

elwise = Integrate(1, mesh, element_wise=True)

print(sum(elwise))

This gives me 2.

1 Like

It does work. The test I did was not relevant.

Thanks for the reply