Basic Valve Implementation#

This example demonstrates a basic implementation of a valve in Python.

Import necessary libraries#

import os

from PIL import Image
from ansys.mechanical.core import App
from ansys.mechanical.core.examples import delete_downloads, download_file
from matplotlib import image as mpimg
from matplotlib import pyplot as plt
from matplotlib.animation import FuncAnimation

Embed mechanical and set global variables

app = App()
app.update_globals(globals())
print(app)

cwd = os.path.join(os.getcwd(), "out")


def display_image(image_name):
    plt.figure(figsize=(16, 9))
    plt.imshow(mpimg.imread(os.path.join(cwd, image_name)))
    plt.xticks([])
    plt.yticks([])
    plt.axis("off")
    plt.show()
Ansys Mechanical [Ansys Mechanical Enterprise]
Product Version:242
Software build date: 06/03/2024 09:35:09

Configure graphics for image export#

Graphics.Camera.SetSpecificViewOrientation(ViewOrientationType.Iso)
image_export_format = GraphicsImageExportFormat.PNG
settings_720p = Ansys.Mechanical.Graphics.GraphicsImageExportSettings()
settings_720p.Resolution = GraphicsResolutionType.EnhancedResolution
settings_720p.Background = GraphicsBackgroundType.White
settings_720p.Width = 1280
settings_720p.Height = 720
settings_720p.CurrentGraphicsDisplay = False

Download geometry and import#

Download geometry

geometry_path = download_file("Valve.pmdb", "pymechanical", "embedding")

Import geometry

geometry_import = Model.GeometryImportGroup.AddGeometryImport()
geometry_import_format = (
    Ansys.Mechanical.DataModel.Enums.GeometryImportPreference.Format.Automatic
)
geometry_import_preferences = Ansys.ACT.Mechanical.Utilities.GeometryImportPreferences()
geometry_import_preferences.ProcessNamedSelections = True
geometry_import.Import(
    geometry_path, geometry_import_format, geometry_import_preferences
)

app.plot()
valve

Assign materials and mesh the geometry#

material_assignment = Model.Materials.AddMaterialAssignment()
material_assignment.Material = "Structural Steel"
sel = ExtAPI.SelectionManager.CreateSelectionInfo(
    Ansys.ACT.Interfaces.Common.SelectionTypeEnum.GeometryEntities
)
sel.Ids = [
    body.GetGeoBody().Id
    for body in Model.Geometry.GetChildren(
        Ansys.Mechanical.DataModel.Enums.DataModelObjectCategory.Body, True
    )
]
material_assignment.Location = sel

Define mesh settings, generate mesh

mesh = Model.Mesh
mesh.ElementSize = Quantity(25, "mm")
mesh.GenerateMesh()
Tree.Activate([mesh])
Graphics.ExportImage(os.path.join(cwd, "mesh.png"), image_export_format, settings_720p)
display_image("mesh.png")
valve

Define analysis and boundary conditions#

analysis = Model.AddStaticStructuralAnalysis()

fixed_support = analysis.AddFixedSupport()
fixed_support.Location = ExtAPI.DataModel.GetObjectsByName("NSFixedSupportFaces")[0]

frictionless_support = analysis.AddFrictionlessSupport()
frictionless_support.Location = ExtAPI.DataModel.GetObjectsByName(
    "NSFrictionlessSupportFaces"
)[0]

pressure = analysis.AddPressure()
pressure.Location = ExtAPI.DataModel.GetObjectsByName("NSInsideFaces")[0]

pressure.Magnitude.Inputs[0].DiscreteValues = [Quantity("0 [s]"), Quantity("1 [s]")]
pressure.Magnitude.Output.DiscreteValues = [Quantity("0 [Pa]"), Quantity("15 [MPa]")]

analysis.Activate()
Graphics.Camera.SetFit()
Graphics.ExportImage(
    os.path.join(cwd, "boundary_conditions.png"), image_export_format, settings_720p
)
display_image("boundary_conditions.png")
valve

Add results

solution = analysis.Solution
deformation = solution.AddTotalDeformation()
stress = solution.AddEquivalentStress()

Solve

solution.Solve(True)

Messages#

Messages = ExtAPI.Application.Messages
if Messages:
    for message in Messages:
        print(f"[{message.Severity}] {message.DisplayString}")
else:
    print("No [Info]/[Warning]/[Error] Messages")
No [Info]/[Warning]/[Error] Messages

