General Mechanical

General Mechanical

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

Is there a way to run ANSYS in headless mode?

    • crumberg
      Subscriber

      New Workbench user here. (For context, I have a solid background with MATLAB and Python and a little experience with APDL.) Currently, I have a Workbench project with Fluent and Structural components on a local machine. The license and computing resources required to solve my model are located on a separate machine that is accessed using a Linux command terminal.

      1) Is there any way to export my Workbench project as a batch file that I can solve on a separate machine? I need to a) export the batch file, b) find the command line entry to solve the batch file, and c) locate the solution file after solving.

      2) Is there a way to edit my model in headless mode, i.e. using only a script editor? I especially want to be able to edit geometries, element types, and contact types. I have so far been able to find the Python script editor inside Mechanical, but I cannot find much documentation. If I could just work with APDL script without having to open Workbench, I think this would help a great deal.

      Thanks for any directions or resources you can point me to!

    • peteroznewman
      Subscriber
      There is the easy way and the hard way to solve a structural model on a Linux High Performance Compute (HPC) server. The hard way is what you are asking how to do. I almost never do it the hard way, so someone who does might reply and give you better information than I have, but this will at least get you started.
      1) a) In Mechanical, click on the Static Structural branch. The Ribbon has an Environment tab. On that ribbon is the button: Write Input File. That is the button to export a file called file.dat that you would move over to the Linux computer.
      1) b) You would then issue a batch command to start the solver. The command includes the input filename file.dat.
      On a Windows computer, it is something like what is shown below, but of course on the Linux computer it will be different. I put the following line into a file called run.bat in D:\scratch where I put file.dat from part a). In this example, I requested distributed solving over 6 processors.
      "C:\Program Files\ANSYS Inc\v211\ansys\bin\winx64\ansys211.exe" -i file.dat -o solve.out -b -dis -np 6
      1) c) The results are in file.rst which is very large. There is also a file called file.db that is the database. The text output on the progress of the solution is written to solve.out which you would check first. Move the .rst and .db files back to your local computer. You didn't ask the part d) question, how to read that file into Mechanical. I don't know the answer to part d) but someone who does might reply.
      You can practice the above on your local computer and get that working first, then figure out how to do the same on the Linux computer.
      The easy way requires that the Linux compute server has Remote Solve Manager installed and your local Windows computer is configured to use Remote Solve Manager. For example, in the image below, the remote compute server is called HPCS04. When I click on the Solve branch of the model, instead of solving on My Computer, I can automatically send the input file to the HPC computer. After the solution is complete, the results are automatically send back to my local computer. It's almost no different than solving locally on My Computer.
      I recommend you request that Ansys Remote Solve Manager (RSM) be installed on the Linux computer and you configure your local computer to submit jobs to that.
    • peteroznewman
      Subscriber
      Here is the answer to the part d) question you didn't ask, how to import the results file into Mechanical.
      /forum/discussion/32647/how-do-i-import-results-solved-via-hpc-back-into-ansys-wb-static-structural-to-view-them

    • crumberg
      Subscriber
      Thank you so much! I'm sure I will come across more challenges as I work through this, but this is really helping me get started with the process.
    • KartiSinghFreeman
      Subscriber
      Hey Peter, before saving the .dat file with Write Input File do you need to generate the mesh before saving or is that done with the solver when the script is run?
    • peteroznewman
      Subscriber
      I rarely use the Write Input File button, I sometimes use the Write Nastran File. Anytime I do, I have already generated the mesh. I expect if you haven't generated the mesh, Mechanical would automatically do that prior to writing out the .dat file in the same way it generates the mesh when you hit the Solve button.
    • KartiSinghFreeman
      Subscriber
      I have been pretty occupied and have just got around to writing the dat file without the mesh, and yes it generates the mesh before it writes the dat file as you mentioned. It's not a big deal for me but I have more complicated meshes that I would like to do via headless mode on a HPC.
      Would you happen to have any tips?
Viewing 6 reply threads
  • The topic ‘Is there a way to run ANSYS in headless mode?’ is closed to new replies.