CFD Online Discussion Forums

CFD Online Discussion Forums (
-   FLUENT (
-   -   UDF :Unsteady concentration profile (

umesh July 11, 2003 18:18

UDF :Unsteady concentration profile

I want to simulate a batch process. It consists of a Packed bed reactor and Recycle Tank with a mixer. Output of Reactor (C1) goes to Tank and then recycled back to the Reactor (c2) Its a cyclic batch process. I had got steady state solution for the Reactor case. To get Unsteady solution, I had to use a UDF to describe the Tank Model which is

C2 = C1 * exp (- t / T )

I need to use the Exit conc. from reactor (c1), Calcuate C2 using UDF, which is function of time.T is constant

1. Is it possible to write such UDF.

2. Which Macros to use ?

3. How can I use the Exit Conc. (C1 )

Please give me some hint.. or a Sample UDF Any comments will be appreciated.

Thanks in advance


ap July 11, 2003 20:48

Re: UDF :Unsteady concentration profile
If I'm not wrong, you have a reactor, whose exit flow is mixed in a mixing tank (nothing added in this tank, just a mixing), which adds a delay of T sec in your system. So you want the concentration in the feed flow to the reactor to be equal to

C2 = C1 * exp(-t/T)

The term exp(-t/T) can be implemented using the macro


to get the real flow time and using the standard C function for exp.

Determining C1 is a bit more difficult. Is C1 constant (like in a CSTR reactor) or has it a profile?

In both cases you have to loop on faces threads to find your outlet BC faces thread, using a loop like

thread_loop_f(f_thread, domain) /* loops over all face threads in a domain*/


if (THREAD_TYPE(f_thread) = = THREAD_F_OUTFLOW) /* Use this if your outlet is defined as OUTFLOW - Relplace THREAD_F_OUTFLOW with THREAD_F_POUTLET if you use PRESSURE OUTLET */




In the if statement you have to put the code which reads the concentration values. The only macro I know which gives something related to concentration is


which gives you the species mass fraction.

If C1 is constant on all the boundary surface, you just have to read it and save it in UDM, for example, so you can check your UDF is working properly.

If C1 has a profile, you could calculate a weighted-average value of it or, better, determine it's profile.

Hope this helps



Umesh July 12, 2003 03:45

Re: UDF :Unsteady concentration profile
Dear ap,

You got my prooblem correctly. Your suggestions are useful.

Here, C1 is constant at the OUTFLOW BOUNDRY, but it will change with time. But it has a profile along the Bed height. I will Need C1 only at the OUTFLOW . so it is somewhat easier.

Thanks for your time.


umesh July 12, 2003 09:21

Re: UDF :Unsteady concentration profile

For the system I mentioned previous message, It contains Two different speces .. So, I had to write the model C2 = C1 * exp(-t/T) for two different species.

Can I use IF..Else statement Like

if ( i = 1)

conc = C_YI(c,t,0)*exp(-t/T);


conc = C_YI(c,t,1)*exp(-t/T);

Will such UDF give correct results ?

Any comments are welcome..

Thanks in advance..


ap July 13, 2003 17:07

Re: UDF :Unsteady concentration profile
If both species are present at the same time, you don't need the if statement.

You just have to define the model twice: in other words, you have to implement two equations like:

C2 = C1*exp(-t/T)


C2' = C1'*exp(-t/T)

where C1 and C2 refer to the first species and C1' and C2' refer to the second species.



All times are GMT -4. The time now is 17:48.