General Mechanical

General Mechanical

Topics relate to Mechanical Enterprise, Motion, Additive Print and more

UPF linking and invoke subroutine

    • sorena shahbazi

      Hello friends
      This is the first time I want to link and work with UPF and I have encountered a problem. I use Ansys 19.0 and I linked Visual Studio 14 (2015) and Fortran 17 with it, and apparently the link has been established. Because when I click on Chek UPF Setup, everything is ok, and also after solving, subroutine reading messages are given in the Solution Information section.
      But I have a problem when solving the problem
      I wrote a very simple tbelastic subroutine, I defined only two properties of Young's modulus and Poisson's ratio with a constant value and gave it to mechanical workbench. command is also written correctly:

      *tbdele, all
      *tb, elastic, 1,, 2, user

        But when I solve the simple problem, it is clear from the results that it was not read from my code... the strange thing is that by changing the properties of the material in the code and engineering data, the results do not change. Apparently, the software reads the mechanical properties from another place and probably from another code that I don't know where!!!

      Does anyone know where the problem comes from? And sometimes, even though I have given him the subroutine in another folder, why and where does he read subroutine?

      note1: When I change the value of 1 to two or more in the command, the software reads the properties from the engineering data!
      *tb, elastic, 2,, 2, user

      note2: This is how I did the linking process
      Step 1- Visual installation
      Step 2- Installing Fortran
      Step 3- Install Ansys
      Step 4- New definition in environment variables
      Step 5- Download and install ACT UPF4

      note3: This problem also exists for me in version 18.2

    • David Weed
      Ansys Employee

      Hello Sorena,

      The supported MS VS and Intel Fortran versions for R19.0 are the following:

      Visual Studio 2012 (including the MS C++ compiler) and Intel FORTRAN 15.0.7 compiler

      It appears that you are using different versions which are not supported. In this case, unfortunately we cannot troubleshoot issues that may be a result of using these unsupported software versions. I would suggest to install the supported versions, recompile/link and see if that resolves the issue.

      • sorena shahbazi

        Hello David,

        Thank you for your response,

        The reason for using these versions of Fortran and Visual Studio is that when I install the recommended versions (Fortran 2015 and Visual Studio 2012), in the mechanical environment when i click on Check UPF Setup, I encounter an error and it says that Visual Studio14 and appropriate Fortran must be installed, (similar to versions 19.1 and 19.2), and when I installed them, it seems to be OK.
        But apart from this, I saw exactly the same problem (reading code) in other versions such as 18.2 and even 2023 (with suggested versions).
        Of course, I must mention that Visual Studio and Fortran installed in the same year are the same, but in terms of updates, they may be slightly different. Is this important? For example, due to the fact that the Fortran 15.0.7 version was not available, another update of 2015 was used, and similar to this article for other versions (my opinion was that it is not very effective).

        Can I tell you the linking process that I go through so that you can see if this process is complete or if something else needs to be done?
        1- Visual installation
        2- Installing Fortran
        3- Installing Ansys
        (Question: These three steps were sometimes carried out interchangeably. Does this cause problems?)

        4- New definition in environment variables

        5- Download and install ACT UPF4

        After that, I use the following command in the geometry section for subroutine "USER_TBELASTIC" :

        *tbdele, all
        *tb, elastic, 1, , 2, user


        • David Weed
          Ansys Employee


          We require that the user have the MS VS and IFORT versions documented in the installation guide due to the fact that the MAPDL code itself is also compiled/linked with those versions. I have seen mixed results in terms of users being able to successfully compile/link with different versions than those listed in the documentation, so we generally don’t suggest doing that. The Intel site has changed a bit and I know that it can be difficult finding specific older versions, so you may want to consider reaching out to Intel support to see if they can help locate them.

          Regarding the procedural steps that you listed, you will need to install MS VS first so that the Intel Fortran software suite can detect and integrate with it correctly. Doing it the other way around will prevent this integration and any subsequent compiling/linking procecedure will fail.

          When you install ANSYS software, make sure to check the box to install the customization features. If this is installed correctly, then you should have a path like the following:

          C:\Program Files\ANSYS Inc\v190\ansys\custom\user\winx64

          There is also a ‘customize’ folder, but you want to make sure that the ‘custom’ folder is there as well because this is where the batch files for invoking the compiler and MS VS for compiling/linking are stored.

          If you are using the /UPF method (this is used by the ACT app), then you’ll only want to define ANS_USE_UPF = TRUE. You can delete ANS_USER_PATH for now. Also, make sure that all WB sessions are closed when defining that variable so that when WB is re-opened, the variable will be properly recognized by WB.

          You technically don’t need the ACT app to use a UPF inside of WB Mechanical, though the GUI does provide some convience. Instead, you can just use the /UPF command in a command object under the Analysis/Static Structural branch within Mechanical. The user routine should also reside in the Solver Files Directory (you can access this by right-clicking on Solution and choosing “Open Solver Files Directory”). Also, make sure the issue OUTRES,ALL,ALL and OUTRES,SVAR,ALL, so that you can plot state variables.

          Let me know if you have any additional questions.


    • Raida Maisa

      Thanks for sharing this informative forum with us and allowing us to read it. One of my friends from Dissertation Help Dubai is interested in UPF linking and invoking a subroutine. He is very intelligent. I have no idea about that but he told me that It appears that you are using different versions which are not supported. In this case, unfortunately, we cannot troubleshoot issues that may be a result of using these unsupported software versions

      • sorena shahbazi

        Hello Raida

        Thank you for your attention and follow up on this matter
        It seems that in the first step, I have to install the exact same update of the Visual Studio and Fortran versions for a desired version of Ansys to be sure about this.
        I will try to find and install the appropriate updates for a desired version, and I will announce the result here again.
        Hope to solve this problem :)

Viewing 2 reply threads
  • You must be logged in to reply to this topic.