LightForm-group / formable

Formability analysis in Python
Mozilla Public License 2.0
2 stars 1 forks source link

Principal stress state symmetry in `get_principal_values` function #1

Open aplowman opened 4 years ago

aplowman commented 4 years ago

We need to decide and document how to order the output principal values in mathsutils.get_principal_values(). Ordering from the invoked np.eigvals() is not guaranteed, so we should apply some subsequent ordering ourselves. However, there are different options.

We start with: eigvals = np.linalg.eigvals(tensors). After this, we could:

Sort in decreasing order (positive to negative):

return np.sort(eigvals, axis=-1)[..., ::-1]

Or, sort by absolute value in decreasing order:

sort_idx = np.argsort(np.abs(eigvals), axis=-1)
return np.take_along_axis(eigvals, sort_idx, axis=-1)[..., ::-1]

This is an issue because it results in different visualisations when showing a yield function with the stress states used to fit it. It's not clear to me what symmetry we should expect.