dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #08057
Re: [FEniCS-dev] Deforming mesh
On Wed, May 28, 2008 at 02:27:49AM +0200, Artur P. wrote:
> (...)
>
>
>
> I was wondering is it possible to omit precompilation of *.form files.
> I need to calculate 2D elasticity problem with different Poisson's
> ratio. But the Poisson's ratio a coefficient in stress equation which
> is used to formulate weak form in a *.form file. So I had to modify my
> *.form file each time what is not convenient and effective!
>
>
> I've just modified the DOLFIN elasticity demo such that elasticity
> parameters are set in main.cpp rather than in the form file.
>
> Garth
>
>
> Thanks a lot, it works perfectly.
>
> Another question (I feel free to ask, sorry if it's too lame..) is: how to
> compute volume (area) of 2D deformed elastic body?
You can define a form for the integral 1*dx which gives you the area:
mesh = UnitSquare(2, 2)
element = FiniteElement("Lagrange", "triangle", 1)
f = Function(element, mesh, 1.0)
area = assemble(f*dx, mesh)
> Of course using
> CellIterator->volume(), but how to update the mesh to displacement field? There
> is movemesh() function in freefem++ `language`, does dolfin deal with an
> equivalent one? I hope it is possible to deform mesh without interfering with
> each point coordinates...
Do you want to specify new coordinates for all vertices, or just the
vertices on the boundary? Here's an example of moving all vertices in
the mesh when you just know the new positions of the vertices on the
boundary:
# Create mesh
mesh = UnitSquare(20, 20)
# Create boundary mesh
boundary = BoundaryMesh(mesh)
# Move vertices in boundary
for x in boundary.coordinates():
x[0] *= 3.0
x[1] += 0.1*sin(5.0*x[0])
# Move mesh
mesh.move(boundary)
# Plot mesh
plot(mesh, interactive=True)
--
Anders