# Deformation

I am attempting to deform a rectangle.
I expect the rectangle to enlarge in y-direction keeping its shape as a rectangle. How can I do it?

``````from numpy import *
from ngsolve import *
from netgen.occ import *
from ngsolve.webgui import Draw

Rect1 = MoveTo(-0.2, 0).Rectangle(0.15, 0.2).Face()
Rect1.bc('Rect1')
Rect2 = MoveTo(0.0, 0.0).Rectangle(0.15, 0.2).Face()
Rect2.bc('Rect2')
Rect2.maxh = 0.04
shape = Glue([Rect1, Rect2])

fes = VectorH1(mesh, order=1)
gfu_history = GridFunction(fes, multidim=0)
gfu = GridFunction(fes)
dY = 0.4*sin(linspace(0, pi, 10))
for dy in dY:
gfu.Set(CF((0, dy*y)), definedon=mesh.Materials('Rect2'))
mesh.SetDeformation(gfu)
Draw(
gfu_history,
interpolate_multidim=True,
animate=True,
min=0,
max=0.1,
autoscale=False,
deformation=True,
settings={
"camera": {"transformations": [{"type": "move", "dir": (0, 0, 1), "dist": -2}]}
},
);
``````

I chaged `.Set` to `.Interpolate`

``````for dy in dY:
gfu.Interpolate(CF((0, dy*y)), definedon=mesh.Materials('Rect2'))
mesh.SetDeformation(gfu)
``````

Then I obtained what I wanted.