Results#

Total deformation

Tree.Activate([deformation])
Graphics.ExportImage(
    os.path.join(cwd, "totaldeformation_valve.png"), image_export_format, settings_720p
)
display_image("totaldeformation_valve.png")
valve

Stress

Tree.Activate([stress])
Graphics.ExportImage(
    os.path.join(cwd, "stress_valve.png"), image_export_format, settings_720p
)
display_image("stress_valve.png")
valve

Export stress animation

animation_export_format = (
    Ansys.Mechanical.DataModel.Enums.GraphicsAnimationExportFormat.GIF
)
settings_720p = Ansys.Mechanical.Graphics.AnimationExportSettings()
settings_720p.Width = 1280
settings_720p.Height = 720

stress.ExportAnimation(
    os.path.join(cwd, "Valve.gif"), animation_export_format, settings_720p
)
gif = Image.open(os.path.join(cwd, "Valve.gif"))
fig, ax = plt.subplots(figsize=(16, 9))
ax.axis("off")
img = ax.imshow(gif.convert("RGBA"))


def update(frame):
    gif.seek(frame)
    img.set_array(gif.convert("RGBA"))
    return [img]


ani = FuncAnimation(
    fig, update, frames=range(gif.n_frames), interval=100, repeat=True, blit=True
)
plt.show()

Display output file from solve#

def write_file_contents_to_console(path):
    """Write file contents to console."""
    with open(path, "rt") as file:
        for line in file:
            print(line, end="")


