Author Topic: How to compute fluid residence time using UDF?  (Read 3162 times)

Offline pitney1

  • Jr. Member
  • **
  • Posts: 62
  • Reputation: +0/-0
  • Searching for solution
    • View Profile
How to compute fluid residence time using UDF?
« on: February 04, 2012, 04:45:47 PM »
Advertisement
Hello,

I want to compute fluid residence time using UDF. Can any one give me any guidance?

Thank you.

Offline william

  • Full Member
  • ***
  • Posts: 151
  • Reputation: +14/-0
  • Know it, share it.
    • View Profile
Re: How to compute fluid residence time using UDF?
« Reply #1 on: February 04, 2012, 04:49:33 PM »
Fluent can compute fluid residence time via UDF using user-defined scalars. Source code for UDF is below.

Here are the steps:

1. Compile udf
2. Read case.... set # UDS > 0
3. At inlet, set UDS (value) = 0
4. Set diffusivity of UDS to a small value
5. Set source term of UDS to "rt_source" in the appropriat fluid zones
6. Iterate.
Values of UDS represent the length of time fluid has been in the domain since it entered the inlet (in seconds).

Regarding #4, for turbulent flows with recirculating zones, the use of a turbulent diffusivity is required for the correct calculation of the fluid residence time. Validations of this method using the turbulent diffusivity performed by ANSYS Fluent users have been published in academic journals.

Two such examples are:

Liu, M. and Tilton, J.N., 2010, "Spatial Distributions of Mean Age and Higher Moments in Steady Continuous Flows", AIChE Journal, Vol. 56, No. 10, pp. 2561-2572

Baleo, J-N. and Le Cloirec, P., 2000, "Validating a Prediction Method of Mean Residence Time Spatial Distributions", AIChE Journal, Vol. 46, No. 4, pp. 676-683

The text of the UDF can be found below:


/*========================*/
#include "udf.h"
/*
* UDF to compute fluid residence time
*
* This UDF requires at least 1 UDS to be defined
* At inlet, define UDS (value) = 0
* UDS will have units of time and represent approximate residence time
* of fluid in domain
*
* Diffusivity of scalar should be small to reduce diffusion i.e. 1E-5
* However, for turbulent flow with recirculating regions, it is more appropriate
* to hook the function rtd_diff to the UDS diffusivity in the
* materials panel
*/


DEFINE_SOURCE(rt_source,c,t,dS,eqn)
{
real source = C_R(c,t);
dS[eqn] = 0.0;
return source;
}

/*
* in the function below, the turbulent schmidt number has been
* set to 1.0 in accordance with the references mentioned above
* and the fluid molecular diffusivity has been set to 1.0e-5 m2/s
*
* these values can be changed on an as-needed basis, for instance in
* Airpak mean age of air calculations, a value of 2.88e-5 is used
* for the molecular diffusivity and a value of 0.7 is used for the
* turbulent Schmidt number
*/
DEFINE_DIFFUSIVITY(rtd_diff, c, t, i)
{
return C_R(c,t)*1.0e-05+C_MU_EFF(c,t)/1.0;
}