How to get Frequency value of at Max. Equivalent stress / total deformation in Harmonic response ana

Ayush Kumar
Ayush Kumar Member, Moderator, Employee Posts: 389
First Anniversary Ansys Employee Solution Developer Community of Practice Member First Answer
edited June 2023 in Structures

How to get Frequency value of at Max. Equivalent stress / total deformation in Harmonic response analysis?

Tagged:

Answers

  • Ayush Kumar
    Ayush Kumar Member, Moderator, Employee Posts: 389
    First Anniversary Ansys Employee Solution Developer Community of Practice Member First Answer
    Answer ✓
    modal_analysis = ExtAPI.DataModel.Project.Model.Analyses[0]  # Modal Analysis
    reader = modal_analysis.GetResultsData()
    eigen_freqs = reader.ListTimeFreq
    
    harmonic_analysis_sol = ExtAPI.DataModel.Project.Model.Analyses[1].Solution  # Harmonic Analysis Solution
    
    all_defos = []
    all_seqvs = []
    
    for freq in eigen_freqs:
        total_defo = harmonic_analysis_sol.AddTotalDeformation()
        all_defos.append(total_defo)
        total_defo.Frequency = Quantity("%s [Hz]" % freq)
        seqv = harmonic_analysis_sol.AddEquivalentStress()
        all_seqvs.append(seqv)
        seqv.Frequency = Quantity("%s [Hz]" % freq)
    
    harmonic_analysis_sol.EvaluateAllResults()  # Evaluate all results
    
    freq_at_max_defo = max([(abs(defo.Maximum.Value), defo.Frequency.Value) for defo in all_defos], key=lambda x: x[0])[1]
    freq_at_max_stress = max([(abs(stress.Maximum.Value), stress.Frequency.Value) for stress in all_seqvs], key=lambda x: x[0])[1]
    
    print freq_at_max_defo, freq_at_max_stress