Ansys Assistant will be unavailable on the Learning Forum starting January 30. An upgraded version is coming soon. We apologize for any inconvenience and appreciate your patience. Stay tuned for updates.
Fluids

Fluids

Topics related to Fluent, CFX, Turbogrid and more.

Edit Input and Getting Results from a File for System Coupling from Command Line

    • Nyurons
      Subscriber

      I am working on a project that implements ANSYS with a calibration/optimization software. For this project to work, I need to run ANSYS from a batch file. I was able to run Workbench System Coupling from the command line by following the oscillating plate tutorial (Co-simulation with Workbench Setup and Command-Line Execution).

    • Karthik Remella
      Administrator
      Hello,nThe input file is generally the ds.dat or .inp file. You should be able to use a text editor to do this (not preferred). You should be using Ansys Mechanical or MADPL for this. On the Fluent side, .cas is the case file that stores all the case settings. You can modify this only using Ansys Fluent.nfile.rst (Mechanical) or file.rth (Thermal) contains the results data. You cannot open these on a text editor. You will need to use Mechanical APDL or Ansys Mechanical for these. This is a file after solution so to make any changes you need to re-solve the analysis with different settings.nThanks.nKarthikn
    • Nyurons
      Subscriber

      Thank you Karthik. Is ANSYS capable of reading the result file.rst (such as maximum nodal displacement value) and exporting it as a file (e.g. .txt file) that is 'readable' from a text editor, all from the command line? nFrom what I have seen on the ANSYS forum and other websites, 'C:\Program files\ANSYS Inc\ANSYS Student\v194\ansys\bin\winx64\ansys194.exe' -b -i input.txt -o output.dat nor something similar on the command prompt should run ADPL and write results into a file. The link below is an example that writes results into a text file. However, I am not sure if I can implement something similar for system coupling.

      Hello,

      n

      I have problems outputting the results from ANSYS 18.2 when run from MATLAB R2018a in batch mode on a 64-bit Windows 7 machine. I am using the following procedure:

      n

      I have created an APDL file for ANSYS called geom_sol_out.txt which contains geometry commands, boundary conditions, loads, solve commands and output command to write results into a text file. I run it from MATLAB by running batch file run_ansys.bat which contains:

      n

      set ANS_CONSEC=YES
      set ANSYS_LOCK=OFF
      "C:\Program Files\ANSYS Inc\v182\ansys\bin\winx64\ANSYS182' -b -i ansysinputreader.txt -o out.dat

      n

      with ansysinputreader.txt containing /INPUT,'geom_sol_out','txt','H:\test\',, 0

      n

      This works nicely until the SOLVE command in geom_sol_out.txt is reached. After the solution is done, ANSYS simply ignores all the commands following the SOLVE command, so I cannot output the nodal results. I am using  /OUTPUT command to output the results into text file. (note:  /OUTPUT command works fine for e.g. nodal coordinates when it is called before the SOLVE command, but not when it it is called afterwards)

      Can anyone help me with this?

      n

      Thank you in advance.

      /forum/discussion/1749/cannot-output-results-from-ansys-18-2-when-run-from-matlab-in-batch-mode

    • Nyurons
      Subscriber

      Thank you Karthik.nIs ANSYS capable of reading the result .rst file and exporting some values (e.g. nodal displacement) as a file that is 'readable' from a text editor, all from the command line?nFrom what I have seen online, n'C:\Program Files\ANSYS Inc\ANSYS Student\v194\ansys\bin\winx64\ANSYS194.exe' -b -i input.txt -o output.datnor something similar can run APDL and write output files. The link below is an example that writes results in a text file. However, I am not sure if I can implement a similar command for system coupling to obtain results in a text file.

      Hello,

      n

      I have problems outputting the results from ANSYS 18.2 when run from MATLAB R2018a in batch mode on a 64-bit Windows 7 machine. I am using the following procedure:

      n

      I have created an APDL file for ANSYS called geom_sol_out.txt which contains geometry commands, boundary conditions, loads, solve commands and output command to write results into a text file. I run it from MATLAB by running batch file run_ansys.bat which contains:

      n

      set ANS_CONSEC=YES
      set ANSYS_LOCK=OFF
      'C:\Program Files\ANSYS Inc\v182\ansys\bin\winx64\ANSYS182' -b -i ansysinputreader.txt -o out.dat

      n

      with ansysinputreader.txt containing /INPUT,'geom_sol_out','txt','H:\test\',, 0

      n

      This works nicely until the SOLVE command in geom_sol_out.txt is reached. After the solution is done, ANSYS simply ignores all the commands following the SOLVE command, so I cannot output the nodal results. I am using  /OUTPUT command to output the results into text file. (note:  /OUTPUT command works fine for e.g. nodal coordinates when it is called before the SOLVE command, but not when it it is called afterwards)

      Can anyone help me with this?

      n

      Thank you in advance.

      /forum/discussion/1749/cannot-output-results-from-ansys-18-2-when-run-from-matlab-in-batch-mode

    • Steve
      Ansys Employee
      Hi Array ,nInteresting project. I also recommend using optiSLang which is designed to run optimization cases like this.n1) edit the input file (i.e. change parameters like density, Young's modulus, magnitude of pressure) . I think I can do this by editing the madpl.dat and/or fluidFlow.cas from the tutorial. Is this the correct method?nWith System Coupling, you can specify a .jou journal file as the input file instead of the .cas. Then in the .jou you have to load the .cas and add the (sc-solve) command. It is in the journal file that you can also add commands to modify the Fluent setup before (sc-solve). An example .jou would be:nfile/confirm-overwrite? nonfile/start-transcript FLUENT-1.trnnfile set-batch-options yes yes yes ,nfile/read-case/fluentn(if (hyb-init?)n(ti-menu-load-string /solve/initialize/hyb-initialization)n(ti-menu-load-string /solve/initialize/initialize-flow))n(sc-solve)nfile/stop-transcriptnexitnoknOn the Mechanical side, you can add MAPDL commands to the .dat which can modify the setup. It's possible to have multiple .dat files, (one that calls another), so that if your case is large, you can have one .dat file with the modification commands. You'll have to ask for more information about this in the Structures area of the Forum.n2) read the result file to extract values like nodal displacement. I cannot locate which file contains the results. I think file1.rst in the Structural_Run directory from the tutorial contains the results, but characters are all gibberish when I open them in a text editor.nFor this you can also add commands to the .dat to export specific results. Again, you'll have to ask a question in the Structures area of the Forum for more information. You can also set up Fluent report definitions to write out text files with information about the run. Another option would be to use EnSight to read the EnSight results that are created during the System Coupling run and get the output data from EnSight. EnSight can be scripted.n
    • Nyurons
      Subscriber
      Thank you Steve for the advice. Where can I learn about commands for Fluent? Why is it recommended to use .jou then .cas unlike what Karthik suggested earlier?nIn the mean while, I will go to the Structural forum to learn more about .dat and MAPDL commands. n
Viewing 5 reply threads
  • The topic ‘Edit Input and Getting Results from a File for System Coupling from Command Line’ is closed to new replies.
[bingo_chatbox]