Enter Expressions Directly into the Fluent UI

  • Blogs
  • Simulation
  • Sort by type
  • Technologies
Published on
2019-07-09
Written by
James Latham

Wouldn’t it be great if every simulation had a static boundary and cell zone settings? Unfortunately, the world isn’t static, so many engineers are faced with the challenge of inputting variable settings into some aspect of simulation.

This is why I want to tell you about the ability to input expressions directly into the ANSYS Fluent user interface (UI).

Until now, Fluent users who needed to specify various boundary and cell zone conditions had to write a Fluent user defined function (UDF).

UDFs can get complicated quick. For instance, Figure 1 shows you the Fluent UDF code required to set up a sinusoidally fluctuating heat source based on the function Energy(t) = 90000*sin(t) [W/m^3].

Figure 1. Fluent UDF code required to set up a sinusoidally fluctuating heat source based on the function Energy(t) = 90000*sin(t) [W/m3]
Even a small UDF, like the one in Figure 1, requires a considerable amount of thought to create. For example, to create this UDF, engineers converted units, programmed in C and learned Fluent-specific programming concepts.

These concepts include, but are not limited to:

  • Threads (Fluent UDF’s data structure)
  • Macros (like DEFINE_SOURCE)
  • Utilities (like CURRENT_TIME)

Even for experienced users, this could take a while. That’s why Fluent UI expressions are so useful. They are based on an expression involving, declarative and interpreted language that enables Fluent users to enhance simulations without the need to write, compile and load UDFs.

With expressions, engineers can make use of a combination of mathematical functions, logical operators, Fluent field variables and other common concepts to simplify the specification of complex boundary and cell zone conditions.

How to Enter Expressions into the Fluent UI Without UDF

UDFs, while powerful, require users to have knowledge of programming. Expressions, however, expand the rich customization capabilities of Fluent to more users.

Returning to the fluctuating heat source in Figure 1, now we can easily enter it as an expression using standard mathematical notation (and some unit cleanup). As seen in Figure 2, the expression (sin(Time/1[s]))*90000[Wm^-3] can now be input directly into the Fluent UI.

Figure 2. Now expressions can be easily added through the user interface in standard mathematical notation.

The editor allows the engineer to name, define and describe an expression in a single interface. One can then use this named expression in multiple boundary and cell zone conditions to create any desired combination of expressions.

Figure 3. A graph of an expression that represents a sinusoidally fluctuating heat source

Specifying this expression in previous versions of Fluent involved writing/interpreting/compiling the C file, building the UDF and hooking it up to the boundary condition. These additional steps are eliminated by the use of a named expression.

Additionally, these expressions can be used to define conditional cell zone source terms, models and solver settings (like acceleration due to gravity). Users can also enter the expression directly in the boundary condition panel.

A rich set of mathematical, trigonometric and other functions can be used to define these expressions, including:

  • Positional variables (like time)
  • Field variables (like total temperature and helicity)
  • Solution variables (like time-step and iteration)
  • Reduction operations (like minimum, maximum, average and sum)

Boolean expressions can also be used in specification, refinement and size criteria for mesh adaption.

For more information about the ANSYS product range, please click here >>

This blog was originally posted on ANSYS’ website here.

Social media

Follow us on our social media platforms


RELATED BLOG POSTS

View all posts

What is a Digital Thread

How to Spin a Digital Thread The digital thread is the foundation of digital...
Read more

Redefining the impossible

Redefining the Impossible Less than 1% of the population will attempt and finish an...
Read more

How to verify and validate prototypes and products

How to verify and validate prototypes and products  When we say testing, we often...
Read more

How you can benefit from ALM–Application Lifecycle Management

How you can benefit from ALM–Application Lifecycle Management Application...
Read more

PDSFORUM – A journey through the Digital Thread

PDSFORUM 2024 - A Journey through the Digital Thread Vibrant, enthusiastic,...
Read more

Say Hello to Mathcad Prime 10!

Say Hello to Mathcad Prime 10 PTC Mathcad Prime is the industry standard for...
Read more

Suunto Factory Tour

Suunto Factory Tour   At the beginning of March, we hosted our first joint Factory...
Read more

PDSVISION becomes a member of GfSE

PDSVISION becomes a member of the Gesellschaft für Systems Engineering (GfSE) to...
Read more