Hello everyone,
I just encountered a simple tensorial double contraction and did not know how exactly to write using ufl. If I am having three tensor A,B,C then what exactly the easiest way to perform the double contraction like A:B:C
Any one please provide suggestion over the same. Unfortunately I am not able to write this in my code and struggling to continue. So any help will be appreciated.
@Denis if you can contract two tensors A and B over some index i to obtain a tensor K, then you can contract once more K with C over some index j.
See if Form language — Unified Form Language (UFL) 2024.2.0.dev0 documentation helps. It explains indexing on tensors.
If i am understood from that correctly, as per the suggestion, i have to do inner A and B to get some K and then to do inner K and C?
Am i understood this correctly? Thanks in advance.
@Denis inner will contract all indices. You want to contract A and B over some index i and then the result and C over some index j. You have to choose i and j. If you use dot, you will contract over the last index of A and the first of B. If you use inner, you will contract over all indices, leaving you with a scalar. (assuming the tensors have the same shape)
Thanks for the response nchatz. Indeed I need the final answer as a scalar. Here my A and C were the second order tensor and the one in middle is fourth order. So in this case is the procedure i told will suffice?
Yes, you just have to be careful to contract in the right order over the indices. The 4-rank vector B has 4 indices, so you need to choose 2 to contract with A and 2 with C.