Tensor operations: taking the inner product of three tensors produces a different result depending on if an intermediate variable is used
Summary
The following operations do not produce the same result for C :
- C = A & A & A;
- B = A & A; then C = B & A;
Steps to reproduce
Here is an example set of operations. Tensors B2a and B2b should be equal (since they are both S & S & S), but the results are different.
S = symm(fvc::grad(U));
B1 = S & S;
B2a = S & S & S;
B2b = B1 & S;
Example case
I have attached an example case and example application that writes the above two results.
What is the current bug behaviour?
A different result is produced for the two operations.
What is the expected correct behavior?
The two operations should produce the same result. I believe the second result (after using an intermediate variable) is correct mathematically. I am not sure yet what operation is being performed in the first case (S & S & S).
Relevant logs and/or images
Environment information
- OpenFOAM version : v2112
- Operating system :
- Hardware info :
- Compiler :
Possible fixescase_0p5.zipwriteFields_test.zip
Edited by Ryley McConkey