Solution Combination in Cyclic Symmetry

Options
Pernelle Marone-Hitz
Pernelle Marone-Hitz Member, Moderator, Employee Posts: 810
First Comment First Anniversary Ansys Employee Solution Developer Community of Practice Member

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

  • Pernelle Marone-Hitz
    Pernelle Marone-Hitz Member, Moderator, Employee Posts: 810
    First Comment First Anniversary Ansys Employee Solution Developer Community of Practice Member
    Options

    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:
    def define_dpf_workflow(analysis):
        import mech_dpf
        import Ans.DataProcessing as dpf
        mech_dpf.setExtAPI(ExtAPI) 
     # Extract data for harmonic response
        # With this method the dynamic expansion is done "on demand" in DPF
        data_source = dpf.DataSources(r'' + analysis.WorkingDir + 'file.rfrq')
        data_source_up = dpf.DataSources( r'' + analysis.WorkingDir + 'file.mode')
        data_source_up.AddFilePath(analysis.InitialConditions[0].ModalICEnvironment.ResultFileName)
        data_source.AppendUpStreamDataSources(data_source_up)    
        u_harmo = dpf.operators.result.displacement()
        time_scop = dpf.Scoping()
        time_scop.Ids = [200]
        u_harmo.inputs.data_sources.Connect(data_source)
        u_harmo.inputs.time_scoping.Connect(time_scop)
        u_harmo.Connect(14, 2) # read cyclic and perform cyclic expansion 
        op = dpf.operators.mesh.from_field() 
        op.inputs.field.Connect(u_harmo.outputs.fields_container.GetData()[0])
        my_mesh = op.outputs.mesh.GetData()    
        amplitude = dpf.operators.math.amplitude_fc()
        amplitude.inputs.fields_container.Connect(u_harmo)    
    # Extract total deformation for static analysis
        static_analysis = ExtAPI.DataModel.AnalysisByName('Static Structural')
        data_source_2 = dpf.DataSources(static_analysis.ResultFileName)
        u_static = dpf.operators.result.displacement()
        time_scop_2 = dpf.Scoping()
        time_scop_2.Ids = [1]
        u_static.inputs.data_sources.Connect(data_source_2)
        u_static.inputs.time_scoping.Connect(time_scop_2)
        u_static.Connect(14, 2) # read cyclic and perform cyclic expansion
    # Add both fields
        add_fc = dpf.operators.math.add_fc()
        add_fc.inputs.fields_container1.Connect(amplitude.outputs.fields_container.GetData())
        add_fc.inputs.fields_container2.Connect(u_static.outputs.fields_container)    
    # Take norm
        nrm = dpf.operators.math.norm_fc()
        nrm.Connect(add_fc)
    # Plot 
        output = dpf.operators.utility.forward()
        output.inputs.any.Connect(nrm)
        dpf_workflow = dpf.Workflow()
        dpf_workflow.Add(nrm)
        dpf_workflow.SetOutputContour(nrm)
        dpf_workflow.SetOutputMesh(my_mesh)
        dpf_workflow.Record('wf_id', False)
        this.WorkflowId = dpf_workflow.GetRecordedId()
    
  • Mike.Thompson
    Mike.Thompson Member, Employee Posts: 283
    First Anniversary First Comment 5 Likes Ansys Employee
    Options

    @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.