Fluids

Fluids

Topics related to Fluent, CFX, Turbogrid and more.

Saving report value to a variable using TUI commands in Fluent

    • wheeler.ky
      Subscriber

      Hi all,

      I am writing a script using TUI commands to run Fluent in batch mode, and am looking for a way to save the actual value of a report to a variable in the script. I want the value of a mass flow rate report so that I can perform some logic based off of the value, so I want to write something like this:

      (define mass_flow_rate 0)

      ; initialize and solve

      (set! mass_flow_rate (report/surface-integrals/mass-flow-rate outlet , ,))

      but the command:

      report/surface-integrals/mass-flow-rate outlet , ,

      only prints the value to the console, so the above doesn't work to get the value. Is there a simple way to access the value of the report to save to the variable?

      I have also tried creating an expression, but I ran into the same issue and can't figure out how to access an expression's value either. Similarly, I can also export both the report and expression to an output text file, but can't figure out if there's a way to load that value from the file into a variable either.

      Any help would be greatly appreciated!

      Thanks,

      Kyle

    • SRP
      Ansys Employee

      Hi,

      You can write the value to a file using TUI command:

      /report/surface-integrals> area

      (inlet)

      Surface Id :(1) ["inlet"]

      Surface Id :(2) [()]

      Write to file? [no] yes

      filename (*.srp) [""] test

      • wheeler.ky
        Subscriber

        Hi, thank you for the response!

        I am able to write the value to a file, but I'm looking to save the value of the report to a variable that I have defined in the script so I can perform some logic based off of the value. Do you know if there is a way to do that?

        Thanks,

        Kyle

Viewing 1 reply thread
  • You must be logged in to reply to this topic.