Re: [deal.II] Extracting Shape Laplacian

2017-08-10 Thread Wolfgang Bangerth

On 08/09/2017 05:40 PM, ky...@math.uh.edu wrote:


I did try looking at the documentation for FEValuesViews::Vector 
< 
dim, spacedim >::hessian(const unsigned int shape_function, const unsigned int 
q_point)  before coming here, and all it provides is


"Return the Hessian (the tensor of rank 2 of all second derivatives) of the 
vector components selected by this view, for the shape function and quadrature 
point selected by the arguments."


Yes, the FEValuesViews::Vector::hessian(i,q) function returns the Hessian of 
the i'th shape function at the q'th quadrature point as a matrix. I think that 
ought to be clear.


The get_function_hessians() function returns a vector of tensors, which are 
the hessians of the solution at the quadrature points.


Best
 W.

--

Wolfgang Bangerth  email: bange...@colostate.edu
   www: http://www.math.colostate.edu/~bangerth/

--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [deal.II] Extracting Shape Laplacian

2017-08-09 Thread kylew
Thanks,

I did try looking at the documentation for FEValuesViews::Vector 
<
 
dim, spacedim >::hessian(const unsigned int shape_function, const unsigned 
int q_point)  before coming here, and all it provides is

"Return the Hessian (the tensor of rank 2 of all second derivatives) of the 
vector components selected by this view, for the shape function and 
quadrature point selected by the arguments."

I looked in fe_values.h to see if it was commented in the implementation 
and all that I see there is

  hessian_type return_value; 
  for (unsigned int d=0; d 

http://www.dealii.org/8.5.0/doxygen/deal.II/namespacePhysics_1_1Elasticity_1_1Kinematics.html#a15728437b942dab0b0042eb06a407d2c>
) 
if (shape_function_data[shape_function].
is_nonzero_shape_function_component[d]) 
   return_value[d] 
 = fe_values->finite_element_output.shape_hessians[
shape_function_data[shape_function].row_index[d]][q_point];

which I'm not quite sure how to parse. The comments in the header file only 
say "same as for the scalar case except that we have one more index." (the 
added index is d).

This is why I brought my question here. 

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [deal.II] Extracting Shape Laplacian

2017-08-09 Thread Wolfgang Bangerth

On 08/09/2017 03:46 PM, ky...@math.uh.edu wrote:


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 }   }?


I don't recall, but it should be documented somewhere with 
FEValuesViews::Vector IIRC.



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?


Not as you are trying, but you can easily write the summation over the last 
two indices by hand, of course.



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


|
intcomponent_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.


Yes, it is the trace of the i'th component. You can then construct a
  Tensor<1,dim> traces;
  for (i=0...dim)
{
   traces_phi = fe_values.shape_hessian_component (...);
   traces[i] = trace(hessian_phi)
}

Best
 W.

--

Wolfgang Bangerth  email: bange...@colostate.edu
   www: http://www.math.colostate.edu/~bangerth/

--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[deal.II] Extracting Shape Laplacian

2017-08-09 Thread kylew

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 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 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.