User login

Navigation

You are here

Create simple ODB without submitting a job

Hello. 

I'm looking to create a simple ODB file using my model in session so that I can display an orientation tensor in a custom field.  I'm able to create an ODB for a 2d part (made of s4 elements), but my system crashes whenever I load the ODB for my 3d part (made of c3d8 elements).

Here is my script. Any help would be greatly appreciated!

 

from abaqusConstants import * 

from odbAccess import *

from textRepr import *

odb = Odb(name='4',

    analysisTitle='derived data',

    description='test problem',

    path='4.odb')

 

sCat = odb.SectionCategory(name='solid', 

    description='Test')

 

part1 = odb.Part(name='part-1',embeddedSpace=THREE_D, type=DEFORMABLE_BODY)

sect = odb.HomogeneousSolidSection('test-sect','test-mat')

 

nodeData = [(1, -5.0, -5.0, 10.0), (2, -5.0, 5.0, 10.0), (3, -5.0, -5.0, 0.0), (4, -5.0, 5.0, 0.0), (5, 5.0, -5.0, 10.0), (6, 5.0, 5.0, 10.0), (7, 5.0, -5.0, 0.0), (8, 5.0, 5.0, 0.0)]

part1.addNodes(nodeData=nodeData, nodeSetName='nset-1') 

 

elementData = [(1, 4, 5, 7, 6, 0, 1, 3, 2)]

part1.addElements(elementData=elementData, type='C3D8',

    elementSetName='eset-1', sectionCategory=sCat)

 

assembly = odb.rootAssembly

instance1 = assembly.Instance(name='part-1-1', object=part1)

 

# An element set on an instance

eLabels = [1]

elementSet = instance1.ElementSetFromElementLabels(

    name='eall',elementLabels=eLabels)

# A node set on the rootAssembly

instance1.NodeSetFromNodeLabels('nall', (1,2,3,4,5,6,7,8))

 

step1 = odb.Step(name='step-1', description='', domain=TIME, timePeriod=1.0)

frame1 = step1.Frame(incrementNumber=1, frameValue=0.1, description='')

fieldout = frame1.FieldOutput(name="FO", description="Fiber Orientation Data", type=TENSOR_3D_FULL, isEngineeringTensor=TRUE, validInvariants=[MAX_PRINCIPAL,])

elist = [1]

strs = [[0.72539, 0.19255, 0.082066, -0.12808, -0.1158, 0.042058]]

fieldout.addData(position=CENTROID, instance=instance1, labels=elist, data=strs)

 

odb.save()

odb.close()

My guess would be that it's an issue with the section definition, as that's what changed between the two models.

Did you get any error when you open the 3D version? If so, post the full text or a screenshot here.

Interesting. I will try adding a section.  In the mean time - here is the error I recieve.  It's very generic and I am opening the ODB while in the vizualization module. 

" An unknown error has occurred.

 

This may have occurred because you did not switch into the apropriate module before running a macro or script. For more details, refer to ther replay file". 

The following error is in the RPY file

 

"cliCommand("""odb = session.odb""")

#* AttributeError: 'Session' object has no attribute 'odb'

cliCommand("""from abaqusConstants import * """)"

 

 

The error message says "This may have occurred because you did not switch into the apropriate module before running a macro or script"

Then why don't you switch into the appropriate module using something like..

session.viewports['Viewport: 1'].setValues(displayedObject=XYZ)

 

 

 

I tried both adding a SolidHomogeneousSection and manually setting the viewport and still get a crash.   The new script looks like this. If others run this do they get a crash as well? 

 

from abaqusConstants import * 

from odbAccess import *

from textRepr import *

 

odb = Odb(name='4',

    analysisTitle='derived data',

    description='test problem',

    path='4.odb')

sCat = odb.SectionCategory(name='solid', description='Five-Layered Shell')

part1 = odb.Part(name='part-1',embeddedSpace=THREE_D, type=DEFORMABLE_BODY)

 

 

 

nodeData = [(1, -5.0, -5.0, 10.0), (2, -5.0, 5.0, 10.0), (3, -5.0, -5.0, 0.0), (4, -5.0, 5.0, 0.0), (5, 5.0, -5.0, 10.0), (6, 5.0, 5.0, 10.0), (7, 5.0, -5.0, 0.0), (8, 5.0, 5.0, 0.0)]

part1.addNodes(nodeData=nodeData, nodeSetName='nset-1') 

elementData = [(1, 4, 5, 7, 6, 0, 1, 3, 2)]

part1.addElements(elementData=elementData, type='C3D8',

    elementSetName='eset-1', sectionCategory=sCat)

 

assembly = odb.rootAssembly

instance1 = assembly.Instance(name='part-1-1', object=part1)

 

# An element set on an instance

eLabels = [1]

elementSet = instance1.ElementSetFromElementLabels(

    name='elsetA',elementLabels=eLabels)

# A node set on the rootAssembly

instance1.NodeSetFromNodeLabels('nset', (1,2,3,4,5,6,7,8))

 

step1 = odb.Step(name='step-1', description='', domain=TIME, timePeriod=0)

frame1 = step1.Frame(incrementNumber=1, frameValue=0, description='')

 

 

 

fieldout = frame1.FieldOutput(name="FO", description="Fiber Orientation Data", type=TENSOR_3D_FULL, isEngineeringTensor=TRUE, validInvariants=[MAX_PRINCIPAL,])

elist = [1]

strs = [[0.72539, 0.19255, 0.082066, -0.12808, -0.1158, 0.042058]]

fieldout.addData(position=CENTROID, instance=instance1, labels=elist, data=strs)

 

odb.save()

odb.close()

 

#=== open odb ========

o1=session.openOdb(name=%CWD%\\4.odb")

session.viewports['Viewport: 1'].setValues(displayedObject=o1) 

 

Subscribe to Comments for "Create simple ODB without submitting a job"

Recent comments

More comments

Syndicate

Subscribe to Syndicate