PyMechanical integration#
This example demonstrates how to use PyWorkbench and PyMechanical together to upload geometry, run simulations, and visualize results. It covers launching services, running scripts, and handling files between the client and server.
First, import the necessary modules. We import pathlib
for handling filesystem paths, os
for interacting with the operating system, and pyvista
for visualization. The launch_workbench
function from ansys.workbench.core
is imported to start a Workbench session, and launch_mechanical
from ansys.mechanical.core
to start a Mechanical session.
[1]:
import os
import pathlib
import pyvista as pv
from ansys.workbench.core import launch_workbench
from ansys.mechanical.core import launch_mechanical
Define several directories that will be used during the session. workdir
is set to the parent directory of the current file. assets
, scripts
, and agdb
are subdirectories within the working directory. The launch_workbench
function is called to start a Workbench session with specified directories.
[2]:
workdir = pathlib.Path("__file__").parent
assets = workdir / "assets"
scripts = workdir / "scripts"
agdb = workdir / "agdb"
wb = launch_workbench(release="241", server_workdir=str(workdir.absolute()), client_workdir=str(workdir.absolute()))
Upload a geometry file (two_pipes.agdb
) from the client to the server using the upload_file
method.
[3]:
wb.upload_file(str(agdb / "two_pipes.agdb"))
Uploading two_pipes.agdb: 100%|██████████| 2.27M/2.27M [00:00<00:00, 152MB/s]
Execute a Workbench script (project.wbjn
) to create a mechanical system and load the geometry using the run_script_file
method. The name of the system created is stored in system_name
.
[4]:
system_name = wb.run_script_file(str((assets / "project.wbjn").absolute()))
Start a PyMechanical service for the specified system using the start_mechanical_server
method. Create a PyMechanical client connected to this service using launch_mechanical
. The project directory is printed to verify the connection.
[5]:
pymech_port = wb.start_mechanical_server(system_name=system_name)
mechanical = launch_mechanical(start_instance=False, ip='localhost', port=pymech_port)
print(mechanical.project_directory)
C:\Users\ansys\AppData\Local\Temp\WB_ansys_6240_2\wbnew_files\
Read and execute the script solve.py
via the PyMechanical client using run_python_script
. This script typically contains commands to mesh and solve the model. The output of the script is printed.
[6]:
with open(scripts / "solve.py") as sf:
mech_script = sf.read()
print(mechanical.run_python_script(mech_script))
{"total_deformation": "1.9647094770595032E-06 [mm]"}
Fetch output files (*solve.out
and *deformation.png
) from the solver directory to the client’s working directory using the download
method.
[7]:
mechanical.download("*solve.out", target_dir=str(workdir.absolute()))
mechanical.download("*deformation.png", target_dir=str(workdir.absolute()))
Downloading dns:///127.0.0.1:63784:C:\Users\ansys\AppData\Local\Temp\WB_ansys_6240_2\wbnew_files\dp0\SYS\MECH\solve.out to C:\Users\ansys\actions-runner\_work\pyworkbench-examples\pyworkbench-examples\pyworkbench-examples\doc\source\examples\pymechanical-integration\solve.out: 100%|██████████| 34.8k/34.8k [00:00<?, ?B/s]
Downloading dns:///127.0.0.1:63784:C:\Users\ansys\AppData\Local\Temp\WB_ansys_6240_2\wbnew_files\dp0\SYS\MECH\deformation.png to C:\Users\ansys\actions-runner\_work\pyworkbench-examples\pyworkbench-examples\pyworkbench-examples\doc\source\examples\pymechanical-integration\deformation.png: 100%|██████████| 12.0k/12.0k [00:00<?, ?B/s]
[7]:
['C:\\Users\\ansys\\actions-runner\\_work\\pyworkbench-examples\\pyworkbench-examples\\pyworkbench-examples\\doc\\source\\examples\\pymechanical-integration\\deformation.png']
Read and print the content of the solver output file (solve.out
) to the console.
[8]:
with open(os.path.join(str(workdir.absolute()), "solve.out"), "r") as f:
print(f.read())
Ansys Mechanical Enterprise
*------------------------------------------------------------------*
| |
| W E L C O M E T O T H E A N S Y S (R) P R O G R A M |
| |
*------------------------------------------------------------------*
***************************************************************
* ANSYS MAPDL 2024 R1 LEGAL NOTICES *
***************************************************************
* *
* Copyright 1971-2024 Ansys, Inc. All rights reserved. *
* Unauthorized use, distribution or duplication is *
* prohibited. *
* *
* Ansys is a registered trademark of Ansys, Inc. or its *
* subsidiaries in the United States or other countries. *
* See the Ansys, Inc. online documentation or the Ansys, Inc. *
* documentation CD or online help for the complete Legal *
* Notice. *
* *
***************************************************************
* *
* THIS ANSYS SOFTWARE PRODUCT AND PROGRAM DOCUMENTATION *
* INCLUDE TRADE SECRETS AND CONFIDENTIAL AND PROPRIETARY *
* PRODUCTS OF ANSYS, INC., ITS SUBSIDIARIES, OR LICENSORS. *
* The software products and documentation are furnished by *
* Ansys, Inc. or its subsidiaries under a software license *
* agreement that contains provisions concerning *
* non-disclosure, copying, length and nature of use, *
* compliance with exporting laws, warranties, disclaimers, *
* limitations of liability, and remedies, and other *
* provisions. The software products and documentation may be *
* used, disclosed, transferred, or copied only in accordance *
* with the terms and conditions of that software license *
* agreement. *
* *
* Ansys, Inc. is a UL registered *
* ISO 9001:2015 company. *
* *
***************************************************************
* *
* This product is subject to U.S. laws governing export and *
* re-export. *
* *
* For U.S. Government users, except as specifically granted *
* by the Ansys, Inc. software license agreement, the use, *
* duplication, or disclosure by the United States Government *
* is subject to restrictions stated in the Ansys, Inc. *
* software license agreement and FAR 12.212 (for non-DOD *
* licenses). *
* *
***************************************************************
2024 R1
Point Releases and Patches installed:
Ansys Service Pack 2024 R1.01
Ansys Service Pack 2024 R1.02
Ansys Service Pack 2024 R1.03
Ansys, Inc. License Manager 2024 R1
Ansys, Inc. License Manager 2024 R1.01
Ansys, Inc. License Manager 2024 R1.02
Ansys, Inc. License Manager 2024 R1.03
Discovery 2024 R1
Discovery 2024 R1.01
Discovery 2024 R1.02
Discovery 2024 R1.03
SpaceClaim 2024 R1
SpaceClaim 2024 R1.01
SpaceClaim 2024 R1.02
SpaceClaim 2024 R1.03
Icepak (includes CFD-Post) 2024 R1
Icepak (includes CFD-Post) 2024 R1.01
Icepak (includes CFD-Post) 2024 R1.02
Icepak (includes CFD-Post) 2024 R1.03
Fluids 2024 R1
Fluids 2024 R1.01
Fluids 2024 R1.02
Fluids 2024 R1.03
CFD-Post only 2024 R1
CFD-Post only 2024 R1.01
CFD-Post only 2024 R1.02
CFD-Post only 2024 R1.03
CFX (includes CFD-Post) 2024 R1
CFX (includes CFD-Post) 2024 R1.01
CFX (includes CFD-Post) 2024 R1.02
CFX (includes CFD-Post) 2024 R1.03
Chemkin 2024 R1
Chemkin 2024 R1.01
Chemkin 2024 R1.02
Chemkin 2024 R1.03
EnSight 2024 R1
EnSight 2024 R1.01
EnSight 2024 R1.02
EnSight 2024 R1.03
FENSAP-ICE 2024 R1
FENSAP-ICE 2024 R1.01
FENSAP-ICE 2024 R1.02
FENSAP-ICE 2024 R1.03
Fluent (includes CFD-Post) 2024 R1
Fluent (includes CFD-Post) 2024 R1.01
Fluent (includes CFD-Post) 2024 R1.02
Fluent (includes CFD-Post) 2024 R1.03
Polyflow (includes CFD-Post) 2024 R1
Polyflow (includes CFD-Post) 2024 R1.01
Polyflow (includes CFD-Post) 2024 R1.02
Polyflow (includes CFD-Post) 2024 R1.03
Forte (includes EnSight) 2024 R1
Forte (includes EnSight) 2024 R1.01
Forte (includes EnSight) 2024 R1.02
Forte (includes EnSight) 2024 R1.03
ICEM CFD 2024 R1
ICEM CFD 2024 R1.01
ICEM CFD 2024 R1.02
ICEM CFD 2024 R1.03
TurboGrid 2024 R1
TurboGrid 2024 R1.01
TurboGrid 2024 R1.02
TurboGrid 2024 R1.03
Speos 2024 R1
Speos 2024 R1.01
Speos 2024 R1.02
Speos 2024 R1.03
Speos HPC 2024 R1
Speos HPC 2024 R1.01
Speos HPC 2024 R1.02
Speos HPC 2024 R1.03
optiSLang 2024 R1
optiSLang 2024 R1.01
optiSLang 2024 R1.02
optiSLang 2024 R1.03
Additive 2024 R1
Additive 2024 R1.01
Additive 2024 R1.02
Additive 2024 R1.03
Aqwa 2024 R1
Aqwa 2024 R1.01
Aqwa 2024 R1.02
Aqwa 2024 R1.03
Autodyn 2024 R1
Autodyn 2024 R1.01
Autodyn 2024 R1.02
Autodyn 2024 R1.03
Customization Files for User Programmable Features 2024 R1
Customization Files for User Programmable Features 2024 R1.01
Customization Files for User Programmable Features 2024 R1.02
Customization Files for User Programmable Features 2024 R1.03
LS-DYNA 2024 R1
LS-DYNA 2024 R1.01
LS-DYNA 2024 R1.02
LS-DYNA 2024 R1.03
Mechanical Products 2024 R1
Mechanical Products 2024 R1.01
Mechanical Products 2024 R1.02
Mechanical Products 2024 R1.03
Motion 2024 R1
Motion 2024 R1.01
Motion 2024 R1.02
Motion 2024 R1.03
Sherlock 2024 R1
Sherlock 2024 R1.01
Sherlock 2024 R1.02
Sherlock 2024 R1.03
Sound - SAS 2024 R1
Sound - SAS 2024 R1.01
Sound - SAS 2024 R1.02
Sound - SAS 2024 R1.03
***** MAPDL COMMAND LINE ARGUMENTS *****
BATCH MODE REQUESTED (-b) = NOLIST
INPUT FILE COPY MODE (-c) = COPY
DISTRIBUTED MEMORY PARALLEL REQUESTED
4 PARALLEL PROCESSES REQUESTED WITH SINGLE THREAD PER PROCESS
TOTAL OF 4 CORES REQUESTED
INPUT FILE NAME = C:\Users\ansys\AppData\Local\Temp\WB_ansys_6240_2\_ProjectScratch\Scr1AEE\dummy.dat
OUTPUT FILE NAME = C:\Users\ansys\AppData\Local\Temp\WB_ansys_6240_2\_ProjectScratch\Scr1AEE\solve.out
START-UP FILE MODE = NOREAD
STOP FILE MODE = NOREAD
RELEASE= 2024 R1 BUILD= 24.1 UP20231106 VERSION=WINDOWS x64
CURRENT JOBNAME=file0 08:55:27 JUN 14, 2024 CP= 0.062
PARAMETER _DS_PROGRESS = 999.0000000
/INPUT FILE= ds.dat LINE= 0
*** NOTE *** CP = 0.219 TIME= 08:55:27
The /CONFIG,NOELDB command is not valid in a distributed memory
parallel solution. Command is ignored.
*GET _WALLSTRT FROM ACTI ITEM=TIME WALL VALUE= 8.92416667
TITLE=
wbnew--Static Structural (A5)
ACT Extensions:
LSDYNA, 2024.1
5f463412-bd3e-484b-87e7-cbc0a665e474, wbex
/COM, ANSYSMotion, 2024.1
20180725-3f81-49eb-9f31-41364844c769, wbex
SET PARAMETER DIMENSIONS ON _WB_PROJECTSCRATCH_DIR
TYPE=STRI DIMENSIONS= 248 1 1
PARAMETER _WB_PROJECTSCRATCH_DIR(1) = C:\Users\ansys\AppData\Local\Temp\WB_ansys_6240_2\_ProjectScratch\Scr1AEE\
SET PARAMETER DIMENSIONS ON _WB_SOLVERFILES_DIR
TYPE=STRI DIMENSIONS= 248 1 1
PARAMETER _WB_SOLVERFILES_DIR(1) = C:\Users\ansys\AppData\Local\Temp\WB_ansys_6240_2\wbnew_files\dp0\SYS\MECH\
SET PARAMETER DIMENSIONS ON _WB_USERFILES_DIR
TYPE=STRI DIMENSIONS= 248 1 1
PARAMETER _WB_USERFILES_DIR(1) = C:\Users\ansys\AppData\Local\Temp\WB_ansys_6240_2\wbnew_files\user_files\
--- Data in consistent NMM units. See Solving Units in the help system for more
MPA UNITS SPECIFIED FOR INTERNAL
LENGTH = MILLIMETERS (mm)
MASS = TONNE (Mg)
TIME = SECONDS (sec)
TEMPERATURE = CELSIUS (C)
TOFFSET = 273.0
FORCE = NEWTON (N)
HEAT = MILLIJOULES (mJ)
INPUT UNITS ARE ALSO SET TO MPA
*** MAPDL - ENGINEERING ANALYSIS SYSTEM RELEASE 2024 R1 24.1 ***
Ansys Mechanical Enterprise
00000000 VERSION=WINDOWS x64 08:55:27 JUN 14, 2024 CP= 0.250
wbnew--Static Structural (A5)
***** MAPDL ANALYSIS DEFINITION (PREP7) *****
*********** Nodes for the whole assembly ***********
*********** Elements for Body 1 "Solid" ***********
*********** Elements for Body 2 "Solid" ***********
*********** Send User Defined Coordinate System(s) ***********
*********** Set Reference Temperature ***********
*********** Send Materials ***********
*********** Create Contact "Contact Region" ***********
Real Constant Set For Above Contact Is 4 & 3
*********** Fixed Supports ***********
*********** Define Force Using Surface Effect Elements ***********
***** ROUTINE COMPLETED ***** CP = 0.312
--- Number of total nodes = 4879
--- Number of contact elements = 198
--- Number of spring elements = 0
--- Number of bearing elements = 0
--- Number of solid elements = 711
--- Number of condensed parts = 0
--- Number of total elements = 909
*GET _WALLBSOL FROM ACTI ITEM=TIME WALL VALUE= 8.92416667
****************************************************************************
************************* SOLUTION ********************************
****************************************************************************
***** MAPDL SOLUTION ROUTINE *****
PERFORM A STATIC ANALYSIS
THIS WILL BE A NEW ANALYSIS
PARAMETER _THICKRATIO = 0.000000000
USE SPARSE MATRIX DIRECT SOLVER
CONTACT INFORMATION PRINTOUT LEVEL 1
CHECK INITIAL OPEN/CLOSED STATUS OF SELECTED CONTACT ELEMENTS
AND LIST DETAILED CONTACT PAIR INFORMATION
SPLIT CONTACT SURFACES AT SOLVE PHASE
NUMBER OF SPLITTING TBD BY PROGRAM
DO NOT COMBINE ELEMENT MATRIX FILES (.emat) AFTER DISTRIBUTED PARALLEL SOLUTION
DO NOT COMBINE ELEMENT SAVE DATA FILES (.esav) AFTER DISTRIBUTED PARALLEL SOLUTION
NLDIAG: Nonlinear diagnostics CONT option is set to ON.
Writing frequency : each ITERATION.
DO NOT SAVE ANY RESTART FILES AT ALL
****************************************************
******************* SOLVE FOR LS 1 OF 1 ****************
SELECT FOR ITEM=TYPE COMPONENT=
IN RANGE 5 TO 5 STEP 1
40 ELEMENTS (OF 909 DEFINED) SELECTED BY ESEL COMMAND.
SELECT ALL NODES HAVING ANY ELEMENT IN ELEMENT SET.
182 NODES (OF 4879 DEFINED) SELECTED FROM
40 SELECTED ELEMENTS BY NSLE COMMAND.
SPECIFIED SURFACE LOAD PRES FOR ALL SELECTED ELEMENTS LKEY = 1 KVAL = 1
VALUES = 0.0000 0.0000 0.0000 0.0000
SPECIFIED SURFACE LOAD PRES FOR ALL SELECTED ELEMENTS LKEY = 2 KVAL = 1
VALUES = 0.0000 0.0000 0.0000 0.0000
SPECIFIED SURFACE LOAD PRES FOR ALL SELECTED ELEMENTS LKEY = 3 KVAL = 1
VALUES = -0.19417E-04 -0.19417E-04 -0.19417E-04 -0.19417E-04
ALL SELECT FOR ITEM=NODE COMPONENT=
IN RANGE 1 TO 4879 STEP 1
4879 NODES (OF 4879 DEFINED) SELECTED BY NSEL COMMAND.
ALL SELECT FOR ITEM=ELEM COMPONENT=
IN RANGE 1 TO 2291 STEP 1
909 ELEMENTS (OF 909 DEFINED) SELECTED BY ESEL COMMAND.
PRINTOUT RESUMED BY /GOP
USE 1 SUBSTEPS INITIALLY THIS LOAD STEP FOR ALL DEGREES OF FREEDOM
FOR AUTOMATIC TIME STEPPING:
USE 1 SUBSTEPS AS A MAXIMUM
USE 1 SUBSTEPS AS A MINIMUM
TIME= 1.0000
ERASE THE CURRENT DATABASE OUTPUT CONTROL TABLE.
WRITE ALL ITEMS TO THE DATABASE WITH A FREQUENCY OF NONE
FOR ALL APPLICABLE ENTITIES
WRITE NSOL ITEMS TO THE DATABASE WITH A FREQUENCY OF ALL
FOR ALL APPLICABLE ENTITIES
WRITE RSOL ITEMS TO THE DATABASE WITH A FREQUENCY OF ALL
FOR ALL APPLICABLE ENTITIES
WRITE EANG ITEMS TO THE DATABASE WITH A FREQUENCY OF ALL
FOR ALL APPLICABLE ENTITIES
WRITE ETMP ITEMS TO THE DATABASE WITH A FREQUENCY OF ALL
FOR ALL APPLICABLE ENTITIES
WRITE VENG ITEMS TO THE DATABASE WITH A FREQUENCY OF ALL
FOR ALL APPLICABLE ENTITIES
WRITE STRS ITEMS TO THE DATABASE WITH A FREQUENCY OF ALL
FOR ALL APPLICABLE ENTITIES
WRITE EPEL ITEMS TO THE DATABASE WITH A FREQUENCY OF ALL
FOR ALL APPLICABLE ENTITIES
WRITE EPPL ITEMS TO THE DATABASE WITH A FREQUENCY OF ALL
FOR ALL APPLICABLE ENTITIES
WRITE CONT ITEMS TO THE DATABASE WITH A FREQUENCY OF ALL
FOR ALL APPLICABLE ENTITIES
*GET ANSINTER_ FROM ACTI ITEM=INT VALUE= 0.00000000
*IF ANSINTER_ ( = 0.00000 ) NE
0 ( = 0.00000 ) THEN
*ENDIF
*** NOTE *** CP = 0.516 TIME= 08:55:27
The automatic domain decomposition logic has selected the MESH domain
decomposition method with 4 processes per solution.
***** MAPDL SOLVE COMMAND *****
*** WARNING *** CP = 0.516 TIME= 08:55:27
Element shape checking is currently inactive. Issue SHPP,ON or
SHPP,WARN to reactivate, if desired.
*** NOTE *** CP = 0.516 TIME= 08:55:27
The model data was checked and warning messages were found.
Please review output or errors file (
C:\Users\ansys\AppData\Local\Temp\WB_ansys_6240_2\_ProjectScratch\Scr1A
AEE\file0.err ) for these warning messages.
*** SELECTION OF ELEMENT TECHNOLOGIES FOR APPLICABLE ELEMENTS ***
--- GIVE SUGGESTIONS AND RESET THE KEY OPTIONS ---
ELEMENT TYPE 1 IS SOLID186. KEYOPT(2)=0 IS SUGGESTED AND HAS BEEN RESET.
KEYOPT(1-12)= 0 0 0 0 0 0 0 0 0 0 0 0
ELEMENT TYPE 2 IS SOLID186. KEYOPT(2)=0 IS SUGGESTED AND HAS BEEN RESET.
KEYOPT(1-12)= 0 0 0 0 0 0 0 0 0 0 0 0
*** MAPDL - ENGINEERING ANALYSIS SYSTEM RELEASE 2024 R1 24.1 ***
Ansys Mechanical Enterprise
00000000 VERSION=WINDOWS x64 08:55:27 JUN 14, 2024 CP= 0.516
wbnew--Static Structural (A5)
S O L U T I O N O P T I O N S
PROBLEM DIMENSIONALITY. . . . . . . . . . . . .3-D
DEGREES OF FREEDOM. . . . . . UX UY UZ
ANALYSIS TYPE . . . . . . . . . . . . . . . . .STATIC (STEADY-STATE)
OFFSET TEMPERATURE FROM ABSOLUTE ZERO . . . . . 273.15
EQUATION SOLVER OPTION. . . . . . . . . . . . .SPARSE
GLOBALLY ASSEMBLED MATRIX . . . . . . . . . . .SYMMETRIC
*** WARNING *** CP = 0.516 TIME= 08:55:27
Material number 5 (used by element 2252) should normally have at least
one MP or one TB type command associated with it. Output of energy by
material may not be available.
*** NOTE *** CP = 0.516 TIME= 08:55:27
The step data was checked and warning messages were found.
Please review output or errors file (
C:\Users\ansys\AppData\Local\Temp\WB_ansys_6240_2\_ProjectScratch\Scr1A
AEE\file0.err ) for these warning messages.
*** NOTE *** CP = 0.516 TIME= 08:55:27
The conditions for direct assembly have been met. No .emat or .erot
files will be produced.
CHECK INITIAL OPEN/CLOSED STATUS OF SELECTED CONTACT ELEMENTS
AND LIST DETAILED CONTACT PAIR INFORMATION
39 CONTACT ELEMENTS & 40 TARGET ELEMENTS ARE UNSELECTED FOR PREPARATION OF SPLITTING.
1 CONTACT PAIRS ARE UNSELECTED.
*** NOTE *** CP = 0.797 TIME= 08:55:27
The maximum number of contact elements in any single contact pair is
40, which is smaller than the optimal domain size of 120 elements for
the given number of CPU domains (4). Therefore, no contact pairs are
being split by the CNCH,DMP logic.
BECAUSE SPLIT WAS NOT DONE FOR CONNECT REGION(S), UNSELECTED ELEMENTS ARE REVERTED (SELECTED).
*** NOTE *** CP = 1.078 TIME= 08:55:27
Symmetric Deformable- deformable contact pair identified by real
constant set 3 and contact element type 3 has been set up. The
companion pair has real constant set ID 4. Both pairs should have the
same behavior.
MAPDL will keep the current pair and deactivate its companion pair,
resulting in asymmetric contact.
Auto surface constraint is built
Contact algorithm: MPC based approach
*** NOTE *** CP = 1.078 TIME= 08:55:27
Contact related postprocess items (ETABLE, pressure ...) are not
available.
Contact detection at: nodal point (normal to target surface)
MPC will be built internally to handle bonded contact.
Average contact surface length 1160.1
Average contact pair depth 1111.1
Average target surface length 1164.4
Default pinball region factor PINB 0.25000
The resulting pinball region 277.78
Default target edge extension factor TOLS 2.0000
Initial penetration/gap is excluded.
Bonded contact (always) is defined.
*** NOTE *** CP = 1.078 TIME= 08:55:27
Max. Initial penetration 0 was detected between contact element 2134
and target element 2242.
****************************************
*** NOTE *** CP = 1.078 TIME= 08:55:27
Symmetric Deformable- deformable contact pair identified by real
constant set 4 and contact element type 3 has been set up. The
companion pair has real constant set ID 3. Both pairs should have the
same behavior.
MAPDL will deactivate the current pair and keep its companion pair,
resulting in asymmetric contact.
Auto surface constraint is built
Contact algorithm: MPC based approach
*** NOTE *** CP = 1.078 TIME= 08:55:27
Contact related postprocess items (ETABLE, pressure ...) are not
available.
Contact detection at: nodal point (normal to target surface)
MPC will be built internally to handle bonded contact.
Average contact surface length 1184.5
Average contact pair depth 1111.1
Average target surface length 1140.9
Default pinball region factor PINB 0.25000
The resulting pinball region 277.78
Default target edge extension factor TOLS 2.0000
Initial penetration/gap is excluded.
Bonded contact (always) is defined.
*** NOTE *** CP = 1.078 TIME= 08:55:27
Max. Initial penetration 0 was detected between contact element 2174
and target element 2124.
****************************************
D I S T R I B U T E D D O M A I N D E C O M P O S E R
...Number of elements: 909
...Number of nodes: 4879
...Decompose to 4 CPU domains
...Element load balance ratio = 1.134
L O A D S T E P O P T I O N S
LOAD STEP NUMBER. . . . . . . . . . . . . . . . 1
TIME AT END OF THE LOAD STEP. . . . . . . . . . 1.0000
NUMBER OF SUBSTEPS. . . . . . . . . . . . . . . 1
STEP CHANGE BOUNDARY CONDITIONS . . . . . . . . NO
PRINT OUTPUT CONTROLS . . . . . . . . . . . . .NO PRINTOUT
DATABASE OUTPUT CONTROLS
ITEM FREQUENCY COMPONENT
ALL NONE
NSOL ALL
RSOL ALL
EANG ALL
ETMP ALL
VENG ALL
STRS ALL
EPEL ALL
EPPL ALL
CONT ALL
SOLUTION MONITORING INFO IS WRITTEN TO FILE= file.mntr
*********** PRECISE MASS SUMMARY ***********
TOTAL RIGID BODY MASS MATRIX ABOUT ORIGIN
Translational mass | Coupled translational/rotational mass
6468.7 0.0000 0.0000 | 0.0000 -0.26284E-06 0.46560E-02
0.0000 6468.7 0.0000 | 0.26284E-06 0.0000 -0.96697
0.0000 0.0000 6468.7 | -0.46560E-02 0.96697 0.0000
------------------------------------------ | ------------------------------------------
| Rotational mass (inertia)
| 0.35551E+12 -121.48 -5879.1
| -121.48 0.35551E+12 -23669.
| -5879.1 -23669. 0.27977E+12
TOTAL MASS = 6468.7
The mass principal axes coincide with the global Cartesian axes
CENTER OF MASS (X,Y,Z)= -0.14949E-03 -0.71978E-06 -0.40632E-10
TOTAL INERTIA ABOUT CENTER OF MASS
0.35551E+12 -121.48 -5879.1
-121.48 0.35551E+12 -23669.
-5879.1 -23669. 0.27977E+12
The inertia principal axes coincide with the global Cartesian axes
*** MASS SUMMARY BY ELEMENT TYPE ***
TYPE MASS
1 3234.34
2 3234.34
Range of element maximum matrix coefficients in global coordinates
Maximum = 392679482 at element 58.
Minimum = 182655886 at element 658.
*** ELEMENT MATRIX FORMULATION TIMES
TYPE NUMBER ENAME TOTAL CP AVE CP
1 360 SOLID186 0.047 0.000130
2 351 SOLID186 0.062 0.000178
3 79 CONTA174 0.016 0.000198
4 79 TARGE170 0.000 0.000000
5 40 SURF154 0.000 0.000000
Time at end of element matrix formulation CP = 1.921875.
DISTRIBUTED SPARSE MATRIX DIRECT SOLVER.
Number of equations = 13554, Maximum wavefront = 168
Process memory allocated for solver = 21.339 MB
Process memory required for in-core solution = 20.545 MB
Process memory required for out-of-core solution = 12.195 MB
Total memory allocated for solver = 74.072 MB
Total memory required for in-core solution = 71.228 MB
Total memory required for out-of-core solution = 41.166 MB
*** NOTE *** CP = 2.047 TIME= 08:55:28
The Distributed Sparse Matrix Solver is currently running in the
in-core memory mode. This memory mode uses the most amount of memory
in order to avoid using the hard drive as much as possible, which most
often results in the fastest solution time. This mode is recommended
if enough physical memory is present to accommodate all of the solver
data.
curEqn= 3717 totEqn= 3717 Job CP sec= 2.141
Factor Done= 100% Factor Wall sec= 0.045 rate= 10.1 GFlops
Distributed sparse solver maximum pivot= 1.041046001E+09 at node 3192
UX.
Distributed sparse solver minimum pivot= 10144616.8 at node 974 UY.
Distributed sparse solver minimum pivot in absolute value= 10144616.8
at node 974 UY.
*** ELEMENT RESULT CALCULATION TIMES
TYPE NUMBER ENAME TOTAL CP AVE CP
1 360 SOLID186 0.062 0.000174
2 351 SOLID186 0.094 0.000267
3 79 CONTA174 0.000 0.000000
5 40 SURF154 0.000 0.000000
*** NODAL LOAD CALCULATION TIMES
TYPE NUMBER ENAME TOTAL CP AVE CP
1 360 SOLID186 0.031 0.000087
2 351 SOLID186 0.000 0.000000
3 79 CONTA174 0.000 0.000000
5 40 SURF154 0.000 0.000000
*** LOAD STEP 1 SUBSTEP 1 COMPLETED. CUM ITER = 1
*** TIME = 1.00000 TIME INC = 1.00000 NEW TRIANG MATRIX
*** MAPDL BINARY FILE STATISTICS
BUFFER SIZE USED= 16384
0.312 MB WRITTEN ON ELEMENT SAVED DATA FILE: file0.esav
3.375 MB WRITTEN ON ASSEMBLED MATRIX FILE: file0.full
0.625 MB WRITTEN ON RESULTS FILE: file0.rst
*************** Write FE CONNECTORS *********
WRITE OUT CONSTRAINT EQUATIONS TO FILE= file.ce
****************************************************
*************** FINISHED SOLVE FOR LS 1 *************
*GET _WALLASOL FROM ACTI ITEM=TIME WALL VALUE= 8.92444444
PRINTOUT RESUMED BY /GOP
FINISH SOLUTION PROCESSING
***** ROUTINE COMPLETED ***** CP = 2.328
*** MAPDL - ENGINEERING ANALYSIS SYSTEM RELEASE 2024 R1 24.1 ***
Ansys Mechanical Enterprise
00000000 VERSION=WINDOWS x64 08:55:28 JUN 14, 2024 CP= 2.344
wbnew--Static Structural (A5)
***** MAPDL RESULTS INTERPRETATION (POST1) *****
*** NOTE *** CP = 2.344 TIME= 08:55:28
Reading results into the database (SET command) will update the current
displacement and force boundary conditions in the database with the
values from the results file for that load set. Note that any
subsequent solutions will use these values unless action is taken to
either SAVE the current values or not overwrite them (/EXIT,NOSAVE).
Set Encoding of XML File to:ISO-8859-1
Set Output of XML File to:
PARM, , , , , , , , , , , ,
, , , , , , ,
DATABASE WRITTEN ON FILE parm.xml
EXIT THE MAPDL POST1 DATABASE PROCESSOR
***** ROUTINE COMPLETED ***** CP = 2.344
PRINTOUT RESUMED BY /GOP
*GET _WALLDONE FROM ACTI ITEM=TIME WALL VALUE= 8.92444444
PARAMETER _PREPTIME = 0.000000000
PARAMETER _SOLVTIME = 1.000000000
PARAMETER _POSTTIME = 0.000000000
PARAMETER _TOTALTIM = 1.000000000
*GET _DLBRATIO FROM ACTI ITEM=SOLU DLBR VALUE= 1.13397129
*GET _COMBTIME FROM ACTI ITEM=SOLU COMB VALUE= 0.262217000E-01
*GET _SSMODE FROM ACTI ITEM=SOLU SSMM VALUE= 2.00000000
*GET _NDOFS FROM ACTI ITEM=SOLU NDOF VALUE= 13554.0000
*GET _SOL_END_TIME FROM ACTI ITEM=SET TIME VALUE= 1.00000000
*IF _sol_end_time ( = 1.00000 ) EQ
1.000000 ( = 1.00000 ) THEN
/FCLEAN COMMAND REMOVING ALL LOCAL FILES
*ENDIF
--- Total number of nodes = 4879
--- Total number of elements = 909
--- Element load balance ratio = 1.13397129
--- Time to combine distributed files = 2.62217E-02
--- Sparse memory mode = 2
--- Number of DOF = 13554
EXIT MAPDL WITHOUT SAVING DATABASE
NUMBER OF WARNING MESSAGES ENCOUNTERED= 2
NUMBER OF ERROR MESSAGES ENCOUNTERED= 0
+--------------------- M A P D L S T A T I S T I C S ------------------------+
Release: 2024 R1 Build: 24.1 Update: UP20231106 Platform: WINDOWS x64
Date Run: 06/14/2024 Time: 08:55 Process ID: 1168
Operating System: Windows 10 (Build: 19045)
Processor Model: Intel(R) Xeon(R) Platinum 8171M CPU @ 2.60GHz
Compiler: Intel(R) Fortran Compiler Classic Version 2021.9 (Build: 20230302)
Intel(R) C/C++ Compiler Classic Version 2021.9 (Build: 20230302)
Intel(R) Math Kernel Library Version 2020.0.0 Product Build 20191125
BLAS Library supplied by Intel(R) MKL
Number of machines requested : 1
Total number of cores available : 8
Number of physical cores available : 4
Number of processes requested : 4
Number of threads per process requested : 1
Total number of cores requested : 4 (Distributed Memory Parallel)
MPI Type: INTELMPI
MPI Version: Intel(R) MPI Library 2021.10 for Windows* OS
GPU Acceleration: Not Requested
Job Name: file0
Input File: dummy.dat
Core Machine Name Working Directory
-----------------------------------------------------
0 pyworkbench C:\Users\ansys\AppData\Local\Temp\WB_ansys_6240_2\_ProjectScratch\Scr1AEE
1 pyworkbench C:\Users\ansys\AppData\Local\Temp\WB_ansys_6240_2\_ProjectScratch\Scr1AEE
2 pyworkbench C:\Users\ansys\AppData\Local\Temp\WB_ansys_6240_2\_ProjectScratch\Scr1AEE
3 pyworkbench C:\Users\ansys\AppData\Local\Temp\WB_ansys_6240_2\_ProjectScratch\Scr1AEE
Latency time from master to core 1 = 3.415 microseconds
Latency time from master to core 2 = 2.832 microseconds
Latency time from master to core 3 = 2.698 microseconds
Communication speed from master to core 1 = 5376.42 MB/sec
Communication speed from master to core 2 = 5264.27 MB/sec
Communication speed from master to core 3 = 5703.49 MB/sec
Total CPU time for main thread : 1.4 seconds
Total CPU time summed for all threads : 3.1 seconds
Elapsed time spent obtaining a license : 0.4 seconds
Elapsed time spent pre-processing model (/PREP7) : 0.0 seconds
Elapsed time spent solution - preprocessing : 0.2 seconds
Elapsed time spent computing solution : 0.5 seconds
Elapsed time spent solution - postprocessing : 0.0 seconds
Elapsed time spent post-processing model (/POST1) : 0.0 seconds
Equation solver used : Sparse (symmetric)
Equation solver computational rate : 30.2 Gflops
Sum of disk space used on all processes : 15.7 MB
Sum of memory used on all processes : 549.0 MB
Sum of memory allocated on all processes : 2880.0 MB
Physical memory available : 32 GB
Total amount of I/O written to disk : 0.0 GB
Total amount of I/O read from disk : 0.0 GB
+------------------ E N D M A P D L S T A T I S T I C S -------------------+
*-----------------------------------------------------------------------------*
| |
| RUN COMPLETED |
| |
|-----------------------------------------------------------------------------|
| |
| Ansys MAPDL 2024 R1 Build 24.1 UP20231106 WINDOWS x64 |
| |
|-----------------------------------------------------------------------------|
| |
| Database Requested(-db) 1024 MB Scratch Memory Requested 1024 MB |
| Max Database Used(Master) 3 MB Max Scratch Used(Master) 138 MB |
| Max Database Used(Workers) 1 MB Max Scratch Used(Workers) 136 MB |
| Sum Database Used(All) 6 MB Sum Scratch Used(All) 543 MB |
| |
|-----------------------------------------------------------------------------|
| |
| CP Time (sec) = 3.078 Time = 08:55:28 |
| Elapsed Time (sec) = 3.000 Date = 06/14/2024 |
| |
*-----------------------------------------------------------------------------*
Plot the deformation result (deformation.png
) using pyvista
. A Plotter
object is created, and the image is added as a background. The plot is then displayed.
[9]:
pl = pv.Plotter()
pl.add_background_image(os.path.join(str(workdir.absolute()), "deformation.png"))
pl.show()
Finally, the exit
method is called on both the PyMechanical and Workbench clients to gracefully shut down the services, ensuring that all resources are properly released.
[10]:
mechanical.exit()
wb.exit()