Ansys Free Student Software

Ansys Free Student Software

Running Ansys from Matlab

    • PJURICA
      Subscriber

      I have installed the student trial version of Ansys. During the calculation in Matlab from which I run Ansys, there is an error (Figure).

    • Mangesh Bhide
      Ansys Employee
      Hello
      does Ansys work outside of Matlab without issues ? if yes, then no installation issues. If Ansys does not work standalone, then we need to get that working first.
      do not open any out files in other programs while the solve is in progress. please check if an Antivirus program or a text editor etc might have a file lock on the .out file.
      Can you please try saving to a path without spaces such as "C:\temp\my_test"

    • PJURICA
      Subscriber
      Ansys work outside of Matlab without issues and when running the calculation in Matlab it can be seen that Ansys is opened. Nevertheless, the error mentioned in the previous question appears.
      Thank You for the recommendation of trying to save to a path without spaces, I will try with this.
    • PJURICA
      Subscriber
      I have changed the path without space, but the same problems occur. Is there any other way to try to solve this problem?
    • Mangesh Bhide
      Ansys Employee
      what is the entire command line called from Matlab ?
    • transformer
      Subscriber
      the same question
    • PJURICA
      Subscriber
      dos('"C:\Program Files\ANSYS Inc\ANSYS Student\v212\ansys\bin\winx64\ansys212" -b -dis -np 4 -dir "C:\Users\Jurica\Desktop\Suzana_Ereiz\003_MU\001_Exeter\SOA" -i "C:\Users\Jurica\Desktop\Suzana_Ereiz\003_MU\001_Exeter\SOA\intelligent_mu.txt" -o "intelligent.out"');
      This is the entire command line called from Matlab
    • Mangesh Bhide
      Ansys Employee
      remove any *.lock files in SOA folder
      try including full path for the out file

      dos('"C:\Program Files\ANSYS Inc\ANSYS Student\v212\ansys\bin\winx64\ansys212" -b -dis -np 4 -dir "C:\Users\Jurica\Desktop\Suzana_Ereiz\003_MU\001_Exeter\SOA" -i "C:\Users\Jurica\Desktop\Suzana_Ereiz\003_MU\001_Exeter\SOA\intelligent_mu.txt" -o "C:\Users\Jurica\Desktop\Suzana_Ereiz\003_MU\001_Exeter\SOA\intelligent.out"');


    • PJURICA
      Subscriber
      There is no any *lock file in the folder, while when trying to include full path for the out file there is a new Intel(r) Visual Fortran run-time error
    • Mangesh Bhide
      Ansys Employee
      what is the default directory in Matlab? try changing it to same folder as the working directory and then run Ansys. Hope this helps
    • PJURICA
      Subscriber
      I tried to change the folder by putting all the working directories in the Matlab file, but after the running calculation the Matlab output me the same error, first forrtl:severe (28) and after that the forrtl:severe (47).
    • Mangesh Bhide
      Ansys Employee
      Please checkout this video
      " target="blank">




      Also, There are 3 different things
      1) the current directory where an application is started from
      2) the working directory as provided to the Mechanical Solver and
      3) the path provided to


      A)
      When you open a Command Prompt by clicking on Windows Start button and typing "cmd.exe" and then pressing the enter button, it usually open in C:\Users\%username%
      When you run something from Matlab, then in which directory does Matlab run it in ? Please check
      example: the working directory and input file in example below is in c:\temp\test1, however the current directory is C:\Program Files where the user running Ansys does not have permission to write files to. Notice the -o has no path, causing Mechanical to write to Program Files and it gets an error

      C:\Program Files>"C:\Program Files\ANSYS Inc\v211\ansys\bin\winx64\ansys211.exe" -b -dis -np 4 -dir "C:\temp\test1" -i "C:\temp\test1\input.dat" -o "no_path_file.out"
      forrtl: The handle is invalid.
      the severe(28)
      B)
      Example 2: Even though a working directory is specified on the same command line, the full path to where to write the output file is not specified. Now Mechanical Solver is trying to write to the specified directory, however IntelMPI still runs into MPI error
      C:\Program Files>"C:\Program Files\ANSYS Inc\v211\ansys\bin\winx64\ansys211.exe" -b -dis -np 4 -dir "C:\temp\test1" -i "C:\temp\test1\input.dat" -o "C:\temp\test1\no_path_file.out"
      [mpiexec@node01031] ..\hydra\utils\sock\sock.c (420): write error (Unknown error)
      send of 26 bytes failed.
      [mpiexec@node01031] ..\hydra\utils\launch\launch.c (121): shutdown failed, sock 632, error 10093

      C) In this example the same command line is used, however critical step is to first change directory to something other than C:\Program Files, (ideally to the working directory, so this example shows changing directory to the working directory where input files are
      C:\Program Files>cd \temp\test1
      C:\temp\test1>"C:\Program Files\ANSYS Inc\v211\ansys\bin\winx64\ansys211.exe" -b -dis -np 4 -dir "C:\temp\test1" -i "C:\temp\test1\input.dat" -o "C:\temp\test1\no_path_file.out

      d) You can test these command lines with a simple test job, I suspect you might run into similar errors. (example command line uses version 2021 R1, you will need to make changes to use other versions)
      Now if you can figure out how to "tell" Matlab to run Mechanical Solver in the working directory, then I believe it will resolve the issue.



  • PJURICA
    Subscriber
    Following the instructions, You gave me I have not solved the problem. The only thing I have not done yet is run the simpler model and install another version of the software. The numerical model I have is certainly correct because the other users both the code and the model run without any problems.
    I tried to run the calculation without the parallel pool on and when I do that the error related to Intel(r)visual Fortran run time error does not appear. Does this help You to find the exact source of the problem and find a solution for it because I need a parallel poo? In addition, is there a possibility to connect to the version of the operating system installed on the computer?
  • Mangesh Bhide
    Ansys Employee
    Are you running on Windows 10 or Windows 11 ?
    What was the exact new error after you changed the output file name to full path to the .out file ?
    Yes, it would help to run a simple test model to confirm if Ansys can solve on your computer outside of Matlab. If a certain command line works from Command Prompt, then it should also run from inside Matlab with the same command line.
    I did not follow " without the parallel pool" did you mean you ran using only 1 core and it worked but if you use 2 cores it does not work?
    If you add -smp flag does it that work?
    Can you install Microsoft MPI see https://ansyshelp.ansys.com/account/secured?returnurl=/Views/Secured/corp/v211/en/installation/INSTALL_MS-MPI_README.html
    to run using microsoft MPI see exsample to run with msmpi here https://ansyshelp.ansys.com/account/secured?returnurl=/Views/Secured/corp/v211/en/ans_dan/dan_startlaunch.html%23dan_startCL (example runs with -dis, you can try without that and with -smp )

  • PJURICA
    Subscriber
    I have Windows 10 installed on all three PCs on which I tried to perform the calculation.
    After changing the output file name to the full path to the file.out I got the same Fortran error with a different number (figure attached).

    On the other side, the calculation of the numerical model which I have tried to run using Matlab to perform the optimization works great in the Ansys (outside Matlab). Ansys fluently performed the calculation of the simplest model outside the Matlab, while on the inside on it, the same errors occur.
    Also, I installed MPI for parallel processing before the starting process of my calculation but based on the error message Matlab gives me in the command window, I think it is not working well.
    Do You have any other ideas or suggestions on how I can fix this problem?

  • Mangesh Bhide
    Ansys Employee
    Hello As mentioned earlier, the current directory from where Ansys is started matters. If that folder is read only, then you will see the error. Please investigate how you can change current directory from Matlab before calling Ansys Solver. Hope this helps
  • PJURICA
    Subscriber
    Dear, I have tried again to repeat all the steps and instructions that you have given me to solve the problems that occur in the calculation that I have to perform. The technical support staff has given me permission to all the files so that I can write in them. But I could not successfully solve the problems that occur. After starting the calculation, the following errors occur. First the Fortran error number 28 and then the Fortran error 47.
    We also checked the installation of Intel MPI and it looks ok. The only thing we can not find is the folder where MPI sends the error to.

  • Mangesh Bhide
    Ansys Employee
    Can you please check with Matlab experts on finding out which is the default folder used on your computer where Matlab runs Ansys ?
    It appears that it may be starting in a folder where you may not have permission to write to. My recommendation is to try configuring Matlab so it uses a path like C:\temp\Matlab_Ansys\ or similar to start and run applications called from outside of Matlab. Also please save your files to the same folder for a test. I hope this helps
  • Viewing 17 reply threads
    • You must be logged in to reply to this topic.