Get DPF results by harmonic index

Jim Kosloski
Jim Kosloski Member, Employee Posts: 27
10 Comments Name Dropper First Anniversary Ansys Employee
✭✭✭✭

For a cyclic model is there a way to get results at a specific harmonic index? Example: I want to get results for harmonic index 2, mode 1

Tagged:

Answers

  • Mike.Thompson
    Mike.Thompson Member, Employee Posts: 345
    25 Answers 100 Comments 25 Likes First Anniversary
    ✭✭✭✭
    edited 2:55PM

    Use something like this to get the Time/Freq Support object:

    Analysis = Model.Analyses[1]
    ds = dpf.DataSources(Analysis.ResultFileName)
    TFS_Op = dpf.operators.metadata.time_freq_provider()
    TFS_Op.inputs.data_sources.Connect(ds)
    TFS= TFS_Op.outputs.time_freq_support.GetData()
    print TFS
    

    You will get an output like this, that lists the harmonic index. You can then setup a time scoping on the typical DPF results operator to get the correct set (both mode and harmonic index)

    DPF  Time/Freq Support: 
      Number of sets: 72 
    Cumulative     Frequency (Hz) LoadStep       Substep        Harmonic index  
    1              383.044743     1              1              0.000000        
    2              740.967050     1              2              0.000000        
    3              1469.791028    1              3              0.000000        
    4              1729.302253    1              4              0.000000        
    5              2008.730330    1              5              0.000000        
    6              2628.583526    1              6              0.000000        
    7              485.840944     2              1              1.000000        
    8              485.840944     2              2              1.000000        
    9              715.620560     2              3              1.000000        
    10             715.620560     2              4             
    
    

    You can also look at the operators built for cyclic expansion, but in general the time/freq. support data will help inform the time scoping for this operator.

    op = dpf.operators.result.cyclic_expanded_displacement() # operator instantiation
    op.inputs.time_scoping.Connect(my_time_scoping)# optional
    op.inputs.mesh_scoping.Connect(my_mesh_scoping)# optional
    op.inputs.fields_container.Connect(my_fields_container)# optional
    op.inputs.streams_container.Connect(my_streams_container)# optional
    op.inputs.data_sources.Connect(my_data_sources)
    op.inputs.bool_rotate_to_global.Connect(my_bool_rotate_to_global)# optional
    op.inputs.all_dofs.Connect(my_all_dofs)# optional
    op.inputs.sector_mesh.Connect(my_sector_mesh)# optional
    op.inputs.requested_location.Connect(my_requested_location)# optional
    op.inputs.read_cyclic.Connect(my_read_cyclic)# optional
    op.inputs.expanded_meshed_region.Connect(my_expanded_meshed_region)# optional
    op.inputs.cyclic_support.Connect(my_cyclic_support)# optional
    op.inputs.sectors_to_expand.Connect(my_sectors_to_expand)# optional
    op.inputs.phi.Connect(my_phi)# optional
    my_fields_container = op.outputs.fields_container.GetData()
    my_expanded_meshes = op.outputs.expanded_meshes.GetData()
    
  • Jim Kosloski
    Jim Kosloski Member, Employee Posts: 27
    10 Comments Name Dropper First Anniversary Ansys Employee
    ✭✭✭✭

    @Mike.Thompson I get that I can list the information, but I need to get it programmatically. Say I want to write a script that gets the displacements for Harmonic Index 3, Mode 3. How do I do that?