abaqus python提取楼层剪力,从变形的测试对象中提取节点坐标(abaqus-python)

I am trying to make a python script to extract the nodal coordinates from the ODB file (from abaqus).

So far i have come up with the code attached below (don't mind the extra information i put behind the #, sometimes it's just so i can keep track of what i'm doing)

The problem is that the coordinates i extract are those from the undeformed test subject. and i need the coordinates of the nodes from the deformed test subject.

Can somebody help me with how i reach this information using python code?

from abaqus import *

from abaqusConstants import *

import __main__

import section

import regionToolset

import displayGroupMdbToolset as dgm

import part

import material

import assembly

import step

import interaction

import load

import mesh

import optimization

import job

import sketch

import visualization

import xyPlot

import displayGroupOdbToolset as dgo

import connectorBehavior

import shutil

import os

import sys

from odbAccess import openOdb

for ODBname in os.listdir("D:/r0333338/Documents/MP/nodal_files_genereren/OBD"): # this is where all your ODB files are located #t hier wordt ook de odb file gekozen die geopend zal worden

SUBname = ODBname[1:3] # My subject ID is saved in the ODB name - this helps me create the file #woerdt er hier de 3e tot6e letter van de ODBname gepakt ?

print 'Current File: '+ODBname #voor check welke file er gebruikt wordt #t (ZIT '.odb' hier bij in ?)

ODBnamefull = 'D:/r0333338/Documents/MP/nodal_files_genereren/OBD/'+ODBname # Full path to the ODB file, otherwise abaqus tries to find it in default work directory

odb = openOdb(path=ODBnamefull) #open the ODB file

assembly = odb.rootAssembly #t declareren van assembly?

session.viewports['Viewport: 1'].odbDisplay.setFrame(step=0, frame=1)

numNodes = 0 #t num nodes op nul zetten

f = open("D:/r0333338/Documents/MP/nodal_files_genereren/ODBoutput/nodal.txt", "w") #indien het bestand al bestaat moet er "a" staan ipv "w"

for name, instance in assembly.instances.items(): #t 'name' is naam van elke part van in de assembly ?

n = len(instance.nodes) #t tellen van hoeveelheid nodes

print 'Number of nodes of instance %s: %d' % (name, n) #moet niet in de file staan, kan eigenlijk weggelaten worden. (maar is een goede check?)

numNodes = numNodes + n #tellen van totaal aantal nodes (globaal over alle parts) maar is eigenlijk niet nodig?

f.write( "*Part, name=Part-1" + "\n")#moet erin staan volgens de MatchId regels

f.write( "*Nodes" + "\n") #moet erin staan volgens de MatchId regels

if instance.embeddedSpace == THREE_D: #indien het 3D is

print ' X Y Z' #moet niet in de file staan, maar is een goede check om te zien waar we zitten

for node in instance.nodes:

#print node #printen van node

f.write( str(node.label) + ";" ) #schrijven van nodenummer

f.write(str(node.coordinates[0]) + ";" + str(node.coordinates[1]) + ";" + str(node.coordinates[2]) + "\n") #schrijven van coordinaten [X;Y;Z] en enter

else: #indien het 2D is

print ' X Y' ';0' #moet niet in de file staan, maar is een goede check om te zien waar we zitten

for node in instance.nodes:

#print node #printen van node

f.write( str(node.label) + ";" )

f.write(str(node.coordinates[0]) + ";" + str(node.coordinates[1]) + ";" + str(node.coordinates[2]) + "\n") #schrijven van coordinaten [X;Y;Z] en enter

f.write( "*End Part" ) #moet erin staan volgens de MatchId regels

f.close()

解决方案

get the displacement field:

u=odb.steps['Step-1'].frames[-1].fieldOutputs['U']

then u.values is a list of all nodal values:

u.values[i].data -> array of (ux,uy,uz)

u.values[i].nodeLabel -> node label

then you grab the original position like this:

instance.getNodeFromLabel(u.values[i].nodeLabel).coordinates

You can also directly get the deformed coordinate as a field output, but you need to request COORD output when you run the analysis.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值