-
Notifications
You must be signed in to change notification settings - Fork 2
/
varmech_script.py
72 lines (56 loc) · 2.3 KB
/
varmech_script.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
67
68
69
70
71
import os
os.chdir('x:/YuxiangWang/AbaqusFolder/YoshiModel/')
from abqimport import *
from setfiber import *
import copy
skinThickArray, skinAlphaArray, sylgardThickArray, sylgardC10Array, g1Array, g2Array, ginfArray = np.genfromtxt('./csvs/simprop.csv', delimiter=',').T
runFiber = False
doAnalysis = True
skipWait = True
def runSimulation(baseModelName, materialBlock):
# Run displacement controlled analysis
fiber = Fiber(baseModelName=baseModelName, materialBlock=materialBlock, runFiber=runFiber,
doAnalysis=doAnalysis, skipWait=skipWait)
# Now to force controlled
fiberForce = FiberForce(fiber, runFiber=runFiber, doAnalysis=doAnalysis, skipWait=skipWait)
return
# Vary skin thickness
for (level, skinThick) in enumerate(skinThickArray):
# Assign material properties
materialBlock = copy.deepcopy(materialBlockDefault)
materialBlock['thicknessAll'][0] = skinThick
runSimulation('SkinThick%d'%level, materialBlock)
# Vary skin alpha
for (level, skinAlpha) in enumerate(skinAlphaArray):
# Assign material properties
materialBlock = copy.deepcopy(materialBlockDefault)
materialBlock['skin_alpha'] = skinAlpha
runSimulation('SkinAlpha%d'%level, materialBlock)
# Vary skin viscoelasticity
for (level, ginf) in enumerate(ginfArray):
# Get g1, g2, ginf
g1 = g1Array[level]
g2 = g2Array[level]
# Assign material properties
materialBlock = copy.deepcopy(materialBlockDefault)
materialBlock['skin_g_array'] = [ginf, g2, g1]
runSimulation('SkinGinf%d'%level, materialBlock)
# Vary sylgard thickness
for (level, sylgardThick) in enumerate(sylgardThickArray):
# if level < 4:
# continue
# Assign material properties
materialBlock = copy.deepcopy(materialBlockDefault)
materialBlock['thicknessAll'][2] = sylgardThick
runSimulation('SylgardThick%d'%level, materialBlock)
# Vary sylgard c10
for (level, sylgardC10) in enumerate(sylgardC10Array):
# Assign material properties
materialBlock = copy.deepcopy(materialBlockDefault)
materialBlock['sylgard_c10'] = sylgardC10
runSimulation('SylgardC10%d'%level, materialBlock)
# Get distribution csvs
from readodb import getSurfaceDistribution
for fname in os.listdir('./odbs'):
if fname.endswith('.odb') and fname.startswith('S'):
getSurfaceDistribution(fname[:-4])