-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpostP.py
More file actions
59 lines (45 loc) · 1.9 KB
/
postP.py
File metadata and controls
59 lines (45 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# coding=utf-8
from abaqus import *
from abaqusConstants import *
import os
import displayGroupOdbToolset as dgo
if 'JobName' not in locals():
JobName = 'Probeta_2'
jobFileName = 'C:/temp/{}.odb'.format(JobName)
resultsFileName = "{}.csv".format(JobName)
#Open results file
o1 = session.openOdb(name=jobFileName)
session.viewports['Viewport: 1'].setValues(displayedObject=o1)
# Create viewport session
session.viewports['Viewport: 1'].setValues(
displayedObject=session.mdbData['Model-1'])
################## Filter Nodes ##################
leaf = dgo.LeafFromNodeSets(nodeSets=('PART-1-1.GALGA', ))
session.viewports['Viewport: 1'].odbDisplay.displayGroup.replace(leaf=leaf)
#: Warning: Display groups containing only nodes are not supported in contour plot mode. Select a different plot mode and activate node symbols and/or labels to see the selected nodes.
session.viewports['Viewport: 1'].odbDisplay.display.setValues(plotState=(
UNDEFORMED, ))
################# Create results.csv ##################
session.viewports['Viewport: 1'].makeCurrent()
session.fieldReportOptions.setValues(reportFormat=COMMA_SEPARATED_VALUES)
session.writeFieldReport(fileName=resultsFileName, append=OFF,
sortItem='Node Label', odb=o1, step=0, frame=1, outputPosition=NODAL,
variable=(('S', INTEGRATION_POINT, ((COMPONENT, 'S11'), ), ('LAYER_1',
TOP)), ), stepFrame=SPECIFY)
################## Extract Media from .csv ##################
import csv
sumatorio =0.0
puntos=0.0
with open(resultsFileName,'rt')as f:
#Sikp header
data = csv.reader(f)
next(data)
for row in data:
sumatorio += float(row[-1])
puntos +=1
tensionMediaS11 = (sumatorio/puntos)
numNodos = len (part1.nodes)
numElementos = len (part1.elements)
resultado = {"name": JobName, "#Nodos": numNodos,
"#elementos":numElementos, "tensionMediaS11": tensionMediaS11,}
print resultado