.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/gallery_examples/embedding_n_remote/embedding_remote.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_gallery_examples_embedding_n_remote_embedding_remote.py: .. _ref_embedding_remote: Remote & Embedding Example -------------------------- This code, which uses the same example, first demonstrates how to use a remote session and then demonstrates how to use an embedding instance. .. GENERATED FROM PYTHON SOURCE LINES 33-36 -------------- Remote Session -------------- .. GENERATED FROM PYTHON SOURCE LINES 39-43 Download required files ~~~~~~~~~~~~~~~~~~~~~~~ Download the required files. Print the file paths for the geometry file and script file. .. GENERATED FROM PYTHON SOURCE LINES 43-56 .. code-block:: Python import os from ansys.mechanical.core import launch_mechanical from ansys.mechanical.core.examples import download_file geometry_path = download_file("Valve.pmdb", "pymechanical", "embedding") print(f"Downloaded the geometry file to: {geometry_path}") script_file_path = download_file("remote_script.py", "pymechanical", "embedding") print(f"Downloaded the script file to: {script_file_path}") .. rst-class:: sphx-glr-script-out .. code-block:: none Downloaded the geometry file to: /github/home/.local/share/ansys_mechanical_core/examples/Valve.pmdb Downloaded the script file to: /github/home/.local/share/ansys_mechanical_core/examples/remote_script.py .. GENERATED FROM PYTHON SOURCE LINES 57-62 Launch Mechanical ~~~~~~~~~~~~~~~~~ Launch a new Mechanical session in batch, setting ``cleanup_on_exit`` to ``False``. To close this Mechanical session when finished, this example must call the ``mechanical.exit()`` method. .. GENERATED FROM PYTHON SOURCE LINES 63-73 .. code-block:: Python import os from ansys.mechanical.core import launch_mechanical # Launch mechanical mechanical = launch_mechanical(batch=True, loglevel="DEBUG") print(mechanical) .. rst-class:: sphx-glr-script-out .. code-block:: none Ansys Mechanical [Ansys Mechanical Enterprise] Product Version:241 Software build date: 11/27/2023 10:24:20 .. GENERATED FROM PYTHON SOURCE LINES 74-78 Initialize variable for workflow ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Set the ``part_file_path`` variable on the server for later use. Make this variable compatible for Windows, Linux, and Docker containers. .. GENERATED FROM PYTHON SOURCE LINES 78-96 .. code-block:: Python project_directory = mechanical.project_directory print(f"project directory = {project_directory}") # Upload the file to the project directory. mechanical.upload(file_name=geometry_path, file_location_destination=project_directory) # Build the path relative to project directory. base_name = os.path.basename(geometry_path) combined_path = os.path.join(project_directory, base_name) part_file_path = combined_path.replace("\\", "\\\\") mechanical.run_python_script(f"part_file_path='{part_file_path}'") # Verify the path result = mechanical.run_python_script("part_file_path") print(f"part_file_path on server: {result}") .. rst-class:: sphx-glr-script-out .. code-block:: none project directory = /tmp/ANSYS.root.1/AnsysMechE6EA/Project_Mech_Files/ Uploading Valve.pmdb to 127.0.0.1:10000:/tmp/ANSYS.root.1/AnsysMechE6EA/Project_Mech_Files/.: 0%| | 0.00/774k [00:00> Ansys Product Improvement Program | | in the GUI. | | For more information about the Ansys Privacy Policy, please | | check: http://www.ansys.com/privacy | | | *------------------------------------------------------------------* 2024 R1 Point Releases and Patches installed: Ansys, Inc. License Manager 2024 R1 Structures 2024 R1 LS-DYNA 2024 R1 Mechanical Products 2024 R1 ***** 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 = /tmp/ANSYS.root.1/AnsysMechE6EA/Project_Mech_Files/StaticStructural/dummy.dat OUTPUT FILE NAME = /tmp/ANSYS.root.1/AnsysMechE6EA/Project_Mech_Files/StaticStructural/solve.out START-UP FILE MODE = NOREAD STOP FILE MODE = NOREAD RELEASE= 2024 R1 BUILD= 24.1 UP20231106 VERSION=LINUX x64 CURRENT JOBNAME=file0 17:56:33 APR 23, 2024 CP= 0.232 *** FATAL *** CP = 0.243 TIME= 17:56:33 The requested number of distributed-memory processes (4) exceeds the number of physical processors that are available (2) on machine: 0b64c480586d. The use of virtual processors is not recommended. It is required that you use a maximum of 2 distributed-memory processes on this machine. ************************************************************************ The above error is non-recoverable by ANSYS ANSYS run terminated by the indicated error Current data base saved if possible. ************************************************************************ +--------------------- M A P D L S T A T I S T I C S ------------------------+ Release: 2024 R1 Build: 24.1 Update: UP20231106 Platform: LINUX x64 Date Run: 04/23/2024 Time: 17:56 Process ID: 14923 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) Intel(R) Math Kernel Library Version 2020.0.0 Product Build 20191122 BLAS Library supplied by AMD BLIS 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 Linux* OS GPU Acceleration: Not Requested Job Name: file0 Input File: dummy.dat Core Machine Name Working Directory ----------------------------------------------------- 0 0b64c480586d /tmp/ANSYS.root.1/AnsysMechE6EA/Project_Mech_Files/StaticStructural 1 0b64c480586d /tmp/ANSYS.root.1/AnsysMechE6EA/Project_Mech_Files/StaticStructural 2 0b64c480586d /tmp/ANSYS.root.1/AnsysMechE6EA/Project_Mech_Files/StaticStructural 3 0b64c480586d /tmp/ANSYS.root.1/AnsysMechE6EA/Project_Mech_Files/StaticStructural Total CPU time for main thread : 0.6 seconds Total CPU time summed for all threads : 0.3 seconds Elapsed time spent obtaining a license : 0.3 seconds Elapsed time spent pre-processing model (/PREP7) : 0.0 seconds Elapsed time spent solution - preprocessing : 0.0 seconds Elapsed time spent computing solution : 0.0 seconds Elapsed time spent solution - postprocessing : 0.0 seconds Elapsed time spent post-processing model (/POST1) : 0.0 seconds +------------------ 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 LINUX x64 | | | |-----------------------------------------------------------------------------| | | | Database Requested(-db) 1024 MB Scratch Memory Requested 1024 MB | | Maximum Database Used 1 MB Maximum Scratch Memory Used 1 MB | | | |-----------------------------------------------------------------------------| | | | CP Time (sec) = 0.253 Time = 17:56:33 | | Elapsed Time (sec) = 1.000 Date = 04/23/2024 | | | *-----------------------------------------------------------------------------* ERROR: Worker process(es) with rank(s) solve have encountered a FATAL error. The information below was gathered from the file*.out output file(s). Please review the worker process output file(s) listed below for more details on this error. FATAL error message: solve.out The requested number of distributed-memory processes (4) exceeds the number of physical processors that are available (2) on machine: 0b64c480586d. The use of virtual processors is not recommended. It is required that you use a maximum of 2 distributed-memory processes on this machine. Downloading 127.0.0.1:10000:/tmp/ANSYS.root.1/AnsysMechE6EA/Project_Mech_Files/file_Mech_Files/StaticStructural/CAERepOutput.xml to /__w/pymechanical/pymechanical/examples/embedding_n_remote/download/CAERepOutput.xml: 0%| | 0.00/789 [00:00` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: embedding_remote.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_