-
Notifications
You must be signed in to change notification settings - Fork 2
/
lindsay_script.py
50 lines (40 loc) · 2.65 KB
/
lindsay_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
import os
os.chdir('x:/YuxiangWang/AbaqusFolder/YoshiModel/')
import numpy as np
from abqimport import *
from setfiber import *
from feconstants import materialBlockFiber as materialBlock
# %% For Yoshi's experiment
# The fast one
stimBlock = getStimBlockFromCsv('x:/YuxiangWang/DataAnalysis/YoshiRecordingData/csvs/stim_block_2.csv')
fiber = Fiber(baseModelName='LindsayFiberFast', suffix='', stimBlock=stimBlock, materialBlock=materialBlock, runFiber=True, doAnalysis=False, skipWait=True)
np.savetxt('./csvs/'+fiber.baseModelName+'StaticForceDispl.csv', np.column_stack((fiber.staticDisplList, fiber.staticForceList)), delimiter=',')
for i, model in enumerate(fiber.modelList):
output = np.c_[model.time, model.force, model.displ, model.stress, model.strain, model.sener]
np.savetxt('./csvs/'+fiber.baseModelName+'Output'+str(i)+'.csv', output, delimiter=',')
# The slow one
stimBlock['rampLiftTimeArray'] *= 4
fiber = Fiber(baseModelName='LindsayFiberSlow', suffix='', stimBlock=stimBlock, materialBlock=materialBlock, runFiber=True, doAnalysis=False, skipWait=True)
np.savetxt('./csvs/'+fiber.baseModelName+'StaticForceDispl.csv', np.column_stack((fiber.staticDisplList, fiber.staticForceList)), delimiter=',')
for i, model in enumerate(fiber.modelList):
output = np.c_[model.time, model.force, model.displ, model.stress, model.strain, model.sener]
np.savetxt('./csvs/'+fiber.baseModelName+'Output'+str(i)+'.csv', output, delimiter=',')
# The sinusoidal run
stimBlock = getStimBlockFromCsv('x:/YuxiangWang/DataAnalysis/YoshiRecordingData/csvs/stim_block_2.csv')
fiber = Fiber(baseModelName='LindsayFiberFast', suffix='', stimBlock=stimBlock, materialBlock=materialBlock, runFiber=False, doAnalysis=False, skipWait=True)
np.savetxt('./csvs/'+fiber.baseModelName+'StaticForceDispl.csv', np.column_stack((fiber.staticDisplList, fiber.staticForceList)), delimiter=',')
for i, model in enumerate(fiber.modelList):
output = np.c_[model.time, model.force, model.displ, model.stress, model.strain, model.sener]
np.savetxt('./csvs/'+fiber.baseModelName+'Output'+str(i)+'.csv', output, delimiter=',')
# %% For the simulations
def runSimulation(baseModelName, materialBlock):
# Run displacement controlled analysis
fiber = Fiber(baseModelName=baseModelName, materialBlock=materialBlock, runFiber=True, doAnalysis=True, skipWait=True)
# Now to force controlled
fiberForce = FiberForce(fiber, runFiber=True, doAnalysis=True, skipWait=True)
return
runSimulation('Lindsay', materialBlock)
from readodb import getSurfaceDistribution
for fname in os.listdir('./odbs'):
if fname.endswith('.odb') and fname.startswith('Lindsay'):
getSurfaceDistribution(fname[:-4])