forked from XJTU-Zhou-group/abaqus-odb-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.py
66 lines (54 loc) · 2.48 KB
/
example.py
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
60
61
62
63
64
65
66
"""
Vincente Pericoli
UC Davis
10/08/15
Example file, to show you how to use the abaqus-odb-tools classes
"""
# first we must import the tools we want to use
from odbFieldVariableClasses import *
# the above only works if your files are in the same folder as the tools.
# alternatively, you can keep the abaqus-odb-tools files in a different folder.
# in that case, you would import it like this:
import sys
sys.path.append("C:\\path\\to\\abaqus-odb-tools")
from odbFieldVariableClasses import *
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# for example, say I want to obtain the (average) nodal MISES
# for nodes in a defined assembly node set:
odbFile = 'C:\\Folder\\example.odb' #or just 'example.odb' if in same folder
setName = 'example_assembly_set' #defined in abaqus CAE
dataName = 'MISES'
mises = IntPtVariable(odbFile, dataName, setName)
mises.fetchNodalAverage()
#now the attributes are populated. you can access them directly, like:
print mises.nodeLabels
print mises.resultData
#or, you can save them to a CSV file:
mises.saveCSV()
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# instead, say I want to obtain the (average) element PEEQ
odbFile = 'C:\\Folder\\example.odb' #or just 'example.odb' if in same folder
setName = 'example_assembly_set' #defined in abaqus CAE
dataName = 'PEEQ'
peeq = IntPtVariable(odbFile, dataName, setName)
peeq.fetchElementAverage()
#now the attributes are populated. you can access them directly, like:
print peeq.elementLabels
print peeq.resultData
#or, you can save them to a CSV file:
peeq.saveCSV()
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# some things to keep in mind:
# * If you define your set using the geometry option in CAE,
# Abaqus will automatically create associated node and element sets
# * Integration point variables must be averages at nodal locations,
# because they are discontinuous accross the elements (i.e. at nodes).
# This means you will likely run into problems if your set contains a
# composite material, or has *TIE constraints. Furthermore, to obtain
# the values at the nodal locations, Abaqus extrapolates using basis
# functions.
# * nodal variables work similarly, but their method is called
# fetchNodalOutput(), because they are not discontinuous...
# (no average needed)
# * this example file is just a start! read the doc strings of the classes
# for more detailed information.