Topics relate to Fluent, CFX, Turbogrid and more

Running Loops in Fluent to Return Calculation

    • Duncan Law

      I have a quick question on how to run for loops to calculate results in CFD Post or Fluent. Essentially what I want to do is return the variable average:

      1. Create n number of isosurfaces with separation x metres apart that have a constant z value within a fluid volume.
      2. For each isosurface:
        1. return answer = area-averaged velocity in that surface * z
      3. total += answer
      4. average = total/n
    • Supreetha J
      You can do this using Python Console.
      In the Ansys Fluent Launcher, enable the "show beta launcher options". Under the General options tab, enable Python Console and then click Start.
      Here in Python Console you can use python loops for the desired output in Fluent.
    • SRP


      You can use a for loop to iterate over each isosurface and calculate the area-averaged velocity in that surface. The syntax for the loop will depend on the programming language you are using, but in general, you will want to create a loop that iterates over the range of isosurfaces you created.

      Within the loop, you can calculate the area-averaged velocity in each isosurface using the appropriate CFD Post or Fluent function.

      Once you have calculated the area-averaged velocity in each isosurface, you can multiply it by the z value of that surface to get the answer for that surface.Add up for all the surfaces to get the total.

      Hope you find it useful.

      Thank you.

      • Duncan Law

        Thanks SRP! How would I be able to script any loops? Is there a way to write code that can access the Fluent variables?

Viewing 2 reply threads
  • You must be logged in to reply to this topic.