Skip to content
Snippets Groups Projects
Commit 73e2a1ba authored by Boman Romain's avatar Boman Romain
Browse files

add mean stress calculation script

parent 0440d3e6
No related branches found
No related tags found
No related merge requests found
Pipeline #18784 passed
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
#
# extract min, max mean stress from results
# (run this script in the workspace folder)
import gmsh
import numpy as np
gmsh.initialize()
gmsh.merge('mesh.msh')
gmsh.merge('smooth_stress_tensor.msh')
dataType, tags, data, time, numComp = gmsh.view.getModelData(1, 0)
# compute sigma Von Mises from nodal sig tensor
# https://help.autodesk.com/view/fusion360/FRA/?guid=VON-MISES-STRESS-EQ-CONCEPT
svms = []
for sig in data:
[xx, xy, xz, yx, yy, yz, zx, zy, zz] = sig
svm = np.sqrt( ((xx-yy)**2 + (yy-zz)**2 + (zz-xx)**2 )/2 + 3*(xy*xy+yz*yz+zx*zx) )
svms.append(svm)
svms = np.array(svms)
print(f'svm_min = {np.min(svms)}')
print(f'svm_max = {np.max(svms)}')
print(f'svm_mean = {np.mean(svms)}')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment