How to solve explicit dynamics analysis in Ansys 2023R1 on Linux?

wanghao
Member Posts: 27
**
Hi
I'm trying to solve an explicit dynamics analysis on Linux with pyMechanical but it seems not start solve.
Here's my python script:
import ansys.mechanical.core as pymechanical wb_path = "/es01/home/zssoftware/Ansys/Ansys2023r1_gr/v231/aisol/.workbench" print("wb_path", wb_path) mechanical = pymechanical.launch_mechanical(exec_file=wb_path, verbose_mechanical=True, batch=True, loglevel="DEBUG", log_file=True, log_mechanical="pymechanical") print("mechanical launch success: ", mechanical) project_directory = mechanical.project_directory print(f"project directory = {project_directory}") try: # import geometry file GEO_IMPORT_SCRIPT = """ geo_import_format = Ansys.Mechanical.DataModel.Enums.GeometryImportPreference.Format.Automatic geo_import_preferences = Ansys.ACT.Mechanical.Utilities.GeometryImportPreferences() geo_import = Model.GeometryImportGroup.AddGeometryImport() geo_import.Import("{geo_path:s}", geo_import_format, geo_import_preferences) """ mechanical.run_python_script( GEO_IMPORT_SCRIPT.format(geo_path="/es01/home/yuansuan/test_case/wanghao/ansys-231-pre-process/breakage/breakage.stp") ) # mesh mechanical.run_python_script(""" mesh_14 = Model.Mesh mesh_14.ElementSize = Quantity(1, "m") mesh_14.PhysicsPreference = MeshPhysicsPreferenceType.Explicit mesh_14.GenerateMesh() """ ) mechanical.run_python_script(""" # set ExplicitDynamicsAnalysis explicit_dynamics_analysis = Model.AddExplicitDynamicsAnalysis() def analysis_settings(p, value): pro = DataModel.AnalysisList[0].AnalysisSettings.PropertyByName(p) print("find %s propertry is ok, old value is %f " % (p, pro.InternalValue)) pro.InternalValue=value print("update %s propertry is ok, new value is %f " % (p, pro.InternalValue)) analysis_settings("StepEndTime", 0.0001) fixed_support = explicit_dynamics_analysis.AddFixedSupport() selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities) selection.Ids = [88, 94, 91] fixed_support.Location = selection displacement = explicit_dynamics_analysis.AddDisplacement() selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities) selection.Ids = [90, 93, 86] displacement.Location = selection displacement.XComponent.Output.DefinitionType=VariableDefinitionType.Discrete displacement.XComponent.Inputs[0].DiscreteValues = [Quantity(0, 'sec'), Quantity(1, 'sec')] displacement.XComponent.Output.DiscreteValues = [Quantity(0, 'mm'), Quantity(-10, 'mm')] explicit_dynamics_analysis.Solution.AddEquivalentStress() explicit_dynamics_analysis.Solution.AddTotalDeformation() """) mechanical.run_python_script(""" Model.Solve(True) """) except Exception as e: print("An error occurred while running the Python script:", e) finally: print("exit mechanical instance") mechanical.exit()
The solution seems not starts and I've got two warnings. Here's the stdout when running the script:
wb_path /es01/home/zssoftware/Ansys/Ansys2023r1_gr/v231/aisol/.workbench Running /es01/home/zssoftware/Ansys/Ansys2023r1_gr/v231/aisol/.workbench -DSApplet -b -AppModeMech -grpc 10000. INFO - GRPC_127.0.0.1:10000 - mechanical - log_info - Mechanical connection is treated as local. DEBUG - GRPC_127.0.0.1:10000 - mechanical - log_debug - timetout:120 n_attempts:5 attempt_timeout=24.0 DEBUG - GRPC_127.0.0.1:10000 - mechanical - log_debug - Connection attempt 1 with attempt timeout 24.0s DEBUG - GRPC_127.0.0.1:10000 - mechanical - log_debug - Connection attempt 2 with attempt timeout 24.0s Initialize() started Initialize() done DEBUG - GRPC_127.0.0.1:10000 - mechanical - log_debug - Established a connection to the Mechanical gRPC server. INFO - GRPC_127.0.0.1:10000 - mechanical - log_info - Waiting for Mechanical to be ready. Maximum wait time: 24.0s INFO - GRPC_127.0.0.1:10000 - mechanical - log_info - Mechanical is ready. It took 0 seconds to verify. DEBUG - GRPC_127.0.0.1:10000 - mechanical - log_debug - Connection attempt 2 succeeded. INFO - GRPC_127.0.0.1:10000 - mechanical - log_info - Mechanical is ready to accept grpc calls mechanical launch success: Ansys Mechanical [Ansys Mechanical Enterprise] Product Version:231 Software build date:Sat Nov 26 20:15:28 2022 project directory = /tmp/AnsysMech8DD1/Project_Mech_Files/ AnsMeshingServer, compiled Nov 26 2022 21:20:33, DS Mesher, Thu May 30 19:36:43 2024 AnsMeshingServer, okay, Thu May 30 19:36:44 2024 exit code: 255 find StepEndTime propertry is ok, old value is 0.000000 update StepEndTime propertry is ok, new value is 0.000100 Warning at File: myxml, line 1, col 40, encoding 'utf-16' from XML declaration or manually set contradicts the auto-sensed encoding; ignoring Warning at File: myxml, line 1, col 40, encoding 'utf-16' from XML declaration or manually set contradicts the auto-sensed encoding; ignoring exit mechanical instance DEBUG - GRPC_127.0.0.1:10000 - mechanical - log_debug - In shutdown. DEBUG - GRPC_127.0.0.1:10000 - mechanical - log_debug - Shutting down... DEBUG - GRPC_127.0.0.1:10000 - mechanical - log_debug - No PyPIM cleanup is needed. INFO - GRPC_127.0.0.1:10000 - mechanical - log_info - Shutdown has finished.
Tagged:
0