コード例 #1
0
ファイル: cuboidTest_voronoi.py プロジェクト: messai1/compmod
sy_field = FieldOutput(labels = mesh.labels, data = sy, position = "element")

if Run_simu:
  model.MakeInp()
  model.Run()
  model.MakePostProc()
  model.RunPostProc()
else:
  model.LoadResults()
# Plotting results
if model.outputs['completed']:
  U = model.outputs['field']['U'][0]
  mesh.nodes.apply_displacement(U)
  f = open("cuboidTest_voronoi.vtk", "w")
  f.write(mesh.dump2vtk())
  f.write(sy_field.dump2vtk(name = "Yield_Stress"))
  f.write( model.outputs['field']['S'][0].vonmises().dump2vtk(name = "Von_Mises_Stress"))
  f.close()
  
  # History Outputs
  disp =  np.array(model.outputs['history']['disp'].values()[0].data[0])
  force =  np.array(np.array(model.outputs['history']['force'].values()).sum().data[0])
  volume = np.array(np.array(model.outputs['history']['volume'].values()).sum().data[0])
  length = ly + disp
  surface = volume / length
  logstrain = np.log10(1. + disp / ly)
  linstrain = disp/ly
  strain = linstrain
  stress = force / surface 
   
  fig = plt.figure(0)
コード例 #2
0
from abapy.postproc import FieldOutput
from abapy.mesh import Mesh, Nodes
x = [0.,1.,0.]
y = [0.,0.,1.]
z = [0.,0.,0.]
labels = [1,2,3]
nodes = Nodes(x=x,y=y,z=z, labels=labels)
mesh = Mesh(nodes=nodes)
mesh.add_element(label = 1 , connectivity = [1,2,3], space = 2 , name = 'tri3') # triangle element
nodeField = FieldOutput()
nodeField.add_data(data = 0., label = 1)
nodeField.add_data(data = 10., label = 2)
nodeField.add_data(data = 20., label = 3)
elementField = FieldOutput(position='element')
elementField.add_data(label = 1, data =10.)
out = ''
out+=mesh.dump2vtk()
out+=nodeField.dump2vtk('nodeField')
out+=elementField.dump2vtk('elementField')
f = open("FieldOutput-dump2vtk.vtk", "w")
f.write(out)
f.close()
コード例 #3
0

if Run_simu:
  model.MakeInp()
  model.Run()
  model.MakePostProc()
  model.RunPostProc()
else:
  model.LoadResults()
# Plotting results
if model.outputs['completed']:
  U = model.outputs['field']['U'][0]
  mesh.nodes.apply_displacement(U)
  f = open(label + ".vtk", "w")
  f.write(mesh.dump2vtk())
  f.write(sy_field.dump2vtk(name = "Yield_Stress"))
  f.write( model.outputs['field']['S'][0].vonmises().dump2vtk(name = "Von_Mises_Stress"))
  f.close()
  
  # History Outputs
  force = -2. * model.outputs['history']['force']
  disp = -2. * model.outputs['history']['disp']
 
   
  fig = plt.figure(0)
  plt.clf()
  sp1 = fig.add_subplot(1, 1, 1)
  plt.plot(disp.data[0], force.data[0], 'ro-', label = 'Loading', linewidth = 2.)
  plt.plot(disp.data[1], force.data[1], 'bv-', label = 'Unloading', linewidth = 2.)
  plt.legend(loc="upper left")
  plt.xlabel('Displacement, $U$')
コード例 #4
0
from abapy.postproc import FieldOutput
from abapy.mesh import Mesh, Nodes
x = [0., 1., 0.]
y = [0., 0., 1.]
z = [0., 0., 0.]
labels = [1, 2, 3]
nodes = Nodes(x=x, y=y, z=z, labels=labels)
mesh = Mesh(nodes=nodes)
mesh.add_element(label=1, connectivity=[1, 2, 3], space=2,
                 name='tri3')  # triangle element
nodeField = FieldOutput()
nodeField.add_data(data=0., label=1)
nodeField.add_data(data=10., label=2)
nodeField.add_data(data=20., label=3)
elementField = FieldOutput(position='element')
elementField.add_data(label=1, data=10.)
out = ''
out += mesh.dump2vtk()
out += nodeField.dump2vtk('nodeField')
out += elementField.dump2vtk('elementField')
f = open("FieldOutput-dump2vtk.vtk", "w")
f.write(out)
f.close()