generalized inner product with tensor vs. matrix fields

I've a customer that reported an issue with the generalized inner product operator when using a tensor. He is trying to replicate a known example from https://www.continuummechanics.org/tractionvector.html, where a stress tensor is dotted with a vector to calculate a traction vector. The output when using a tensor is incorrect, meaning if he takes the stress tensor generated by Mechanical and performs this operation, it will be incorrect. If he builds the matrix in DPF as the example and performs this operation, it works exactly as expected. This would mean he has to manually add the off-diagonal terms that Mechanical does not include in the tensor. Is there a method around this?
For reference, this is the code we are using, based on the link above. Outputs for traction and traction2 should be indentical.
n=dpf.FieldsFactory.CreateVectorField(numEntities=1,numComp=3) n.Data=[.4,.6,.693] n.ScopingIds=[1] tensor=dpf.FieldsFactory.CreateTensorField(numEntities=1) tensor.Add(id=1,data=[50.,95.,15.,10.,20.,30.]) op = dpf.operators.math.generalized_inner_product() # operator instantiation op.inputs.fieldA.Connect(tensor) op.inputs.fieldB.Connect(n) traction = op.outputs.field.GetData() print traction matrix=dpf.FieldsFactory.CreateMatrixField(1,3,3) matrix.Add(1,[50.,10.,30.,10.,95.,20.,30.,20.,15.]) op = dpf.operators.math.generalized_inner_product() # operator instantiation op.inputs.fieldA.Connect(matrix) op.inputs.fieldB.Connect(n) traction2 = op.outputs.field.GetData() print traction2
Answers
-
Hi @a_austin, thanks for your question! I am not sure, but I think the @Structures-Scripting-Team should be able to help, or point you in the right direction!
0 -
@a_austin this was a known issue at least till 2024R2, which version is the customer using? Please refer to this post on GitHub, a workaround is mentioned as well.
1 -
Thank you for this... so basically what I asked... define the matrix manually. At least we know it is fixed at 25R2. Thanks again!
0