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

NyuronsNyurons Member
edited January 13 in Fluids

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).

However, I also want to be able to...

1) 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?

2) 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.

I am using ANSYS 2019 R2 Student version on Windows 10.

Best Answer

  • SteveSteve Forum Coordinator
    Accepted Answer

    Hi @Nyurons ,

    Interesting project. I also recommend using optiSLang which is designed to run optimization cases like this.

    1) 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?

    With 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:

    file/confirm-overwrite? no

    file/start-transcript "FLUENT-1.trn"

    file set-batch-options yes yes yes ,

    file/read-case/"fluent"

    (if (hyb-init?)

    (ti-menu-load-string "/solve/initialize/hyb-initialization")

    (ti-menu-load-string "/solve/initialize/initialize-flow"))

    (sc-solve)

    file/stop-transcript

    exit

    ok

    On 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.

    2) 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.

    For 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.

Answers

  • Hello,

    1. The 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.
    2. file.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.

    Thanks.

    Karthik

  • 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?

    From 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

    or 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.


  • Thank you Karthik.

    Is 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?

    From what I have seen online,

    "C:\Program Files\ANSYS Inc\ANSYS Student\v194\ansys\bin\winx64\ANSYS194.exe" -b -i input.txt -o output.dat

    or 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.


  • SteveSteve Forum Coordinator
    Accepted Answer

    Hi @Nyurons ,

    Interesting project. I also recommend using optiSLang which is designed to run optimization cases like this.

    1) 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?

    With 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:

    file/confirm-overwrite? no

    file/start-transcript "FLUENT-1.trn"

    file set-batch-options yes yes yes ,

    file/read-case/"fluent"

    (if (hyb-init?)

    (ti-menu-load-string "/solve/initialize/hyb-initialization")

    (ti-menu-load-string "/solve/initialize/initialize-flow"))

    (sc-solve)

    file/stop-transcript

    exit

    ok

    On 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.

    2) 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.

    For 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.

  • 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?

    In the mean while, I will go to the Structural forum to learn more about .dat and MAPDL commands.

Sign In or Register to comment.