CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Coupling outlet to inlet (https://www.cfd-online.com/Forums/fluent-udf/163868-coupling-outlet-inlet.html)

Roman1989 December 7, 2015 02:04

Coupling outlet to inlet
 
Hello,

I would like to simulate a drying process in my 3D model, and I need to set the species mass fraction in the inlet to be the same as the outlet (Zone 11).

Here is my udf:

#include "udf.h"

int get_humidity_zone_ID = 11;
real Hum;

DEFINE_ADJUST(find_humidity,domain)
{
#if !RP_HOST
Thread *ft,*ct;
face_t f;
cell_t c;

ft = Lookup_Thread(domain,get_humidity_zone_ID);
ct = THREAD_T0(ft);

begin_f_loop(f,ft)
{
c = F_C0(f,ft);
Hum = C_YI(c,ct,0);

}
end_f_loop(f,ft)
#endif

}

DEFINE_PROFILE(inlet_humidity,t,eqn)
{
face_t f;

begin_f_loop(f,t)
{
F_PROFILE(f,t,eqn) = Hum;
}
end_f_loop(f,t)

}


But for some reason the species mass fraction of the inlet is always zero.

It would be a great help for me, if anyone has experience with such a problem and could give me an advice.

Thanks in advance!

brunoc December 7, 2015 08:09

Is there any reason not to use a periodic interface?

Roman1989 December 8, 2015 03:29

Quote:

Originally Posted by brunoc (Post 576611)
Is there any reason not to use a periodic interface?

Hello brunoc
Thanks for your reply, the periodic interface could be a solution but they are not suitable in this case.
Anyway the problem has been solved with a following UDF:

#include "udf.h"
#define OUTLET_ID 11

DEFINE_PROFILE(set_humidity_inlet,inlet_thread,var iable_index)
{
face_t inlet_face_index, outlet_face_index;
real water_mass_fraction=0;
real n = 0.;
real H_AVG = 0.;
Thread *outlet_thread;
Domain *domain;

domain=Get_Domain(1);
outlet_thread=Lookup_Thread(domain,OUTLET_ID);

begin_f_loop(outlet_face_index,outlet_thread)
{
water_mass_fraction = water_mass_fraction + F_YI(outlet_face_index,outlet_thread,variable_inde x);
n = n + 1;
}
end_f_loop(outlet_face_index,outlet_thread)

H_AVG = water_mass_fraction/n;

begin_f_loop(inlet_face_index,inlet_thread)
{
F_PROFILE(inlet_face_index,inlet_thread,variable_i ndex)=H_AVG;
}
end_f_loop(inlet_face_index,inlet_thread)
}

brunoc December 8, 2015 07:51

Good thing it's working.

Instead of a simple arithmetic average, you should try calculating one that is area or mass flow averaged.

Also, if you run your UDF in parallel it will likely return the wrong results whenever your inlet and outlet are placed on different processes. You need to "parallelise" it. The documentation has an example that shows something very close to what you're trying to do.

Cheers


All times are GMT -4. The time now is 21:00.