solve_path = analysis.WorkingDir
solve_out_path = os.path.join(solve_path, "solve.out")
if solve_out_path:
    write_file_contents_to_console(solve_out_path)
 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 R2          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 R2

 Point Releases and Patches installed:

 Ansys, Inc. License Manager 2024 R2
 LS-DYNA 2024 R2
 Core WB Files 2024 R2
 Mechanical Products 2024 R2


          *****  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              = /github/home/.mw/Application Data/Ansys/v242/AnsysMechACD6/Project_Mech_Files/StaticStructural/dummy.dat
  OUTPUT FILE NAME             = /github/home/.mw/Application Data/Ansys/v242/AnsysMechACD6/Project_Mech_Files/StaticStructural/solve.out
  START-UP FILE MODE           = NOREAD
  STOP FILE MODE               = NOREAD

 RELEASE= 2024 R2              BUILD= 24.2      UP20240603   VERSION=LINUX x64
 CURRENT JOBNAME=file0  08:23:40  NOV 19, 2024 CP=      0.242


 PARAMETER _DS_PROGRESS =     999.0000000

 /INPUT FILE= ds.dat  LINE=       0



 *** NOTE ***                            CP =       0.342   TIME= 08:23:40
 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.39444444

 TITLE=
 --Static Structural


 SET PARAMETER DIMENSIONS ON  _WB_PROJECTSCRATCH_DIR
  TYPE=STRI  DIMENSIONS=      248        1        1

 PARAMETER _WB_PROJECTSCRATCH_DIR(1) = /github/home/.mw/Application Data/Ansys/v242/AnsysMechACD6/Project_Mech_Files/StaticStructural/

 SET PARAMETER DIMENSIONS ON  _WB_SOLVERFILES_DIR
  TYPE=STRI  DIMENSIONS=      248        1        1

 PARAMETER _WB_SOLVERFILES_DIR(1) = /github/home/.mw/Application Data/Ansys/v242/AnsysMechACD6/Project_Mech_Files/StaticStructural/

 SET PARAMETER DIMENSIONS ON  _WB_USERFILES_DIR
  TYPE=STRI  DIMENSIONS=      248        1        1

 PARAMETER _WB_USERFILES_DIR(1) = /github/home/.mw/Application Data/Ansys/v242/AnsysMechACD6/Project_Mech_Files/UserFiles/
 --- Data in consistent MKS units. See Solving Units in the help system for more

 MKS UNITS SPECIFIED FOR INTERNAL
  LENGTH        (l)  = METER (M)
  MASS          (M)  = KILOGRAM (KG)
  TIME          (t)  = SECOND (SEC)
  TEMPERATURE   (T)  = CELSIUS (C)
  TOFFSET            = 273.0
  CHARGE        (Q)  = COULOMB
  FORCE         (f)  = NEWTON (N) (KG-M/SEC2)
  HEAT               = JOULE (N-M)

  PRESSURE           = PASCAL (NEWTON/M**2)
  ENERGY        (W)  = JOULE (N-M)
  POWER         (P)  = WATT (N-M/SEC)
  CURRENT       (i)  = AMPERE (COULOMBS/SEC)
  CAPACITANCE   (C)  = FARAD
  INDUCTANCE    (L)  = HENRY
  MAGNETIC FLUX      = WEBER
  RESISTANCE    (R)  = OHM
  ELECTRIC POTENTIAL = VOLT

 INPUT  UNITS ARE ALSO SET TO MKS

 *** MAPDL - ENGINEERING ANALYSIS SYSTEM  RELEASE 2024 R2          24.2     ***
 Ansys Mechanical Enterprise
 00000000  VERSION=LINUX x64     08:23:40  NOV 19, 2024 CP=      0.346

 --Static Structural



          ***** MAPDL ANALYSIS DEFINITION (PREP7) *****
 *********** Nodes for the whole assembly ***********
 *********** Elements for Body 1 'Connector\Solid1' ***********
 *********** Elements for Body 2 'Right_elbow\Solid1' ***********
 *********** Elements for Body 3 'Left_elbow\Solid1' ***********
 *********** Send User Defined Coordinate System(s) ***********
 *********** Set Reference Temperature ***********
 *********** Send Materials ***********
 *********** Create Contact "Contact Region" ***********
             Real Constant Set For Above Contact Is 5 & 4
 *********** Create Contact "Contact Region 2" ***********
             Real Constant Set For Above Contact Is 7 & 6
 *********** Send Named Selection as Node Component ***********
 *********** Send Named Selection as Node Component ***********
 *********** Send Named Selection as Node Component ***********
 *********** Fixed Supports ***********
 ********* Frictionless Supports X *********
 ********* Frictionless Supports Z *********
 *********** Node Rotations ***********
 *********** Define Pressure Using Surface Effect Elements "Pressure" **********


 ***** ROUTINE COMPLETED *****  CP =         0.760


 --- Number of total nodes = 26882
 --- Number of contact elements = 3294
 --- Number of spring elements = 0
 --- Number of bearing elements = 0
 --- Number of solid elements = 14427
 --- Number of condensed parts = 0
 --- Number of total elements = 17721

 *GET  _WALLBSOL  FROM  ACTI  ITEM=TIME WALL  VALUE=  8.39444444
 ****************************************************************************
 *************************    SOLUTION       ********************************
 ****************************************************************************

 *****  MAPDL SOLUTION ROUTINE  *****


 PERFORM A STATIC ANALYSIS
  THIS WILL BE A NEW ANALYSIS

 PARAMETER _THICKRATIO =    0.3330000000

 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         8 TO          8 STEP          1

       1694  ELEMENTS (OF      17721  DEFINED) SELECTED BY  ESEL  COMMAND.

 SELECT      ALL NODES HAVING ANY ELEMENT IN ELEMENT SET.

       3556 NODES (OF      26882  DEFINED) SELECTED FROM
     1694 SELECTED ELEMENTS BY NSLE COMMAND.

 GENERATE SURFACE LOAD PRES ON SURFACE DEFINED BY ALL SELECTED NODES
 SET ACCORDING TO TABLE PARAMETER = _LOADVARI56

 NUMBER OF PRES ELEMENT FACE LOADS STORED =       1694

 ALL SELECT   FOR ITEM=NODE COMPONENT=
  IN RANGE         1 TO      26882 STEP          1

      26882  NODES (OF      26882  DEFINED) SELECTED BY NSEL  COMMAND.

 ALL SELECT   FOR ITEM=ELEM COMPONENT=
  IN RANGE         1 TO      25061 STEP          1

      17721  ELEMENTS (OF      17721  DEFINED) SELECTED BY  ESEL  COMMAND.

 ALL SELECT   FOR ITEM=ELEM COMPONENT=
  IN RANGE         1 TO      25061 STEP          1

      17721  ELEMENTS (OF      17721  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 =       1.053   TIME= 08:23:40
 The automatic domain decomposition logic has selected the MESH domain
 decomposition method with 4 processes per solution.

 *****  MAPDL SOLVE    COMMAND  *****

 *** WARNING ***                         CP =       1.204   TIME= 08:23:40
 Element shape checking is currently inactive.  Issue SHPP,ON or
 SHPP,WARN to reactivate, if desired.

 *** NOTE ***                            CP =       1.336   TIME= 08:23:40
 The model data was checked and warning messages were found.
  Please review output or errors file ( /github/home/.mw/Application
 Data/Ansys/v242/AnsysMechACD6/Project_Mech_Files/StaticStructural/file0
 0.err ) for these warning messages.

 *** SELECTION OF ELEMENT TECHNOLOGIES FOR APPLICABLE ELEMENTS ***
      --- GIVE SUGGESTIONS AND RESET THE KEY OPTIONS ---

 ELEMENT TYPE         1 IS SOLID187. IT IS NOT ASSOCIATED WITH FULLY INCOMPRESSIBLE
 HYPERELASTIC MATERIALS. NO SUGGESTION IS AVAILABLE AND NO RESETTING IS NEEDED.

 ELEMENT TYPE         2 IS SOLID187. IT IS NOT ASSOCIATED WITH FULLY INCOMPRESSIBLE
 HYPERELASTIC MATERIALS. NO SUGGESTION IS AVAILABLE AND NO RESETTING IS NEEDED.

 ELEMENT TYPE         3 IS SOLID187. IT IS NOT ASSOCIATED WITH FULLY INCOMPRESSIBLE
 HYPERELASTIC MATERIALS. NO SUGGESTION IS AVAILABLE AND NO RESETTING IS NEEDED.



 *** MAPDL - ENGINEERING ANALYSIS SYSTEM  RELEASE 2024 R2          24.2     ***
 Ansys Mechanical Enterprise
 00000000  VERSION=LINUX x64     08:23:40  NOV 19, 2024 CP=      1.347

 --Static Structural



                       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 =       1.415   TIME= 08:23:40
 Material number 8 (used by element 23368) 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 =       1.454   TIME= 08:23:40
 The step data was checked and warning messages were found.
  Please review output or errors file ( /github/home/.mw/Application
 Data/Ansys/v242/AnsysMechACD6/Project_Mech_Files/StaticStructural/file0
 0.err ) for these warning messages.

 *** NOTE ***                            CP =       1.455   TIME= 08:23:40
 The conditions for direct assembly have been met.  No .emat or .erot
 files will be produced.

 TRIM CONTACT/TARGET SURFACE
 START TRIMMING SMALL/BONDED CONTACT PAIRS FOR DMP RUN.

     400 CONTACT ELEMENTS &     400 TARGET ELEMENTS ARE DELETED DUE TO TRIMMING LOGIC.
       2 CONTACT PAIRS ARE REMOVED.

 CHECK INITIAL OPEN/CLOSED STATUS OF SELECTED CONTACT ELEMENTS
      AND LIST DETAILED CONTACT PAIR INFORMATION

 *** NOTE ***                            CP =       2.626   TIME= 08:23:41
 The maximum number of contact elements in any single contact pair is
 200, which is smaller than the optimal domain size of 926 elements for
 the given number of CPU domains (4).  Therefore, no contact pairs are
 being split by the CNCH,DMP logic.

 *** NOTE ***                            CP =       3.110   TIME= 08:23:41
 Deformable-deformable contact pair identified by real constant set 5
 and contact element type 4 has been set up.
 Auto surface constraint is built
 Contact algorithm: MPC based approach

 *** NOTE ***                            CP =       3.110   TIME= 08:23:41
 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               0.14033E-01
 Average contact pair depth                   0.82697E-02
 Average target surface length                0.13762E-01
 Default pinball region factor PINB           0.25000
 The resulting pinball region                 0.20674E-02
 Default target edge extension factor TOLS     2.0000
 Initial penetration/gap is excluded.
 Bonded contact (always) is defined.

 *** NOTE ***                            CP =       3.111   TIME= 08:23:41
 Max.  Initial penetration 8.326672685E-17 was detected between contact
 element 22262 and target element 21953.
 ****************************************


 *** NOTE ***                            CP =       3.111   TIME= 08:23:41
 Deformable-deformable contact pair identified by real constant set 7
 and contact element type 6 has been set up.
 Auto surface constraint is built
 Contact algorithm: MPC based approach

 *** NOTE ***                            CP =       3.111   TIME= 08:23:41
 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               0.14121E-01
 Average contact pair depth                   0.81425E-02
 Average target surface length                0.13762E-01
 Default pinball region factor PINB           0.25000
 The resulting pinball region                 0.20356E-02
 Default target edge extension factor TOLS     2.0000
 Initial penetration/gap is excluded.
 Bonded contact (always) is defined.

 *** NOTE ***                            CP =       3.112   TIME= 08:23:41
 Max.  Initial penetration 8.326672685E-17 was detected between contact
 element 22977 and target element 22681.
 ****************************************






     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: 16921
  ...Number of nodes:    26882
  ...Decompose to 4 CPU domains
  ...Element load balance ratio =     1.020


                      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

 *** NOTE ***                            CP =       4.144   TIME= 08:23:41
 Deformable-deformable contact pair identified by real constant set 5
 and contact element type 4 has been set up.
 Auto surface constraint is built
 Contact algorithm: MPC based approach

 *** NOTE ***                            CP =       4.144   TIME= 08:23:41
 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               0.14033E-01
 Average contact pair depth                   0.82697E-02
 Average target surface length                0.13762E-01
 Default pinball region factor PINB           0.25000
 The resulting pinball region                 0.20674E-02
 Default target edge extension factor TOLS     2.0000
 Initial penetration/gap is excluded.
 Bonded contact (always) is defined.

 *** NOTE ***                            CP =       4.144   TIME= 08:23:41
 Max.  Initial penetration 8.326672685E-17 was detected between contact
 element 22262 and target element 21953.
 ****************************************



 The FEA model contains 0 external CE equations and 2829 internal CE
 equations.

 *************************************************
  SUMMARY FOR CONTACT PAIR IDENTIFIED BY REAL CONSTANT SET           5
 Max.  Penetration of 0 has been detected between contact element 22168
 and target element 21830.

 Max.  Geometrical gap of 8.326672685E-17 has been detected between
 contact element 22235 and target element 21774.

 Max.  Geometrical penetration of -8.326672685E-17 has been detected
 between contact element 22235 and target element 21774.
 For total 200 contact elements, there are 200 elements are in contact.
 There are 200 elements are in sticking.
 Max.  Pinball distance 2.067419789E-03.
 One of the contact searching regions contains at least 20 target
 elements.
 *************************************************


                         ***********  PRECISE MASS SUMMARY  ***********

   TOTAL RIGID BODY MASS MATRIX ABOUT ORIGIN
               Translational mass               |   Coupled translational/rotational mass
         138.29        0.0000        0.0000     |     0.0000       -56.537        30.296
         0.0000        138.29        0.0000     |     56.537        0.0000       0.73844E-02
         0.0000        0.0000        138.29     |    -30.296      -0.73844E-02    0.0000
     ------------------------------------------ | ------------------------------------------
                                                |         Rotational mass (inertia)
                                                |     31.211       0.16359E-02   0.31000E-02
                                                |    0.16359E-02    27.754       -12.386
                                                |    0.31000E-02   -12.386        11.103

   TOTAL MASS =  138.29
     The mass principal axes coincide with the global Cartesian axes

   CENTER OF MASS (X,Y,Z)=   0.53397E-04  -0.21907      -0.40882

   TOTAL INERTIA ABOUT CENTER OF MASS
         1.4604       0.18127E-04   0.81110E-04
        0.18127E-04    4.6403       0.19281E-05
        0.81110E-04   0.19281E-05    4.4656
     The inertia principal axes coincide with the global Cartesian axes


  *** MASS SUMMARY BY ELEMENT TYPE ***

  TYPE      MASS
     1   100.182
     2   19.0548
     3   19.0556

 Range of element maximum matrix coefficients in global coordinates
 Maximum = 2.93408494E+10 at element 11441.
 Minimum = 518803319 at element 2355.

   *** ELEMENT MATRIX FORMULATION TIMES
     TYPE    NUMBER   ENAME      TOTAL CP  AVE CP

        1      8724  SOLID187      0.427   0.000049
        2      2759  SOLID187      0.135   0.000049
        3      2944  SOLID187      0.143   0.000048
        4       200  CONTA174      0.046   0.000232
        5       200  TARGE170      0.000   0.000002
        6       200  CONTA174      0.046   0.000228
        7       200  TARGE170      0.000   0.000002
        8      1694  SURF154       0.059   0.000035
 Time at end of element matrix formulation CP = 4.52296734.

 DISTRIBUTED SPARSE MATRIX DIRECT SOLVER.
  Number of equations =       76728,    Maximum wavefront =    465


  Memory allocated on only this MPI rank (rank     0)
  -------------------------------------------------------------------
  Equation solver memory allocated                     =   104.604 MB
  Equation solver memory required for in-core mode     =   100.392 MB
  Equation solver memory required for out-of-core mode =    45.715 MB
  Total (solver and non-solver) memory allocated       =   833.557 MB


  Total memory summed across all MPI ranks on this machines
  -------------------------------------------------------------------
  Equation solver memory allocated                     =   419.477 MB
  Equation solver memory required for in-core mode     =   402.170 MB
  Equation solver memory required for out-of-core mode =   173.545 MB
  Total (solver and non-solver) memory allocated       =  2211.547 MB

 *** NOTE ***                            CP =       4.721   TIME= 08:23:42
 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=  19193  totEqn=  19193 Job CP sec=      4.886
      Factor Done= 100% Factor Wall sec=      0.279 rate=      19.3 GFlops
 Distributed sparse solver maximum pivot= 2.775534833E+10 at node 3047
 UX.
 Distributed sparse solver minimum pivot= 243125111 at node 20937 UY.
 Distributed sparse solver minimum pivot in absolute value= 243125111 at
 node 20937 UY.

   *** ELEMENT RESULT CALCULATION TIMES
     TYPE    NUMBER   ENAME      TOTAL CP  AVE CP

        1      8724  SOLID187      0.374   0.000043
        2      2759  SOLID187      0.120   0.000044
        3      2944  SOLID187      0.123   0.000042
        4       200  CONTA174      0.004   0.000019
        6       200  CONTA174      0.004   0.000019
        8      1694  SURF154       0.046   0.000027

   *** NODAL LOAD CALCULATION TIMES
     TYPE    NUMBER   ENAME      TOTAL CP  AVE CP

        1      8724  SOLID187      0.130   0.000015
        2      2759  SOLID187      0.041   0.000015
        3      2944  SOLID187      0.043   0.000014
        4       200  CONTA174      0.001   0.000003
        6       200  CONTA174      0.001   0.000003
        8      1694  SURF154       0.006   0.000003
 *** 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
        4.875 MB WRITTEN ON ELEMENT SAVED DATA FILE: file0.esav
       12.562 MB WRITTEN ON ASSEMBLED MATRIX FILE: file0.full
        2.938 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.39500000

 PRINTOUT RESUMED BY /GOP

 FINISH SOLUTION PROCESSING


 ***** ROUTINE COMPLETED *****  CP =         5.841



 *** MAPDL - ENGINEERING ANALYSIS SYSTEM  RELEASE 2024 R2          24.2     ***
 Ansys Mechanical Enterprise
 00000000  VERSION=LINUX x64     08:23:43  NOV 19, 2024 CP=      5.847

 --Static Structural



          ***** MAPDL RESULTS INTERPRETATION (POST1) *****

 *** NOTE ***                            CP =       5.848   TIME= 08:23:43
 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 =         5.850



 PRINTOUT RESUMED BY /GOP

 *GET  _WALLDONE  FROM  ACTI  ITEM=TIME WALL  VALUE=  8.39527778

 PARAMETER _PREPTIME =     0.000000000

 PARAMETER _SOLVTIME =     2.000000000

 PARAMETER _POSTTIME =     1.000000000

 PARAMETER _TOTALTIM =     3.000000000

 *GET  _DLBRATIO  FROM  ACTI  ITEM=SOLU DLBR  VALUE=  1.02028986

 *GET  _COMBTIME  FROM  ACTI  ITEM=SOLU COMB  VALUE= 0.414658111E-01

 *GET  _SSMODE   FROM  ACTI  ITEM=SOLU SSMM  VALUE=  2.00000000

 *GET  _NDOFS    FROM  ACTI  ITEM=SOLU NDOF  VALUE=  76728.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 = 26882
 --- Total number of elements = 16921
 --- Element load balance ratio = 1.02028986
 --- Time to combine distributed files = 4.146581107E-02
 --- Sparse memory mode = 2
 --- Number of DOF = 76728

 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 R2            Build: 24.2       Update: UP20240603   Platform: LINUX x64
Date Run: 11/19/2024   Time: 08:23     Process ID: 18956
Operating System: Ubuntu 20.04.6 LTS

Processor Model: AMD EPYC 7763 64-Core Processor

Compiler: Intel(R) Fortran Compiler Classic Version 2021.9  (Build: 20230302)
          Intel(R) C/C++ Compiler Classic Version 2021.9  (Build: 20230302)
          AOCL-BLAS 4.2.1 Build 20240303

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.11 for Linux* OS


GPU Acceleration: Not Requested

Job Name: file0
Input File: dummy.dat

  Core                Machine Name   Working Directory
 -----------------------------------------------------
     0                618e491afe3b   /github/home/.mw/Application Data/Ansys/v242/AnsysMechACD6/Project_Mech_Files/StaticStructural
     1                618e491afe3b   /github/home/.mw/Application Data/Ansys/v242/AnsysMechACD6/Project_Mech_Files/StaticStructural
     2                618e491afe3b   /github/home/.mw/Application Data/Ansys/v242/AnsysMechACD6/Project_Mech_Files/StaticStructural
     3                618e491afe3b   /github/home/.mw/Application Data/Ansys/v242/AnsysMechACD6/Project_Mech_Files/StaticStructural

Latency time from master to core     1 =    2.245 microseconds
Latency time from master to core     2 =    2.249 microseconds
Latency time from master to core     3 =    1.972 microseconds

Communication speed from master to core     1 =  9731.26 MB/sec
Communication speed from master to core     2 = 13347.19 MB/sec
Communication speed from master to core     3 = 15151.52 MB/sec

Total CPU time for main thread                    :        2.7 seconds
Total CPU time summed for all threads             :        6.1 seconds

Elapsed time spent obtaining a license            :        0.4 seconds
Elapsed time spent pre-processing model (/PREP7)  :        0.1 seconds
Elapsed time spent solution - preprocessing       :        0.7 seconds
Elapsed time spent computing solution             :        1.3 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                :       80.5 Gflops
Equation solver effective I/O rate                :       29.6 GB/sec

Sum of disk space used on all processes           :       78.2 MB

Sum of memory used on all processes               :      683.0 MB
Sum of memory allocated on all processes          :     3246.0 MB
Physical memory available                         :         31 GB
Total amount of I/O written to disk               :        0.1 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 R2         Build 24.2         UP20240603    LINUX x64     |
 |                                                                             |
 |-----------------------------------------------------------------------------|
 |                                                                             |
 |  Database Requested(-db)     1024 MB     Scratch Memory Requested   1024 MB |
 |  Max Database Used(Master)     23 MB     Max Scratch Used(Master)    177 MB |
 |  Max Database Used(Workers)     1 MB     Max Scratch Used(Workers)   164 MB |
 |  Sum Database Used(All)        26 MB     Sum Scratch Used(All)       657 MB |
 |                                                                             |
 |-----------------------------------------------------------------------------|
 |                                                                             |
 |        CP Time      (sec) =          6.114       Time  =  08:23:43          |
 |        Elapsed Time (sec) =          5.000       Date  =  11/19/2024        |
 |                                                                             |
 *-----------------------------------------------------------------------------*

Project tree#

app.print_tree()
├── Project
|  ├── Model
|  |  ├── Geometry Imports
|  |  |  ├── Geometry Import
|  |  ├── Geometry
|  |  |  ├── Connector
|  |  |  |  ├── Connector\Solid1
|  |  |  ├── Right_elbow
|  |  |  |  ├── Right_elbow\Solid1
|  |  |  ├── Left_elbow
|  |  |  |  ├── Left_elbow\Solid1
|  |  ├── Materials
|  |  |  ├── Structural Steel
|  |  |  ├── Structural Steel Assignment
|  |  ├── Coordinate Systems
|  |  |  ├── Global Coordinate System
|  |  ├── Remote Points
|  |  ├── Connections
|  |  |  ├── Contacts
|  |  |  |  ├── Contact Region
|  |  |  |  ├── Contact Region 2
|  |  ├── Mesh
|  |  ├── Named Selections
|  |  |  ├── NSFixedSupportFaces
|  |  |  ├── NSFrictionlessSupportFaces
|  |  |  ├── NSInsideFaces
|  |  ├── Static Structural
|  |  |  ├── Analysis Settings
|  |  |  ├── Fixed Support
|  |  |  ├── Frictionless Support
|  |  |  ├── Pressure
|  |  |  ├── Solution
|  |  |  |  ├── Solution Information
|  |  |  |  ├── Total Deformation
|  |  |  |  ├── Equivalent Stress

Cleanup#

Save project

app.save(os.path.join(cwd, "Valve.mechdat"))
app.new()

delete example files

delete_downloads()
True

Total running time of the script: (0 minutes 29.139 seconds)

Gallery generated by Sphinx-Gallery