General Mechanical

General Mechanical

Topics related to Mechanical Enterprise, Motion, Additive Print and more.

Why do modeling results differ between execution in Workbench and Python code

    • tigers1227
      Subscriber

      Despite identical geometry, material, contact, analysis settings, and boundary conditions, the deformation, stress, and strain results differ between the static structural modeling created through ANSYS Workbench and that created using Python code. Upon further inspection, there are discrepancies in certain settings, as shown in the attached images. I would like to understand the reasons for these differences and potential solutions. Additionally, in the modal analysis, the rubber material exhibits abnormal behavior, passing through the outer structure and expanding unusually. Thank you for your assistance.

      #--- PyMechanical 라이브러리 가져오기 및 Mechanical 실행 (Batch Mode) --#
      from ansys.mechanical.core import launch_mechanical
      mechanical = launch_mechanical(batch=False, cleanup_on_exit=False)
      #-------------------------------------------------------------------------#
      #--- 형상 파일이 위치한 경로 정의 -------------------------------------------#
      geom = "C:/Users/hyu3/Desktop/SDD_macro/lower_arm_stp_files/final_assemble_lower_Arm_and_bush3.stp"    # 사용 환경에 맞게 수정하기 !
      mechanical.run_python_script(f"geom_path='{geom}'")
      #-------------------------------------------------------------------------#
      #--- Mechanical에 형상 가져오기 -------------------------------------------#
      mechanical.run_python_script('''geom_import_gr = Model.GeometryImportGroup                            
      geom_import = geom_import_gr.AddGeometryImport()
      geom_import_fm = Ansys.Mechanical.DataModel.Enums.GeometryImportPreference.Format.Automatic
      geom_import_pr = Ansys.ACT.Mechanical.Utilities.GeometryImportPreferences()
      geom_import_pr.ProcessNamedSelections = True
      geom_import_pr.ProcessCoordinateSystems = True
      geom_import.Import(geom_path, geom_import_fm, geom_import_pr)
      ''')
      #-------------------------------------------------------------------------#
      #--- 재료 파일이 위치한 경로 정의 -------------------------------------------#
      material_path1 = "C:/Users/hyu3/Desktop/SDD_macro/ansys_macro_code/material_files/stainless_material.xml"  # 사용 환경에 맞게 수정하기
      mechanical.run_python_script(f"material_path1='{material_path1}'")
      material_path2 = "C:/Users/hyu3/Desktop/modal_test/calculated_ogden_prony_density_ansys.xml"            # 사용 환경에 맞게 수정하기 #calculated_ogden_prony_ansys는 ogden 3parameter 와 prony 사용한거임.
      mechanical.run_python_script(f"material_path2='{material_path2}'")
      #-------------------------------------------------------------------------#
      #--- 저장된 재료 불러오기 ----여기서 material1 은 stainless, material2는 hyper elastic 재료----------------------------------------#
      mechanical.run_python_script('''materials = Model.Materials
      imported_materials1 = materials.Import(material_path1)
      ''')
      mechanical.run_python_script('''materials = Model.Materials
      imported_materials2 = materials.Import(material_path2)
      ''')
      #-------------------------------------------------------------------------#
      #--- 재료 차례로 lowerarm, inner, rubber, outer 적용-------------------------------------------------#
      mechanical.run_python_script('''

      # lowerarm Body ID: 21
      with Transaction():
          body = DataModel.GetObjectById(21)
          body.Material = imported_materials1[0].Name
         

      # inner1 Body ID: 25
      with Transaction():
          body = DataModel.GetObjectById(25)
          body.Material = imported_materials1[0].Name
       
      # rubber1 Body ID: 28
      with Transaction():
          body = DataModel.GetObjectById(28)
          body.Material = imported_materials2[0].Name

      # outer1 Body ID: 31
      with Transaction():
          body = DataModel.GetObjectById(31)
          body.Material = imported_materials1[0].Name

      # inner2 Body ID: 34
      with Transaction():
          body = DataModel.GetObjectById(34)
          body.Material = imported_materials1[0].Name

      # rubber2 Body ID: 37
      with Transaction():
          body = DataModel.GetObjectById(37)
          body.Material = imported_materials2[0].Name
         
      # outer2 Body ID: 40
      with Transaction():
          body = DataModel.GetObjectById(40)
          body.Material = imported_materials1[0].Name

      # inner3 Body ID: 43
      with Transaction():
          body = DataModel.GetObjectById(43)
          body.Material = imported_materials1[0].Name

      # rubber3 Body ID: 46
      with Transaction():
          body = DataModel.GetObjectById(46)
          body.Material = imported_materials2[0].Name

      # outer3 Body ID: 49
      with Transaction():
          body = DataModel.GetObjectById(49)
          body.Material = imported_materials1[0].Name
      ''')
      #-----------------------------------------------------------------------------------#
      #--- nonlinear, thermal 효과 적용 ---------------------#
      mechanical.run_python_script('''
      with Transaction():
          body_21 = DataModel.GetObjectById(21)
          body_21.NonlinearEffects = False
          body_21.ThermalStrainEffects = False

      with Transaction():
          body_25 = DataModel.GetObjectById(25)
          body_25.NonlinearEffects = False
          body_25.ThermalStrainEffects = False

          # rubber1 Body ID: 28
      with Transaction():
          body_28 = DataModel.GetObjectById(28)
          body_28.NonlinearEffects = True
          body_28.ThermalStrainEffects = False

          # outer1 Body ID: 31
      with Transaction():
          body_31 = DataModel.GetObjectById(31)
          body_31.NonlinearEffects = False
          body_31.ThermalStrainEffects = False

          # inner2 Body ID: 34
      with Transaction():
          body_34 = DataModel.GetObjectById(34)
          body_34.NonlinearEffects = False
          body_34.ThermalStrainEffects = False
         
      # rubber2 Body ID: 37
      with Transaction():
          body_37 = DataModel.GetObjectById(37)
          body_37.NonlinearEffects = True
          body_37.ThermalStrainEffects = False

      # outer2 Body ID: 40
      with Transaction():
          body_40 = DataModel.GetObjectById(40)
          body_40.NonlinearEffects = False
          body_40.ThermalStrainEffects = False

      # inner3 Body ID: 43
      with Transaction():
          body_43 = DataModel.GetObjectById(43)
          body_43.NonlinearEffects = False
          body_43.ThermalStrainEffects = False
         
      # rubber3 Body ID: 46
      with Transaction():
          body_46 = DataModel.GetObjectById(46)
          body_46.NonlinearEffects = True
          body_46.ThermalStrainEffects = False

      # outer3 Body ID: 49
      with Transaction():
          body_49 = DataModel.GetObjectById(49)
          body_49.NonlinearEffects = False
          body_49.ThermalStrainEffects = False


      ''')
      #------------------------------------------#
      #--- Contact 정의 ----------------------------------------------------------------------------#
      mechanical.run_python_script('''
      #region Contact Region 53
      contact_region_53 = DataModel.GetObjectById(53)
      selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
      selection.Ids = [239, 240]
      contact_region_53.SourceLocation = selection

      selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
      selection.Ids = [156, 155]
      contact_region_53.TargetLocation = selection

      contact_region_53.ContactType = ContactType.Bonded
      #endregion

      #region Contact Region 56
      contact_region_56 = DataModel.GetObjectById(56)
      selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
      selection.Ids = [320, 321]
      contact_region_56.SourceLocation = selection

      selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
      selection.Ids = [154, 153]
      contact_region_56.TargetLocation = selection

      contact_region_56.ContactType = ContactType.Bonded
      #endregion

      #region Contact Region 59
      contact_region_59 = DataModel.GetObjectById(59)
      selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
      selection.Ids = [401, 402]
      contact_region_59.SourceLocation = selection

      selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
      selection.Ids = [131, 132]
      contact_region_59.TargetLocation = selection

      contact_region_59.ContactType = ContactType.Bonded

      contact_region_59.PinballRegion = ContactPinballType.Radius
      contact_region_59.PinballRadius = Quantity(0.5, "mm")
      #endregion



      #region Contact Region 62
      contact_region_62 = DataModel.GetObjectById(62)
      selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
      selection.Ids = [214, 215]
      contact_region_62.SourceLocation = selection

      selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
      selection.Ids = [185, 186]
      contact_region_62.TargetLocation = selection

      contact_region_62.ContactType = ContactType.Bonded
      #endregion

      #region Contact Region 65
      contact_region_65 = DataModel.GetObjectById(65)
      selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
      selection.Ids = [212, 213]
      contact_region_65.SourceLocation = selection

      selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
      selection.Ids = [241, 242]
      contact_region_65.TargetLocation = selection

      contact_region_65.ContactType = ContactType.Bonded
      #endregion

      #region Contact Region 68
      contact_region_68 = DataModel.GetObjectById(68)
      selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
      selection.Ids = [295, 296]
      contact_region_68.SourceLocation = selection

      selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
      selection.Ids = [266, 267]
      contact_region_68.TargetLocation = selection

      contact_region_68.ContactType = ContactType.Bonded
      #endregion

      #region Contact Region 71
      contact_region_71 = DataModel.GetObjectById(71)
      selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
      selection.Ids = [293, 294]
      contact_region_71.SourceLocation = selection

      selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
      selection.Ids = [154, 153]
      contact_region_71.TargetLocation = selection

      contact_region_71.ContactType = ContactType.Bonded
      contact_region_71.PinballRegion = ContactPinballType.Radius
      contact_region_71.PinballRadius = Quantity(0.5, "mm")
      #endregion

      #region Contact Region 74
      contact_region_74 = DataModel.GetObjectById(74)
      selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
      selection.Ids = [376, 377]
      contact_region_74.SourceLocation = selection

      selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
      selection.Ids = [347, 348]
      contact_region_74.TargetLocation = selection

      contact_region_74.ContactType = ContactType.Bonded
      contact_region_74.PinballRegion = ContactPinballType.Radius
      contact_region_74.PinballRadius = Quantity(0.5, "mm")
      #endregion

      #region Contact Region 77
      contact_region_77 = DataModel.GetObjectById(77)
      selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
      selection.Ids = [374, 375]
      contact_region_77.SourceLocation = selection

      selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
      selection.Ids = [403, 404]
      contact_region_77.TargetLocation = selection

      contact_region_77.ContactType = ContactType.Bonded
      contact_region_77.PinballRegion = ContactPinballType.Radius
      contact_region_77.PinballRadius = Quantity(0.5, "mm")
      #endregion

      ''')
      #---------------------------------------------------------------#
      # ---mesh 설정 ----------------------- #
      mechanical.run_python_script('''
      mesh_13 = Model.Mesh

      contact_sizing_84 = mesh_13.AddContactSizing()
      contact_sizing_84.ContactRegion = contact_region_53

      #region Context Menu Action
      contact_sizing_85 = mesh_13.AddContactSizing()
      contact_sizing_85.ContactRegion = contact_region_56

      #region Context Menu Action
      contact_sizing_86 = mesh_13.AddContactSizing()
      contact_sizing_86.ContactRegion = contact_region_59
      contact_sizing_86.ElementSize = Quantity(2.0, "mm")

      #region Context Menu Action
      contact_sizing_87 = mesh_13.AddContactSizing()
      contact_sizing_87.ContactRegion = contact_region_62

      #region Context Menu Action
      contact_sizing_88 = mesh_13.AddContactSizing()
      contact_sizing_88.ContactRegion = contact_region_65

      #region Context Menu Action
      contact_sizing_89 = mesh_13.AddContactSizing()
      contact_sizing_89.ContactRegion = contact_region_68

      #region Context Menu Action
      contact_sizing_90 = mesh_13.AddContactSizing()
      contact_sizing_90.ContactRegion = contact_region_71

      #region Context Menu Action
      contact_sizing_91 = mesh_13.AddContactSizing()
      contact_sizing_91.ContactRegion = contact_region_74

      #region Context Menu Action
      contact_sizing_92 = mesh_13.AddContactSizing()
      contact_sizing_92.ContactRegion = contact_region_77
      contact_sizing_92.ElementSize = Quantity(1.5, "mm")
      #endregion


      #region Context Menu Action
      sizing_99 = mesh_13.AddSizing()
      selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
      selection.Ids = [359, 369, 366, 362]
      sizing_99.Location = selection
      sizing_99.Type = SizingType.NumberOfDivisions
      sizing_99.NumberOfDivisions = 10
      #endregion

      #region Context Menu Action
      face_meshing_101 = mesh_13.AddFaceMeshing()
      selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
      selection.Ids = [378]
      face_meshing_101.Location = selection
      face_meshing_101.InternalNumberOfDivisions = 3
      #endregion

      #region Context Menu Action
      sizing_103 = mesh_13.AddSizing()
      selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
      selection.Ids = [280, 287, 283, 282]
      sizing_103.Location = selection
      sizing_103.Type = SizingType.NumberOfDivisions
      sizing_103.NumberOfDivisions = 10
      #endregion

      #region Context Menu Action
      face_meshing_105 = mesh_13.AddFaceMeshing()
      selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
      selection.Ids = [298]
      face_meshing_105.Location = selection
      face_meshing_105.InternalNumberOfDivisions = 3
      #endregion

      #region Context Menu Action
      sizing_107 = mesh_13.AddSizing()
      selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
      selection.Ids = [199, 206, 202, 201]
      sizing_107.Location = selection
      sizing_107.Type = SizingType.NumberOfDivisions
      sizing_107.NumberOfDivisions = 10
      #endregion

      #region Context Menu Action
      face_meshing_109 = mesh_13.AddFaceMeshing()
      selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
      selection.Ids = [217]
      face_meshing_109.Location = selection
      face_meshing_109.InternalNumberOfDivisions = 3
      #endregion


      #region Context Menu Action
      sizing_115 = mesh_13.AddSizing()
      selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
      selection.Ids = [334, 341, 337, 336]
      sizing_115.Location = selection
      sizing_115.Type = SizingType.NumberOfDivisions
      sizing_115.NumberOfDivisions = 10
      #endregion

      #region Context Menu Action
      face_meshing_117 = mesh_13.AddFaceMeshing()
      selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
      selection.Ids = [352]
      face_meshing_117.Location = selection
      face_meshing_117.InternalNumberOfDivisions = 1
      #endregion

      #region Context Menu Action
      sizing_119 = mesh_13.AddSizing()
      selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
      selection.Ids = [255, 256, 260, 253]
      sizing_119.Location = selection
      sizing_119.Type = SizingType.NumberOfDivisions
      sizing_119.NumberOfDivisions = 10
      #endregion

      #region Context Menu Action
      face_meshing_121 = mesh_13.AddFaceMeshing()
      selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
      selection.Ids = [271]
      face_meshing_121.Location = selection
      face_meshing_121.InternalNumberOfDivisions = 1
      #endregion

      #region Context Menu Action
      sizing_123 = mesh_13.AddSizing()
      selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
      selection.Ids = [172, 179, 175, 174]
      sizing_123.Location = selection
      sizing_123.Type = SizingType.NumberOfDivisions
      sizing_123.NumberOfDivisions = 10
      #endregion

      #region Context Menu Action
      face_meshing_125 = mesh_13.AddFaceMeshing()
      selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
      selection.Ids = [190]
      face_meshing_125.Location = selection
      face_meshing_125.InternalNumberOfDivisions = 1
      #endregion

      #region Context Menu Action
      mesh_13.GenerateMesh()
      #endregion
      ''')
      #---------------------------------------#
      #--- Static Structural 시스템 생성 ----------------------------------------#
      mechanical.run_python_script('Model.AddStaticStructuralAnalysis()')
      #-------------------------------------------------------------------------#
      #--- Analysis Setting에서 Large Deflecion on 명령 ----------------------------------------#
      mechanical.run_python_script('''
      analysis = Model.Analyses[0]  # 첫 번째 생성된 해석을 참조
      analysis_settings = analysis.AnalysisSettings
      analysis_settings.LargeDeflection = True
      ''')
      #-------------------------------------------------------------------------#
      #--- Analysis Setting에서 Auto time Stepping 명령 ----------------------------------------#
      mechanical.run_python_script('''
      analysis = Model.Analyses[0]  # 첫 번째 생성된 해석을 참조
      analysis_settings = analysis.AnalysisSettings
      with Transaction():
          analysis_settings.AutomaticTimeStepping = AutomaticTimeStepping.On
          analysis_settings.InitialSubsteps = 10
          analysis_settings.MinimumSubsteps = 10
          analysis_settings.MaximumSubsteps = 1000
      ''')
      #-------------------------------------------------------------------------#
      # --- boundary condition 설정 -------------------------------------------------------------------------#
      mechanical.run_python_script('''

      #region Context Menu Action
      displacement = analysis.AddDisplacement()
      selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
      selection.Ids = [190, 189]
      displacement.Location = selection
      displacement.DefineBy = LoadDefineBy.Components
      #--- Transaction()을 이용해서 칸에 있는 값을 설정해줄 수 있음. -------------------------------#
      with Transaction():
          displacement.ZComponent.Output.DiscreteValues = [Quantity(0, "mm")]  # Z Component 값을 0 mm로 설정
      #endregion

      #region Context Menu Action
      displacement = analysis.AddDisplacement()
      selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
      selection.Ids = [271, 269, 268, 270]
      displacement.Location = selection
      displacement.DefineBy = LoadDefineBy.Components
      with Transaction():
          displacement.ZComponent.Output.DiscreteValues = [Quantity(0, "mm")]  # Z Component 값을 0 mm로 설정
      #endregion

      #region Context Menu Action
      displacement = analysis.AddDisplacement()
      selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
      selection.Ids = [351, 352]
      displacement.Location = selection
      displacement.DefineBy = LoadDefineBy.Components
      with Transaction():
          displacement.XComponent.Output.DiscreteValues = [Quantity(0, "mm")]  # X Component 값을 0 mm로 설정
      #endregion

      #region Context Menu Action
      compression_only_support = analysis.AddCompressionOnlySupport()
      selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
      selection.Ids = [188, 187]
      compression_only_support.Location = selection
      #endregion

      #region Context Menu Action
      compression_only_support = analysis.AddCompressionOnlySupport()
      selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
      selection.Ids = [269, 268]
      compression_only_support.Location = selection
      #endregion

      #region Context Menu Action
      displacement = analysis.AddDisplacement()
      selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
      selection.Ids = [347, 348]
      displacement.Location = selection
      with Transaction():
          displacement.XComponent.Output.DiscreteValues = [Quantity(1, "mm")]  # X Component 값을 1 mm로 설정
          displacement.YComponent.Output.DiscreteValues = [Quantity(2, "mm")]  # Y Component 값을 1 mm로 설정
          displacement.ZComponent.Output.DiscreteValues = [Quantity(0, "mm")]  # Z Component 값을 0 mm로 설정
      #endregion
      ''')
      #--------------------------------------------------------------------#
      #---해석결과에 Total Deformation, Equivalent Stress, Equivalent Elastic Strain 추가 ---------------------------------------#
      mechanical.run_python_script('''
      Model.Analyses[0].Solution.AddTotalDeformation()
      Model.Analyses[0].Solution.AddEquivalentStress()
      Model.Analyses[0].Solution.AddEquivalentElasticStrain()
      ''')
      #-------------------------------------------------------------------------#
      #--- Solve ! Static_structure 해석 실행-----------------------------------------------------------#
      mechanical.run_python_script('Model.Solve()')
      #------------------------------------------------------------------------------------------------#

      #--- Modal 시스템 생성 ----------------------------------------#
      mechanical.run_python_script('Model.AddModalAnalysis()')
      #-------------------------------------------------------------------------#
      #---  Modal 시스템의 Pre-Stress 을 Static Structure 로 설정----------------------------------------#
      # PyMechanical을 통한 Pre-Stress 설정 변경
      mechanical.run_python_script('''
      model = ExtAPI.DataModel.Project.Model
      st=model.Analyses[0]
      mo=model.Analyses[1]
      prst=mo.InitialConditions[0]
      prst.PreStressICEnvironment=st # Set st to None if no prestress is needed
      ''')
      #-------------------------------------------------------------------------#
      #--- Modal 시스템의 Analysis Setting 설정 최대 찾는 mode 5개----------------------------------------#
      mechanical.run_python_script('''
      # Analysis Settings 객체에 접근 (정확한 ID 확인 필요)
      modal_analysis = Model.Analyses[1]  # 두 번째 해석 시스템이 Modal 해석인 경우
      analysis_settings = modal_analysis.AnalysisSettings

      # Maximum Modes to Find 값을 5으로 설정
      with Transaction():
          analysis_settings.MaximumModesToFind = 5
      ''')

      #-------------------------------------------------------------------------#
      #--- Modal 시스템의 해석 결과 추가----------------------------------------#
      mechanical.run_python_script('''
      # Modal 해석 시스템에 접근 (두 번째 해석 시스템이 Modal 해석인 경우)
      modal_analysis = Model.Analyses[1]
      solution = modal_analysis.Solution

      # 해석 결과 추가
      with Transaction():
          solution.AddTotalDeformation()
      ''')

      #-------------------------------------------------------------------------#
      #--- Modal 해석 실행 -------------------------------------------------------------#
      mechanical.run_python_script('Model.Analyses[1].Solution.Solve()')
      #-------------------------------------------------------------------------#
      # --- modal 결과전체 plot ------------------------------------------------------#
      mechanical.run_python_script('''
      #region Context Menu Action
      # 해석 객체에서 Solution 찾기
      analysis = ExtAPI.DataModel.Project.Model.Analyses[1]  # 첫 번째 해석 참조
      solution = next(child for child in analysis.Children if child.Name == "Solution")  # 이름으로 Solution 찾기

      # 결과를 모든 세트에서 생성
      solution.CreateResultsAtAllSets(140)  # 필요한 경우 140을 변경
      #endregion

      #region Miscellaneous commands
      # 모든 결과를 평가
      solution.EvaluateAllResults()
      #endregion
      ''')


       

    • tigers1227
      Subscriber

      Additionally, I am attaching images showing the abnormal behavior of the rubber material, defined using the Ogden equation as a nonlinear material, observed in the modal analysis.

Viewing 1 reply thread
  • You must be logged in to reply to this topic.