二次開發自我總結_第1頁
二次開發自我總結_第2頁
二次開發自我總結_第3頁
二次開發自我總結_第4頁
二次開發自我總結_第5頁
已閱讀5頁,還剩1頁未讀 繼續免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、odb結構如圖上所示(來自于doc),可以很明顯地分成兩部分:model data、result data。 所以要獲取節點信息,材料信息,part信息以及截面信息得用到odb.assembly, odb.material, odb.parts, odb.sections;而要提取應力,應變等結果就得用到odb.steps。我們先一步步 看看如何查看odb中的信息,最后匯總一下就知道如何寫一個有特定功能的腳本了。首先我們需要用到讀取odb文件的python包,得用到import。from odbaccess import * 打開你要讀的文件,這里就是 viewer_tutorial.odb

2、: odb=openodb(r c:sujingheviewer_tutorial.odb )查看這個 odb 文件的具體信息:print odb輸出如下:(analysistitle:dynamicloadingofanelastomeric,viscoelastic, closed: false, customdata: python object wrapper, description: ddb object, diagnosticdata: odbdiagnosticdata object, isreadonly: false, jobdata:jobdataobject,mater

3、ials: parts:repository repositoryobject, object,name: path:c:/sujinghe/viewer_tutorial.odb,c:/sujinghe/viewer_tutorial.odb, profiles: repository object, readinternalsets:false, rootassembly: odbassembly object, sectioncategories: repository object,sections: repository object, sectordefinition: none,

4、 steps: repository object, userdata: userdata object)可以顯示各種數據的儲存格式,其中可以看到 odbassembly object 存放當前 odb 的 assembly 相關信息,而其他的 repository object 表 示當前對象存儲在類似字典類型的數據結構中。整體用()括起來表示這應該是一個對象, 而后面里面的都是這個對象的成員(members),他們可以用odb.xxx來獲得引用,下面逐一 查看。察看 analysistitle : print odb.analysistitle 察看 rootassembly : asse

5、mbly=odb.rootassembly print assembly 輸出口下:connectororientations: repositoryobject,connectororientationarray elementsets:repositoryobject, object,datumcsyses:elements:odbmeshelementarray object, instances: repository object, name: assembly-1, nodesets:repositoryobject,nodes:odbmeshnodearrayobject,obj

6、ect,pretensionsections: odbpretensionsectionarray rigidbodies:odbrigidbodyarray object, sectionassignments: sectionassignmentarray object, surfaces: repository object)繼續:print ,即可得到 assembly 的名字 assembly-1 我們詳細查看幾個數據:nodes, instances, nodesets node=assembly.nodes print len(node)看到輸出為0,o

7、db中node信息應該單獨存在每個instance中的。 isnt=assembly.instances print inst輸出:partTT: odbinstance object inst=instpartTT print inst 輸出: (analyticsurface: none, beamorientations: beamorientationarray object, elementsets: repository object, elements: odbmeshelementarray object, embeddedspace:axisymmetric,material

8、orientations:materialorientationarray object, name: part-1-1, nodesets: repository object, nodes: odbmeshnodearray object, rebarorientations: rebarorientationarray object, rigidbodies:odbrigidbodyarray object,surfaces:object,sectionassignments:object,type:sectionassignmentarray deformable_body)repos

9、itory可以看到上面列出了這個instance的各種信息2.2.1 instance 上面定義的 elementset print inst.elementsets輸出:cent: odbset object, etop: odbset object, foam: odbset object, pmass: odbset object, upper: odbset object只有,這個表示這個對象是一個字典類型的數據,得用xxx yyy 來獲得引用,比 如 print inst.elementsetscent輸出: (elements: odbmeshelementarray object

10、, faces: none, instances: none, isinternal: false, name: cent, nodes: none) print inst.elementsetscent.elements輸出:odbmeshelement object, odbmeshelement object, odbmeshelement object, odbmeshelement object, odbmeshelement object, odbmeshelement object, odbmeshelement object,。繼續深入:ele= inst.elementset

11、scent.elements0 print ele輸出: (connectivity: (3, 43, 41, 1), instancename: part-1-1, instancenames: (part-1-1,part-1-1,part-1-1,part-1-1), label: 1, sectioncategory:sectioncategory object, type: cax4)可以看到單元集合中每個單元的詳細數據,編號, 節點,單元類型等,注意這個也是一個對象(用()括起來的),必須用xxx.xxx來引用, 如 ele.connectivity。2.2.2 instance

12、上面定義的 nodeset nodeset=inst.nodesets print nodeset輸出:alln: odbset object, bot: odbset object, center: odbset object, n1: odbset object, n19: odbset object, n481: odbset object, n499: odbset object, punch: odbset object, top: odbset object我們也可以用類似上面讀elementsets的方法讀取nodeset 中的每一個具體 set 的信息 2.2.3 instan

13、ce 的 node 信息 node=inst.nodes node1= node0 print node1輸出:(coordinates: array(0.0, 300.0, 0.0, d), instancename: part-1-1, label: 1)這是這個instance的第一個節點的信息,節點編號、初始坐標、所屬instance,它是用 ()括起來的所以的用xxx.xxx來獲得引用,比如coord=node1. coordinates coordx=coord0 print coord,coordx通過上面的方法就可以得到model中的node信息,用類似的方法也可以看到mode

14、l中的 element 信息。2.3 assembly 上面定義的 nodeset nodeset=assembly.nodesetsprint nodeset輸出: all nodes: odbset object,看來他也沒有特別定義什么節點集合。 nodeset=nodeset all nodes print nodeset 輸出很多:(elements: none, faces: none, instances: (analyticsurface: none, beamorientations: beamorientationarray object, elementsets: rep

15、ository object, elements:odbmeshelementarray object, embeddedspace: object, name:three_d, part-1-1, object, materialorientations: nodesets: materialorientationarray object, nodes:repository odbmeshnodearray object, rebarorientations: rebarorientationarray rigidbodies: odbrigidbodyarray object, secti

16、onassignments: sectionassignmentarray object, surfaces: repository object, type: deformable_body),), isinternal: false, name: all nodes, nodes: (odbmeshnode object, odbmeshnode object, odbmeshnode object,。重點看nodes,注意它的形式:(口,:)其實是元組套列表的形式 nodeset=nodeset.nodes0 print nodeset輸出:odbmeshnode object, odb

17、meshnode object, odbmeshnode object, odbmeshnode object, odbmeshnode object, odbmeshnode object,odbmeshnode object,。 深入一層:node1=nodeset0 print nodel輸出:(coordinates: array(0.0, 300.0, 0.0, d), instancename: part-1-1, label: 1)這個時候我們就可以看到這個nodeset中的第一個節點信息了。下面的語句可以提取具體 信息:print node1.coordinates得到節點坐標

18、0.300.0.print node1.label得到節點編號1查看 material信息mat=odb.materialsprint mat輸出:foam: material object可以看見這個模型中唯一的材料類型foam,用xxx xxx 繼續查看:mat=matfoamprint mat輸出: (density: density object, description: , hyperfoam: hyperfoam object, materialidentifier: , name: foam, viscoelastic: viscoelastic object)可以看到這個模型

19、中定義了 density, viscoelastic, hyperfoam等屬性繼續深入,()用xxx.xxx:dens=mat. densityprint dens輸出:(dependencies:。,table: (1e-11,),), temperaturedependency: off) 繼續: values= dens.table00print values得到密度值:1e-11用同樣的方法可以得到其他想要的材料定義值4查看step信息,這其中儲藏了 odb單元應力應變以及節點位移等等值。首先得說明的是 應力應變時基于積分點的,只能在單元上查詢;而位移以及反力都是基于節點的,必須在節

20、 點上查詢。step=odb.stepsprint step輸出:step-1: odbstep object, step-2: odbstep object, step-3: odbstep object 可以看到一共有三個step,這里我們示范看一下step-3的計算數據step3=stepstep-3print step3輸出:(acousticmass: 0.0, acousticmasscenter: (), description: remove load., domain: time, eliminatednodaldofs: nodaldofsarray object, fra

21、mes: odbframearray object, historyregions: repository object, inertiaaboutcenter:(),inertiaaboutorigin: (), loadcases: repository object, mass: 0.0, masscenter:(), name: step-3, nlgeom: true, number: 3, previousstepname: step-2, procedure: *dynamic, retainedeigenmodes: (), retainednodaldofs: nodaldo

22、fsarray object, timeperiod: 10.0, totaltime: 6.0)可以看到這一步的具體信息,可以把它打印出來print step3.timeperiod指的是當前步的time,而totaltime指的是該步以前的所有步所經歷的總時間。4.2 frames中儲藏的才是我們的計算結果frame=step3.framesprint len(frame)輸出27可以看出,這一步總共有26個增量步(另外一個是初始時刻)我們現在看第24步時候的 計算結果:frame24=frame24print frame24輸出:(cyclicmodenumber: none, desc

23、ription: increment240: step time =4.906, domain: time, fieldoutputs: repository object, frameid: 240, framevalue:4.90593481063843, frequency: none, incrementnumber: 240, isimaginary: false, loadcase: none, mode: none)其中記錄了該增量步的具體信息:incrementnumber,framevalue (指的是該分析步的時 間),可以通過xxx.xxx來獲得引用,比如print fr

24、ame24. framevalue就輸出:4.90593481063843查看計算結果數據:output=frame24. fieldoutputsprint output輸出:a: fieldoutput object, ar3: fieldoutput object, copentarget/impactor: fieldoutput object, cpresstarget/impactor: fieldoutput object, cshear1target/impactor: fieldoutput object, cslip1target/impactor: fieldoutput

25、 object, le: fieldoutput object, : fieldoutput object, rm3: fieldoutput object, s: fieldoutput object, u: fieldoutput object, ur3: fieldoutput object, v: fieldoutput object, vr3: fieldoutput object可以看到這里面a, ar3, cpress, cshear1, rf, s, v, u等等數據我們查看一下u和s兩個最常用的uu=outputuss=outputsprint uuprint ssoutof

26、plane_principal, min_inplane_principal, max_principal, mid_principal, min_principal, tresca, press, inv3), values: fieldvaluearray object)具體的值都儲存在values里面u=uu.valuesprint u0輸出:(baseelementtype: , conjugatedata: none, conjugatedatadouble: unknown, data: array(3.8507681799646e-42, -76.8765869140625, d

27、), datadouble: unknown, elementlabel: none, face: none, instance: odbinstance object, integrationpoint: none, inv3: none, localcoordsystem: none, localcoordsystemdouble:maxinplaneprincipal: none, unknown, magnitude: none, 76.8765869140625, midprincipal: none, maxprincipal:mininplaneprincipal: none,

28、minprincipal: none, mises: none, nodelabel: 1, outofplaneprincipal: none, position: nodal, precision: single_precision, press: none, sectionpoint: none, tresca: none, type: vector)這是1號節點(注意position: nodal表明該數據位于節點上)上的位移值,用xxx.xxx 可以讀取具體數據:print u0.data 得到3.85076818e-42-7.68765869e+01print u0. magnitude得到 76.8765869141s=ss.valuesprint s0輸出:(baseelementtype: cax4, conjugatedata: none, conjugatedatadouble: unknown, dat

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
  • 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論