UDFs to implement pressure-drop vs massflow rate data (in a given direction) for a fluid zone

This solution describes a UDF that can be used for easy setup of 1D resistance
inside a fluid zone given the pressure-drop vs mdot data (for a direction) in
tabular format.

One approach to do this in Fluent is using the porous-media model, which
requires transforming the discrete data into an equation that can be used by
either the inertial or viscous resistance form specified for the porous
media model. This pressure drop characteristics (as function of massflow rate)
is typically non-linear.

In this approach, the one dimensionality of the given resistance data is still

An alternative approach has been developed using a UDF to directly implement
the user specified 1D resistance as momentum sink terms. This approach avoids
the potentially time-consuming effort to curve fit the tabular data and then
transform it to the standard form used by either the viscous and/or inertial
resistance in the porous media model.

What do the UDFs do ?
- Read the table of pressure-drop vs massflow rate data
- Convert this table to pressure-drop-per-unit-length vs normal velocity (which
is velocity in direction-1)
- Apply resistance to each cell (using momentum source terms) according to
the local velocity and use the table to get the pressure-drop-per-unit-length
This defines the resistance in the axial direction (direction-1)

Note that the resistance values inside the porous panel (of that fluid zone)
must be set to zero. The porous model must still be activated for that fluid
zone and the directions be correctly specified.

How to use the UDFs ?
Assume that a fluid zone has been designated as a porous zone.

1.a. Prepare the input file for the pressure drop vs massflow rate
b. The file must be named as delP_vs_mdot.txt
c. The first line is the number of data
d. The left column is massflow rate (SI)
e. The right column is pressure drop (Pa)

2.a. Determine the normal/axial direction vector of the porous zone
This will be the direction-1
b. Determine direction-2
--> These two directions will be inputs inside the porous zone fluid panel

3.a. Find the thickness (Lp) of the porous zone
b. Find the cross-sectional area of the porous zone
c. Find the zone ID of the porous zone
--> Edit porous.c and use these three values appropriately
d. Compile porous.c

4.a. Load the case file, scale, and do the rest of the setup
b. Load the library
c. Execute the on-demand UDF "alloc_dyn_mem"
Define -> User-Defined -> Execute On Demand
This UDF needs to be executed only once per Fluent session
d. Execute the on-demand UDF "read_table"
Define -> User-Defined -> Execute On Demand
e. Hook the "exec_end"
Define -> User-Defined -> Function Hooks...
Hook to the Execute At End Function
f. Open the boundary condition panel of the porous zone and setup the
direction-1 and direction-2 vectors
Make sure that all resistances are zero
e. In the same boundary condition panel, enable the source terms and
hook the UDFs "porous_x", "porous_y", and "porous_z" to the x-, y-,
and z-momentum respectively

5.a. Initialize the flowfield
b. Start iterating

How to restart the case ?
1. Read the case file ONLY
The UDFs will be automatically loaded
2. Execute the "read_table"
Define -> User-Defined -> Execute On Demand
3. Read the data file
4. Execute the "init_vn"
Define -> User-Defined -> Execute On Demand

A sample case of channel flow with porous zone in the middle. The input
file delP_vs_mdot.txt is such that a pressure drop of 2000Pa will be
observed for the prescribed boundary conditions.

- sample-1-serial.cas.gz : channel is alligned with the x-axis and
sample-1-serial.dat.gz flow is initialized with 7m/s
- sample-2-serial.cas.gz : same as above except that the channel is
sample-2-serial.dat.gz rotated 30deg wrt to the z-axis
with 42m/s
the flow is also initialized differently
- sample-3-parallel.cas.gz : based on sample-2 except that another
sample-3-serial.dat.gz rotation (about y-axis) is added

The UDFs have also been tested for a thicker porous zone and the same
pressure drop is observed.

The UDF and the corresponding sample cases have been uploaded to the

<a target=_blank href="http://www.fluentusers.com/support/solutions/1085/porous.tar.gz">http://www.fluentusers.com/support/solutions/1085/porous.tar.gz</a>http://www.fluentusers.com/support/solutions/1085/porous.tar.gz

Show Form
No comments yet. Be the first to add a comment!