Solution Combination in Cyclic Symmetry

Member, Moderator, Employee Posts: 873
100 Answers 500 Comments 250 Likes Second Anniversary
✭✭✭✭

I have an analysis as follows:

The model uses a cyclic region:

I'd like to combine the results from the static and the harmonic analyses, but Mechanical's Solution Combination tool does not work in that case. Is there a solution through scripting?

Tagged:

Answers

  • Member, Moderator, Employee Posts: 873
    100 Answers 500 Comments 250 Likes Second Anniversary
    ✭✭✭✭

    DPF inside a Python result can be used to do that. Please note that the code below is just shared as a coding example, without any consideration of the physics behind the calculation (it could very well not make sense!).
    A Python Result is inserted in the Solution of the Harmonic Analysis.

    The code will:

    • Perform the dynamic expansion for the harmonic "on demand"
    • For the harmonic analysis : extract the deformation and compute the amplitude
    • For the static analysis: extract the deformation
    • Add the amplitude from the harmonic and the deformation from the static analysis
    • Compute the norm of the above field.
    • Plot the result on the expanded mesh.

      The time and frequency scopings are hard-coded in the code and should be changed to grab the result sets that you actually want to work with.
      Code below:
    1. def define_dpf_workflow(analysis):
    2. import mech_dpf
    3. import Ans.DataProcessing as dpf
    4. mech_dpf.setExtAPI(ExtAPI)
    5. # Extract data for harmonic response
    6. # With this method the dynamic expansion is done "on demand" in DPF
    7. data_source = dpf.DataSources(r'' + analysis.WorkingDir + 'file.rfrq')
    8. data_source_up = dpf.DataSources( r'' + analysis.WorkingDir + 'file.mode')
    9. data_source_up.AddFilePath(analysis.InitialConditions[0].ModalICEnvironment.ResultFileName)
    10. data_source.AppendUpStreamDataSources(data_source_up)
    11. u_harmo = dpf.operators.result.displacement()
    12. time_scop = dpf.Scoping()
    13. time_scop.Ids = [200]
    14. u_harmo.inputs.data_sources.Connect(data_source)
    15. u_harmo.inputs.time_scoping.Connect(time_scop)
    16. u_harmo.Connect(14, 2) # read cyclic and perform cyclic expansion
    17. op = dpf.operators.mesh.from_field()
    18. op.inputs.field.Connect(u_harmo.outputs.fields_container.GetData()[0])
    19. my_mesh = op.outputs.mesh.GetData()
    20. amplitude = dpf.operators.math.amplitude_fc()
    21. amplitude.inputs.fields_container.Connect(u_harmo)
    22. # Extract total deformation for static analysis
    23. static_analysis = ExtAPI.DataModel.AnalysisByName('Static Structural')
    24. data_source_2 = dpf.DataSources(static_analysis.ResultFileName)
    25. u_static = dpf.operators.result.displacement()
    26. time_scop_2 = dpf.Scoping()
    27. time_scop_2.Ids = [1]
    28. u_static.inputs.data_sources.Connect(data_source_2)
    29. u_static.inputs.time_scoping.Connect(time_scop_2)
    30. u_static.Connect(14, 2) # read cyclic and perform cyclic expansion
    31. # Add both fields
    32. add_fc = dpf.operators.math.add_fc()
    33. add_fc.inputs.fields_container1.Connect(amplitude.outputs.fields_container.GetData())
    34. add_fc.inputs.fields_container2.Connect(u_static.outputs.fields_container)
    35. # Take norm
    36. nrm = dpf.operators.math.norm_fc()
    37. nrm.Connect(add_fc)
    38. # Plot
    39. output = dpf.operators.utility.forward()
    40. output.inputs.any.Connect(nrm)
    41. dpf_workflow = dpf.Workflow()
    42. dpf_workflow.Add(nrm)
    43. dpf_workflow.SetOutputContour(nrm)
    44. dpf_workflow.SetOutputMesh(my_mesh)
    45. dpf_workflow.Record('wf_id', False)
    46. this.WorkflowId = dpf_workflow.GetRecordedId()
  • Member, Employee Posts: 385
    25 Answers 100 Comments Second Anniversary 25 Likes
    ✭✭✭✭

    @Pernelle Marone-Hitz ,
    I have a request for an example that is similar in nature to this. It is for fatigue calculations

    1. Get static structural stress results for each node. This is the mean stress in terms of fatigue
    2. Do a modal analysis and get the stress for all nodes at a particular mode. Do the cyclic expansion as per your example for cyclic.
    3. Scale the modal stress field values such that the stress at a user-defined "measure node" is equal to a user-defined value
    4. Have data in python for material S-N curves for mean vs. alternating stress. Bonus points if this is actually multiple curves based on temperature and you also include a thermal profile in the analysis.

    The final output is a utilization of the fatigue allowable by comparing the modal, scaled, alternating stress to the allowable as determined by the mean stress and corresponding temperature-dependent S-N curve data.

Welcome!

It looks like you're new here. Sign in or register to get started.