PyDPF version of CYCPHASE

Options
ChrisC
ChrisC Member Posts: 11
First Comment
edited June 2023 in Structures

Is there a PyDPF equivalent of the CYCPHASE command? I looked all through the documentation and examples, and wasn't able to find anything. Can specify a specific phase angle, which is nice. But most stress and life type evaluations happen on CYCPHASE type output.

Tagged:

Answers

  • Chris Harrold
    Chris Harrold Member, Administrator, Employee Posts: 117
    First Answer First Comment First Anniversary Ansys Employee
    admin
    Options

    @Ramdane can you take a look at this one

  • Ramdane
    Ramdane Member, Employee Posts: 11
    First Comment First Anniversary Ansys Employee Name Dropper
    Options

    @Oscar , is this something you can help on?

  • Oscar
    Oscar Member, Employee Posts: 11
    5 Likes First Anniversary Ansys Employee First Comment
    Options

    Hi Chris,

    Please find an example of script running a maximum over cyclic phase for displacements. This procedure could be also used for stresses.

    Please, let me know if you have any further question on this.

    Regards,
    Oscar

    Import modules and set the location of your files

    from ansys.dpf import core as dpf
    import os
    import numpy as np

    Path = r'YOUR PATH'
    dataSource = dpf.DataSources()
    dataSource = dpf.Model(os.path.join(Path,"file.rst"))

    Variables

    set_number = [1]
    phaseInc = 2
    deg_to_rad = np.pi / 180.

    Get the operator to expand with cyclic option 1 (read cyclic without performing expansion, expansion will be done through cyclic_expansion operator)

    u = dpf.operators.result.displacement()
    u.inputs.time_scoping.connect(set_number)
    u.inputs.data_sources.connect(dataSource)
    u.inputs.bool_rotate_to_global.connect(False)
    u.inputs.read_cyclic.connect(1)

    Get cyclic support and cyclic expansion operators

    cyclicSupport = dpf.operators.metadata.cyclic_support_provider()
    cyclicSupport.inputs.data_sources.connect(dataSource)

    cyc_expansion = dpf.operators.result.cyclic_expansion()
    cyc_expansion.inputs.fields_container.connect(u)
    cyc_expansion.inputs.cyclic_support.connect(cyclicSupport)
    cyc_expansion.connect(18, [0]) #Sector number to expand, here, just one sector is expanded here, however, if results are expected to change per sector, all sectors should be expanded (e.g. displacement in global CS)

    Get maximum over cyclic phase

    min_max_op = dpf.operators.min_max.min_max_over_time_by_entity(cyc_expansion.outputs.fields_container.get_data())

    for i in range(0, 360, phaseInc):
    angle = i * deg_to_rad
    cyc_expansion.connect(19, angle)
    min_max_op.run()

    meshProvider = dpf.operators.mesh.mesh_provider()
    meshProvider.inputs.data_sources.connect(dataSource)
    meshProvider.inputs.read_cyclic.connect(2)
    meshProvider.connect(18, [0])
    mesh = meshProvider.outputs.mesh()

    mesh.plot(min_max_op.outputs.max.get_data()[0])