CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   UDF :Unsteady concentration profile (https://www.cfd-online.com/Forums/fluent/31809-udf-unsteady-concentration-profile.html)

umesh July 11, 2003 19:18

UDF :Unsteady concentration profile
 
hi

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

-Umesh


ap July 11, 2003 21: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

RP_Get_Real("flow-time")

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

F_YI(f,t,i)

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

Hi

ap

Umesh July 12, 2003 04: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 10:21

Re: UDF :Unsteady concentration profile
 
Hi,

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);

else

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

Will such UDF give correct results ?

Any comments are welcome..

Thanks in advance..

-Umesh

ap July 13, 2003 18: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)

and

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

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

Hi

ap


All times are GMT -4. The time now is 07:28.