Creating custom odb files using python scripting
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_Taylor_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=Analysis 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=Displacement,type=VECTOR,componentLabels=(1,2,3))
pDisp1 = pFrame1.FieldOutput(name=U,description=Displacement,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
Sounds interesting. I have not, as far as I can remember, created empty odb-files from Abaqus/Python. What do you need that?
I am not sure what is causing your code to fail. Can you add debug statements?
-Jorgen
Dear Jorgen
Thank you for your reply. It turns out the element connectivity for C3D8 was not in order as the convention followed by ABAQUS. I changed the order of node numbers in the element connectivity matrix and it worked. That was the reason for the failure. We were using Gmesh for post processing, but it performs erratically when you the DOFs grows. Thus ABAQUS Viewer seemed like a better solution.
- How to model viscous fluid in ABAQUS5 months ago
- UANISOHYPER_INV and SIGINI working together6 months ago
- Wave properties in dynamic structural analysis10 months ago
- Non homogenous strain in uniaxial Testcase in ABAQUS10 months ago
- Abaqus error running VUMAT - ...package.exe aborted with system error code 107374151112 months ago
- 21 Forums
- 3,863 Topics
- 13.2 K Posts
- 3 Online
- 29.3 K Members