Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations MintJulep on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating custom odb files using python scripting

Status
Not open for further replies.

ibrahimpolito

New member
Dec 9, 2015
1
Dear All

I am new in the forum. Currently a researcher at Politecnico di Torino, Italy. I have a problem with python script developed for creating a new odb file and adding necessary result data to it. I have experience with editing old odb files and adding additional result data into it. Still I am not been able to sort out the problem with my current script.

My script is as follows:
from abaqus import *
from caeModules import *
from abaqusConstants import *
import caePrefsAccess
from odbAccess import *

import odbAccess
import odbMaterial
import odbSection
import part
import os
import math
import numpy as ny
import visualization

#Reading the node and element data from files
nodes = ny.loadtxt('ABQ_Nodes.dat')
elements = ny.loadtxt('ABQ_Element.dat',dtype='int')

nodeLabels = []
nodeCoords = []
for node in nodes:
nodeLabels.append(int(node[0]))
nodeCoords.append(node[1:4])

odbPath = 'C:\\Abaqus_Workspace\\01_PythonScripts\\CUF_Taylo r_PostProcessing\\CUF.odb'


#Creating a viewport and adding ODB
#pView = session.Viewport(name = 'Viewport-1')

#Creating the odb
pOdb = odbAccess.Odb(name='CUF.odb',analysisTitle='CUF Analysis',path=odbPath,description='1D beam')
pOdb.save()

#Creating material for odb
pMat = pOdb.Material(name='MATERIAL')
pMat.Elastic(type=ISOTROPIC,table=((12000,0.3),))

#Creating section for odb
sectionName = 'Homogeneous Solid Section'
mySection = pOdb.HomogeneousSolidSection( name = 'defaultSec',
material = 'DefaultMat',
thickness = 1.0)

#Creating section for odb
pCat = pOdb.SectionCategory(name='odbSection',description = 'Section for odb')

# Associate the output database with the viewport.
#pView.setValues(displayedObject=pOdb)

#session.ScratchOdb(odb=pOdb)


#Creating the 3D solid part
pPart = pOdb.Part(name='beamTaylor',embeddedSpace = THREE_D,type= DEFORMABLE_BODY)
pPart.addNodes(labels = nodeLabels,coordinates = nodeCoords)
pPart.addElements(elementData = elements, type = 'C3D8',elementSetName = 'ELSETPART',sectionCategory=pCat)
pPElt = pPart.elementSets['ELSETPART']
pPart.assignSection(region=pPElt,section=mySection )

#Create a node and element set
pPartNodes= pPart.NodeSet(name='PartNodes',nodes=pPart.nodes[1:nodeLabels[-1]+1])

#Creating the instance for the solid part
pAssembly = pOdb.rootAssembly.Instance(name = 'instbeamTaylor-1',object = pPart)

#Creating section for odb

#Creating the analysis step
pStep = pOdb.Step(name='StaticAnalysis',description='Analy sis type - 101',domain=TIME,timePeriod = 1.0)

#Creating the frame for the step
pFrame0 = pStep.Frame(incrementNumber=0,frameValue=0.0000)
pFrame1 = pStep.Frame(incrementNumber=1,frameValue=1.0000)

#Reading the result file
dispValues = ny.loadtxt('DISPL_POINTS.dat',skiprows=1,usecols = (3,4,5))

#Creating the Field Output - Displacement
pDisp0 = pFrame0.FieldOutput(name='U',description='Displace ment',type=VECTOR,componentLabels=('1','2','3'))
pDisp1 = pFrame1.FieldOutput(name='U',description='Displace ment',type=VECTOR,componentLabels=('1','2','3'))

#Adding data
pDisp0.addData(position = NODAL,instance = pAssembly,labels = nodeLabels,data=dispValues)
pDisp1.addData(position = NODAL,instance = pAssembly,labels = nodeLabels,data=dispValues)

#Setting default display options
pStep.setDefaultField(pDisp0)

#pOdb.update()
pOdb.save()
pOdb.close()



In visualization module, none of the above operation occurs. In the tree, only node and element sets are present. Nothing can be visualized. Even though the script runs, the repositories are not added to the odb. It can be accessed via the terminal. When I try to open the new odb, ABAQUS crashes.

It would be great, if you could point out the problem.

Thank you in advance

Regards
Ibrahim
MUL2, Politecnico di Torino
Italy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor