# tensor operation for elasticity

Hi,

I want to write down the Hook's law in UFL, sigma=C: e, that is, sigma_{

Right now, I have C as a four dimensional numpy array. How can I convert C to a rank 4 tensor and write down the UFL expression above? Thanks.

## Question information

- Language:
- English Edit question

- Status:
- Solved

- For:
- DOLFIN Edit question

- Assignee:
- No assignee Edit question

- Solved by:
- Shiyuan

- Solved:
- 2013-02-06

- Last query:
- 2013-02-06

- Last reply:
- 2013-02-05

Martin Sandve Alnæs (martinal) said : | #1 |

Check out as_tensor.

Martin

Den 5. feb. 2013 01:46 skrev "Shiyuan" <email address hidden>

følgende:

> New question #221062 on DOLFIN:

> https:/

>

> Hi,

> I want to write down the Hook's law in UFL, sigma=C: e, that is,

> sigma_{

>

> Right now, I have C as a four dimensional numpy array. How can I convert C

> to a rank 4 tensor and write down the UFL expression above? Thanks.

>

> --

> You received this question notification because you are a member of

> DOLFIN Team, which is an answer contact for DOLFIN.

>

Shiyuan (gshy2014) said : | #2 |

as_tensor(C) gives a rank-4 tensor. What about the summation:

sigma_

It is not a dot(), inner() or outer(). Is there a concise UFL expression for this summation? Thanks.

Martin Sandve Alnæs (martinal) said : | #3 |

One of the main features of UFL is generic tensor notation with implicit

summation, check

out the UFL chapter in the FEniCS book, available for download from the

fenics webpage.

Martin

On 5 February 2013 17:45, Shiyuan <email address hidden>wrote:

> Question #221062 on DOLFIN changed:

> https:/

>

> Status: Answered => Open

>

> Shiyuan is still having a problem:

> as_tensor(C) gives a rank-4 tensor. What about the summation:

> sigma_{

>

> It is not a dot(), inner() or outer(). Is there a concise UFL expression

> for this summation? Thanks.

>

> --

> You received this question notification because you are a member of

> DOLFIN Team, which is an answer contact for DOLFIN.

>

Shiyuan (gshy2014) said : | #4 |

This is my solution:

C_

stress=