I got the displacement field as solution. I then create a deformed mesh with the displacement field. Now I want to use the displacement in the reverse direction as displacement boundary condition to get back to the original shape. I tired Mesh.Domainboundar(). but I couldn’t find it in my library so I am unable to use it.
How to get the displacement field on the boundary alone.
How to apply it in the deformed mesh without projecting the displacement field onto a deformed mesh:
import numpy as np
mesh = df.UnitSquareMesh(36,36)
V = df.VectorFunctionSpace(mesh, "Lagrange",2,dim=2)
u=df.project(df.Expression(("x[0]", "x[1]"), degree= 1),df. VectorFunctionSpace(mesh, "CG", 1))
def boundary(x,on_boundary):
return on_boundary
u_bndry="function to get the displacement on the boundary"
DeformedMesh = df.Mesh(mesh)
X = DeformedMesh.coordinates()
X+=np.vstack(map(u,X))
V_1= df.VectorFunctionSpace(DeformedMesh, "Lagrange",2,dim=2)
D_bc=df.DirichletBC(V_1,-u_bndry,boundary)
The function space contains a reference to the mesh, print for instance V.mesh() and mesh, or the id V.mesh().id() and mesh.id(), or mesh==V.mesh().
ALE.move is an implicit operation that changes the coordinates of your mesh (similar to what you did manually on your deformed mesh).
I’d like to solve the problem by defining (sigma:epsilon) in LHS and RHS =0 with the BCS as mentioned above. just changing the displacement field u_out.vector will not ensure what I want, isn’t it?
I am not sure what you are asking for now.
What I have shown above is the following:
Deform your mesh with a displacement u
Create a Dirichlet-condition on the deformed mesh which enforces -u on the boundary.
The variable u_out is simply there as a helper for you to see that the boundary condition is applied on the deformed mesh, in the direction opposite to the initial deformation. This is why I apply the boundary condition to u_out and save it to file, so you can visualize it in Paraview.