UDF to simulate one-way valves in ANSYS Fluent to prevent backflow

viliam_kacerikviliam_kacerik Member Posts: 1
edited August 2 in Fluid Mechanics


I am trying to simulate a transient simulation of a system in which fluid flows in tubes. The tubes include one-way valves (=check valves), which prevent backflow in the real life. Yet, I've been having issues with defining the boundary condition to prevent backflow. It is pretty clear to me that I have to apply a custom boundary condition (UDF) on an interior wall where the check valve would sit. Yet, being new to UDFs and programming in C, I do not know how to write such a UDF, even after referring to the Fluent UDF manual: http://www.pmt.usp.br/academic/martoran/notasmodelosgrad/ANSYS%20Fluent%20UDF%20Manual.pdf

For example, if the one-way valve should prevent backflow in the negative-Y direction (meaning allow flow in the positive-Y direction), the algorithm should resemble such:

  1. For every time step:
    1. If velocity_y < 0
      1. then velocity_y = 0

A more refined version would be:

  1. For every time step:
    1. If pressure just before the check valve < pressure just after the check valve
      1. then velocity_y = 0

Could you please help me write a UDF which I could apply onto an interior wall to act as a one-way valve to prevent backflow?

I will appreciate your help,

Kind regards,



Sign In or Register to comment.