Hello everybody. I would like to compute the slope of a boundary on a 2D FEniCS mesh.
For a simple example, consider a quadrilateral domain with vertices at (0,0), (2,1), (3,3), and (1,2). The bottom boundary is defined as the line between points (0,0) and (2,1). Now let the function $f(x)$ describe the vertical position of the bottom boundary as a function of $x$. In this case, $f(x) = \frac{1}{2}x$, and so ${\mathrm{d}f}/{\mathrm{d}x} = \frac{1}{2}$.
I need to compute ${\mathrm{d}f}/{\mathrm{d}x}$ along the boundary of a FEniCS mesh. The boundary won't necessarily be linear either - in fact, more than likely the boundary will be curved. The calculation needs to be done within FEniCS because some of the terms in the variational form depend on ${\mathrm{d}f}/{\mathrm{d}x}$.
Does anybody know a convenient way to perform a calculation like this? Thank you in advance.