CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Coupling outlet to inlet

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 7, 2015, 02:04
Default Coupling outlet to inlet
  #1
New Member
 
Roman
Join Date: Dec 2013
Posts: 2
Rep Power: 0
Roman1989 is on a distinguished road
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!
Roman1989 is offline   Reply With Quote

Old   December 7, 2015, 08:09
Default
  #2
Senior Member
 
Bruno
Join Date: Mar 2009
Location: Brazil
Posts: 277
Rep Power: 21
brunoc is on a distinguished road
Is there any reason not to use a periodic interface?
brunoc is offline   Reply With Quote

Old   December 8, 2015, 03:29
Default
  #3
New Member
 
Roman
Join Date: Dec 2013
Posts: 2
Rep Power: 0
Roman1989 is on a distinguished road
Quote:
Originally Posted by brunoc View Post
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)
}
Roman1989 is offline   Reply With Quote

Old   December 8, 2015, 07:51
Default
  #4
Senior Member
 
Bruno
Join Date: Mar 2009
Location: Brazil
Posts: 277
Rep Power: 21
brunoc is on a distinguished road
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
brunoc is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting both inlet and outlet with pressure boundary conditions ahmadbakri CFX 0 July 1, 2015 04:06
pump outlet pressure higher than inlet pressure jstan3 FLUENT 14 February 13, 2014 23:44
Inlet and Outlet b.c. based on mass flux Hale OpenFOAM Pre-Processing 2 August 9, 2013 02:26
Inlet but not outlet mireis FLUENT 1 June 10, 2010 10:56
ATTENTION! Reliability problems in CFX 5.7 Joseph CFX 14 April 20, 2010 15:45


All times are GMT -4. The time now is 15:45.