Hello everyone.
I want to compute the curvature of a closed curve by finite elements.
The variational problem reads:
So I tried to formulate it in FEniCS as:
from fenics import *
mesh = Mesh('CircleSurface.xml')
V = VectorFunctionSpace(mesh, 'P', 2)
H = TrialFunction(V)
phi = TestFunction(V)
def Identity(u):
return Expression(("x[0]","x[1]"), degree = 1)
Idt = project(Identity(H), V)
F = inner(phi, H)*dx - inner(nabla_grad(phi), nabla_grad(Idt))*dx
a, L = lhs(F), rhs(F)
H = Function(V)
solve(a==L, H)
However, the solution is NaN at every point. I checked and Idt is also NaN. I really do not know why. As far as I know, the expression I used is correct, why is it NaN?
In addition, I would like to know if there is any source of tangential gradient, so far I am using the flat gradient assuming that the integration takes into account the surface in the Jacobian.
I implemented this problem in matlab and I used a map from the curved element to a reference flat 1D domain, there the Jacobian takes into account the fact that the domain is a surface.
Is there any similar approach in FEniCS?
I also want to add a short view of the mesh: (‘CircleSurface.xml’)
<?xml version="1.0"?>
<dolfin xmlns:dolfin="http://fenicsproject.org">
<mesh celltype="interval" dim="2">
<vertices size="100">
<vertex index="0" x="1.0000000000000000e+00" y="0.0000000000000000e+00"/>
...
<vertex index="99" x="9.9802672842827156e-01" y="-6.2790519529313263e-02"/>
</vertices>
<cells size="100">
<interval index="0" v0="0" v1="0" />
...
<interval index="99" v0="99" v1="99" />
</cells>
<data />
</mesh>
</dolfin>