Second derivative of shape functions in JuAFEM

Hi,
is there already a implemented function, which computes the second derivatives of the shape function at a given point?

I am working with PDEs of higher-order and therefore need high order derivates of the used ansatz functions. I tried to combine the shape_divergence with shape_gradient function, but failed so far.

A closer look at shape_gradient and shape_divergence reveals, that it just calls cv.dNdx[basefunc, q_point] and shape_divergence is sum(cv.dNdx[basefunc, q_point]). These values are a combination of cv.dNdξ and the inverse of the jacobian. The first is a precomputed value (only depends on the gauss point location) and the latter is computed in reinit! for each cell.

So ideally, you’d like to subtype CellValues and extend it with dNdx² and dNdξ² which saves the second order derivative information at a given gauss point.
you’d need to specify a constructor, something like: https://github.com/KristofferC/JuAFEM.jl/blob/master/src/FEValues/cell_values.jl#L99-L141
https://github.com/KristofferC/JuAFEM.jl/blob/master/src/FEValues/cell_values.jl#L120 this line would need to be changed to something like
dNdξ²_temp, dNdξ_temp, N_temp = hessian(ξ -> value(func_interpol, basefunc, ξ), ξ, :all)

and further implement a reinit! that updates the cv.dNdx² in the same fashion cv.dNdx is updated here: https://github.com/KristofferC/JuAFEM.jl/blob/master/src/FEValues/cell_values.jl#L143-L164

2 Likes

The basis functions may be only continuous. Then if we differentiate, the derivatives have inter-element jumps, which CANNOT be differentiated through again.

1 Like

Thank you.
I actually had the same idea but I thought maybe someone already implemented something similiar.

To avoid the differentiation problem I would work with Splines, so normally with high order Basis.