General Mechanical

General Mechanical

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

Using UPFs in Ansys Workbench installed on Linux

    • Manu Kamin
      Subscriber

      While there is a tutorial provided by Ansys -

      https://support.ansys.com/knowledgeresources/getsolutionfile?fn=ANSYS%20UserCreep_V17.1_Procedure%20using%20UPF%20command.pdf&fp=%2fsolutions%2fattach%2fANSYS%20UserCreep_V17.1_Procedure%20using%20UPF%20command.pdf 

      which shows how to use a user defined creep strain model by linking a custom Fortran subroutine with Ansys, the procedure assumes two things :

      1. Ansys is installed on Windows
      2. Ansys version is 19 

      The challenge I am facing is that the procedure explained works only for Windows installation. There is no equivalent alternative for Linux installation that I could find. In addition, it appears that installation of UPF plugin from Ansys appstore is only supported upto Ansys 19. I am using Ansys version 2023 R1.

      I would therefore like to know the detailed procedure to understand how to use custom subroutines by importing it within Ansys Workbench. I must add that I was able to compile the subroutine, and link it to the shared library successfully. But I do not know how to invoke it within Workbench as a next step.

    • David Weed
      Ansys Employee

      Hello,

      There are some subtle differences between invoking a UPF in Linux vs. Windows that I'll explain here. But firstly, one similarity is that the ACT R19 extension is not needed for either OS; it is entirely possible to invoke a UPF using APDL commands instead.

      One difference between Windows and Linux is that, in Linux, if you are using the /UPF method, you do need to set the environment variable ANS_USE_UPF like you do in Windows. If using the shared library method in Linux, you will need to point to the shared library file (*.so) using the environment variable ANS_USER_PATH (see section 1.9. Compiling and Linking UPFs on Linux Systems of the MAPDL Programmer's Reference for more details on this; this also shows the other environment variables for compilers which need to be set).

      In terms of compilers supported for 2023 R1, please see the Linux Installation Guide 2.4. Compiler Requirements for Linux Systems. The
      following items are supported:

      Intel 2019.3 Parallel Studio XE (FORTRAN, C, C++)

      GCC 8.2.0 (for user-programmable features)

      Please see the note on where to get GCC 8.2.0 from; you will need to download this from the ANSYS customer portal.

      Once you have the compilers installed and environment variables set properly, you can follow the procedure detailed in the Knowledge Resource you initially linked to (but skip the step for setting the ANS_USE_UPF variable if using the /UPF method). It is recommended to put a write/print statement in your Fortran code so that when the the simulation is run, output will be print to the screen indicating wether the UPF is actually being invoked. If I recall, write(*,*) may not print to the screen in Linux and, in that case, you can try write(6,*) instead.

    • Manu Kamin
      Subscriber

      Hello David,

      Thanks for your response.

      I am following the steps below, but I do not think my custom subroutine is being invoked : 

      1. Installed Intel Parallel Studio and Ansys version of GNU

      2. Copied usercreep.F file to two locations : /opt/ansys_inc/v232/ansys/customize/user/ (the location where my .so file is placed) and /media/manu/Data1/results_TBC/2dvalidation_allstress_refload/tbc_workflow_files/dp0/SYS-1/MECH (the location belonging to my Ansys case files). 

      2. Exported all paths using the following commands :  

      export PATH=/media/manu/phd/Ansys/bin:$PATH

      export ANS_COMPILER_PATH=/opt/intel/oneapi/compiler/2024.1/bin

      export ANS_USER_PATH="/opt/ansys_inc/v232/ansys/customize/user"

      3. Compiled Ansys with my custom subroutine usercreep.F using the following command : /opt/ansys_inc/v232/ansys/customize/user/ANSUSERSHARED   I was able to successfully compile and link the shared library by typing "y" upon the prompt "y/n"

      4. Next, I open Ansys Workbench, then start Ansys Mechanical, and then invoked creep by following the same commands as in the tutorial : 

      tbdele,creep,matid
      tb,creep,matid,matid,1,100
      tbdata, 1,3
      tb,state,1,1,1

      Then,  create a new command in which I invoke the usercreep subroutine using the following command :

      /upf, usercreep.F


      Then, I run the simululation by clicking "solve" within the GUI, only to get an error immediately. I have attached screenshots of both my setup as well as error message.

      I am not sure if the procedure that I am following is correct. There was a print command within my usercreep.F subroutine which does not seem to have got executed. Am I missing something?

      If I am running ANsys on GUI, where does the print command get written to? The terminal from which I have opened Ansys using the command runwb2?

       

    • Manu Kamin
      Subscriber

      Also, here is the screenshot showing how I invoke the /upf via GUI

       

Viewing 3 reply threads
  • The topic ‘Using UPFs in Ansys Workbench installed on Linux’ is closed to new replies.