generalized inner product with tensor vs. matrix fields

a_austin
a_austin Member Posts: 2
First Comment
**
edited April 29 in Structures

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
Tagged:

Answers