How can we check if analysis is linear or nonlinear?

Pernelle Marone-Hitz
Pernelle Marone-Hitz Member, Moderator, Employee Posts: 734
First Comment First Anniversary Ansys Employee Solution Developer Community of Practice Member
edited June 2023 in Structures

How can we check, through scripting, if the analysis is linear or nonlinear?

Tagged:

Answers

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

    The following function checks:

    • whether a plastic material law exists in the model (other forms of material nonlinearity is not included)

    • whether nonlinear contacts are defined

    • whether large deflections are turned on

        def LinearNonlinearAnalysis(analysis):
            '''
            Check whether analyis is linear or nonlinear and identify source of nonlinearity
            '''
            listExportNonLinearAnalysis = []   
            # test whether model is static or dynamic
            analysis = GetAnalysis()
            analysisType = analysis.AnalysisType
            # test whether model is linear or nonlinear
            ## test material properties to check for plasticity
            import materials
            existsPlasticity = False
            matList = ExtAPI.DataModel.Project.Model.Materials.Children
            for mat in matList:
                dataMat = mat.GetEngineeringDataMaterial()
                dataList = materials.GetListMaterialProperties(dataMat)
                plasticityList = ["Isotropic Hardening", "Kinematic Hardening"]
            test = [ele for ele in dataList if (ele in plasticityList)]
            existsPlasticity = bool(test)
            ## test for nonlinear contacts
            connections = ExtAPI.DataModel.Project.Model.Connections
            nonLinearContactTypeList = [
                ContactType.Frictional, ContactType.Frictionless, ContactType.Rough
            ]
            contactList = []
            existsNonLinearContacts = False
            for contGroup in connections.Children:
                for cont in contGroup.Children:
                    if cont.Suppressed is False:
                        try:
                            contactList.append(cont.ContactType)
                        except:
                            pass
            test = [
                ele for ele in contactList if (ele in nonLinearContactTypeList)
            ]
            existsNonLinearContacts = bool(test)
            ## test for large deformations
            existsNlgeom = analysis.AnalysisSettings.LargeDeflection
            ## checking nonlinearity of model
            existsNonLinearity = False
            nonLinearityList = [
                existsPlasticity, existsNonLinearContacts, existsNlgeom
            ]
            existsNonLinearity = True in nonLinearityList
            listExportNonLinearAnalysis.append([
                str(analysisType),
                str(existsNonLinearity),
                str(existsPlasticity),
                str(existsNonLinearContacts),
                str(existsNlgeom)
            ])
            return listExportNonLinearAnalysis