1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] Max stress from ODB

Discussão em 'Python' iniciado por Stack, Setembro 28, 2024 às 09:42.

  1. Stack

    Stack Membro Participativo

    I'm new in programming and I need to write a code that create an odb that visualize max value of six field output of a single step. For every single node I would like represent the max value of each field output. Now I've created a code which results in this this error:

    myFieldOutput.addData(position=INTEGRATION_POINT, instance=instance1, data=maxStress)


    omu_PrimArray from sequence failed - dimensions.

    This is the code:

    from abaqus import *
    from abaqusConstants import *
    import visualization
    myViewport = session.Viewport(name='Max_Stess',
    origin=(10, 10), width=150, height=100)
    # Open the tutorial output database.
    myOdb = visualization.openOdb(path='PROVA_04_10.odb', readOnly=False)
    # Associate the output database with the viewport.
    myViewport.setValues(displayedObject=myOdb)
    instance1 = myOdb.rootAssembly.instances['MODIFICA_FUNZIONANTE']
    # Create variables that refer to the first steps.
    firstStep = myOdb.steps['sigma_equivalenti']

    frame = firstStep.frames[-1]
    #creo nuovo step

    # lettura degli stress dallo step sigma

    sigma_eq_1 = frame.fieldOutputs['sigma_eq_1']
    sigma_eq_2 = frame.fieldOutputs['sigma_eq_2']
    sigma_eq_3 = frame.fieldOutputs['sigma_eq_3']
    sigma_eq_4 = frame.fieldOutputs['sigma_eq_4']
    sigma_eq_5 = frame.fieldOutputs['sigma_eq_5']
    sigma_eq_6 = frame.fieldOutputs['sigma_eq_6']

    #calcolo del vettore degli sforzi massimi

    maxStress=[]
    for i in range(len(sigma_eq_1.values)):
    v1=sigma_eq_1.values
    v2=sigma_eq_2.values
    v3=sigma_eq_3.values
    v4=sigma_eq_4.values
    v5=sigma_eq_5.values
    v6=sigma_eq_6.values
    maxStress.append((max(v1,v2,v3,v4,v5,v6),)) #max(valori)


    myFieldOutput = frame.FieldOutput(name='tensioni_max',description='calcolo delle tensioni massime', type=SCALAR)
    myFieldOutput.addData(position=INTEGRATION_POINT, instance=instance1, data=maxStress)

    #visualizzazione della variabile delle sigma massima sul programma
    myViewport.odbDisplay.setPrimaryVariable(field=myFieldOutput,outputPosition=INTEGRATION_POINT)
    myViewport.odbDisplay.display.setValues(plotState=(CONTOURS_ON_DEF,))

    Continue reading...

Compartilhe esta Página