Making scalar values with Frobenius inner product of two 2nd order tensors

Asked by Sungick Kim

Hi.
I want to calculate a scalar value(strain energy) with two 2nd-order tensors.
In the FFC User manual,

dot(A, B) = A:B =sum(A_ij*B_ij) #When A and B are 2nd-order tensors.
But it seems not working. When I tried to project the result error poped up.
Error message is
'ufl.log.UFLException: Shape mismatch.'

My code is written below.

Q = FunctionSpace(mesh, "CG", 1)
P=dot(A, B)
ans = project(P, Q)

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Anders Logg
Solved:
Last query:
Last reply:
Revision history for this message
Best Anders Logg (logg) said :
#1

On Wed, Jan 19, 2011 at 08:48:23PM -0000, Sungick Kim wrote:
> New question #142105 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/142105
>
> Hi.
> I want to calculate a scalar value(strain energy) with two 2nd-order tensors.
> In the FFC User manual,
>
> dot(A, B) = A:B =sum(A_ij*B_ij) #When A and B are 2nd-order tensors.
> But it seems not working. When I tried to project the result error poped up.
> Error message is
> 'ufl.log.UFLException: Shape mismatch.'
>
> My code is written below.
>
> Q = FunctionSpace(mesh, "CG", 1)
> P=dot(A, B)
> ans = project(P, Q)

Use inner(A, B) instead of dot(A, B).

You should not be reading the FFC manual which describes the old form
language. Use the new UFL manual instead.

--
Anders

Revision history for this message
Sungick Kim (sungick) said :
#2

Thanks Anders Logg, that solved my question.