Dear Alex,

What you've stated is correct. The tensor component $S_{ij}$ is exactly 
component S[i][j] of a Tensor<2,dim> S if "S" represents $S_{ij} = \partial 
v_{i} \partial x_{j}$.

As for an example, both steps 18 
<https://dealii.org/developer/doxygen/deal.II/step_18.html#TopLevelupdate_quadrature_point_history>
 
and 44 
<https://dealii.org/developer/doxygen/deal.II/step_44.html#Solidupdate_qph_incremental>
 
both extract gradient of the vector-valued solution field. In step-18, the 
gradient tensor is constructed manually after a the call to 
fe_values.get_function_gradients 
<https://dealii.org/developer/doxygen/deal.II/classFEValuesBase.html#a69c63f8be0311c8970253276ac7df138>
 
(incremental_displacement,
                                 displacement_increment_grads);
while in step-44 an extractor is used as well in order to produce $\Grad 
\mathbf{u}$ (u representing the displacement) at each quadrature point 
directly:
  scratch.fe_values_ref[u_fe].get_function_gradients(scratch.solution_total,
                                                    scratch.
solution_grads_u_total);

Depending on whether or not you use an extractor to perform this task, the 
data structure in which the result is placed (here, 
displacement_increment_grads 
and scratch.solution_grads_u_total) is slightly different. When using an 
extractor you will end up with the vector (each entry representing data at 
a quadrature point) of rank-2 tensors because it is known that this is the 
gradient of a vector field - this would be exactly "S" if the extractor 
pertains to the velocity field. In contrast, the FEValues object knows 
nothing about the solved fields if no extractor is used, so you'd have to 
reconstruct "S" manually, in a similar way to that which is done in step-18.

I hope that this helps clarify things a little bit.

Best regards,
Jean-Paul


On Wednesday, April 5, 2017 at 1:10:00 PM UTC+2, Alex Zimmerman wrote:
>
> I am debugging a code where part of my weak form requires indexing into 
> the Tensor<2,dim> that results from getting the gradient of a Tensor<1,dim> 
> (in this case, a velocity vector).
>
> I found the convention for the index notation here: 
> http://dealii.org/8.4.1/doxygen/deal.II/classFEValuesViews_1_1Vector.html
>
> The important part of that documentation for me is that "The gradient of a 
> vector $d_k, 0 <= k < dim$ is defined as $S_{ij} = \frac{\partial 
> d_i}{\partial x_j}, 0 <= i,j < dim$.
>
> What is the exact syntax for getting component $S_{ij}$ in my code? For a 
> Tensor<2,dim> S
>
> I am currently assuming that I want 
> S[i][j]
>
> But I am not 100% sure that don't have this backwards. I have reviewed the 
> documentation about how these tensors are rolled/unrolled; but I'm having 
> trouble devising a test to ensure that I am understanding this correctly, 
> and I'm guessing that this is something quite obvious to most users.
>
> Also it would help if someone could point me toward an existing 
> tutorial/example that accesses components of the gradient of a physical 
> vector. I had no luck finding one.
>
> Thanks,
>
> Alex
>

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

Reply via email to