# Force that depends on tangent to facet and adapts to deformation

Hello,
I am currently try to code the bending of a hollow tube on fenicsx, due to a traction force on the top facets of the tube. The tube’s axis is parallel to the z axis and I am applying a traction to constrict the top cells of the tube. Here are how I selected the top cells of the tube:

``````def apply_force_on_boundary(x):
r = np.sqrt(x[0]**2+x[1]**2)
theta = np.arctan2(x[1], x[0])
r_condition = np.isclose(r, R_outer, atol=1e-2)
theta_condition = np.isclose(theta, 0, atol=np.pi/6 )
return np.logical_and(r_condition, theta_condition)
``````

This creates a strip of cells for the whole length of the tube.
The way I have implemented the traction force is the following:

``````x = ufl.SpatialCoordinate(domain)
normal = ufl.FacetNormal(domain)
traction_sign = ufl.conditional(ufl.lt(x[2], L/2), 1, -1)
tangential_vector = ufl.cross(normal, ufl.as_vector([0,1,0]))
tangential_norm = ufl.sqrt(ufl.dot(tangential_vector, tangential_vector))
tangential_vector = tangential_vector/tangential_norm
Traction = 0.01*traction_sign*tangential_vector
``````

What I would like to implement is that the Traction force that is applied on the facets that are tagged with the function apply_force_on_boundary, follows the deformation of the tube and is not constant in space after the formulation of the variational problem.

I have tried defining the function in the variational problem, or applied the function repeatedly with updating the mesh. Unfortunately, none worked really well. I was wondering if there was a way to formulate the function so that it adapts to the deformation and isn’t just a constant during solving the problem, especially in fenicsx.

Thank you very much for your help. I can provide more code if needed (I have only put small parts as it is quite long).

You should use Nanson formula, see here:

1 Like