# [deal.II] Extracting Shape Laplacian

Hello all,

I am working on implementing some stabilization methods for the
Navier-Stokes equations, these techniques often require the use of the
laplacian of the shape functions. I know I get the hessian of the k'th
shape function at quadratue point q via the following

Tensor<3, dim> hessian_phi = fe_values[velocity_extractor].hessian(k, q);

My question is understanding what does this return, and how to extract the
laplacian from it. Does hessian_phi[ i ][ j ][ k ] = \frac{  \partial
\varphi_{ i }   } {  \partial x_{ j } \partial x_{ k }   }?

If this is the case, is there a way to contract over the last two
components to result in a rank 1 tensor that is the laplacian? My idea was
the following

std::vector< Tensor<1, dim> > laplace_phi_u (dofs_per_cell);
Tensor<3, dim> hessian_phi = fe_values[velocity_extractor].hessian(k, q);
for( int i=0; i<dim; ++i )
laplace_phi_u[ k ][ i ] = trace( hessian_phi[ i ] )

This doesn't work, because at runtime it tells me that only 0 assignment is
allowed.

I've also seen that I can use shape_hessian_component since I am using
standard Q2-Q1 elements,

int component_i = fe.system_to_component( k ).first;
Tensor<2, dim> hessian_phi = fe_values.shape_hessian_component( k, q,
component_i );

In this case I can get the laplacian of the i'th component of the k'th
shape function at quadrature point q by trace( hessian_phi ). But this will
result in a rank 0 tensor. It would be much more convenient if I could
convert this back into a rank 1 tensor as the laplacian of the k'th shape
function. Again though I run into the same problem as above with only 0
assignment is allowed.

Thanks

--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see