General Mechanical

General Mechanical

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

UPF linking and invoke subroutine

    • sorena shahbazi
      Subscriber

      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
      *ans_use_upf
      *ans_user_path
      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
        Subscriber

        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
        *ans_use_upf
        *ans_user_path

        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.

           

        • sorena shahbazi
          Subscriber

          Thank you for the explanation dear David
          Those were good points, I will try to find and install the relevant versions exactly according to the approved versions, and I hope that the problem will be solved, and if the problem is solved, I will inform.
          Sure, thank you for your time, if I have more questions, I will definitely ask.
          with the best wishes

        • sorena shahbazi
          Subscriber

           

           

          Hello David
          Fortunately, the problem was solved and I wanted to give feedback about this incident
          First of all, thank you for your attention and guidance
          After trying different things, it finally occurred to me to remove the ans_user_path” in the system environment, and to my surprise, the problem was solved and the subroutine was read and run correctly! Of course, I don’t know exactly why! It seems that with this definition, there is a confusion between the directory folder.
          I should mention that I use the ACT UPF extension v4… of course, the problem I have is that when I use command (/upf, subroutine_name.F) instead of the extension, I get an error and the problem does not run at all. I still haven’t figured out the root of this error, why it doesn’t run when I use command instead of the extension, even if *ans_user_path is defined in the system environment. It may be related to the correct address of the directory folder.


          In this regard, I want to ask another question that when we install Ansys workbench, where exactly is the address of the directory folder by default that we put the subroutine in it and can run the problem without using the extension ond only use the command ? I tried different folders and unfortunately I didn’t get any results and they all gave errors (with Solver Module content).

          Thanks so much

          +In the meantime, I would like to mention that Ansys 19.0 was linked with Visual Studio 2015 Update 3 and Fortran 2017 Update 5, similar to 19.1 and 19.2, but different from what is announced on the official website for this version.

           

           

    • sorena shahbazi
      Subscriber

      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 1 reply thread
  • The topic ‘UPF linking and invoke subroutine’ is closed to new replies.