CFD Online Discussion Forums

CFD Online Discussion Forums (
-   FLUENT (
-   -   UDF Boundary Condition (

Victor November 3, 2003 05:50

UDF Boundary Condition

I need to create two UDF boundary conditions at an interface; one for the flux and one for the scalar. Iīm actually looking at a mass transfer problem but in order to get some feedback I have begun with a temperature problem and compared my result with the one obtained using FLUENTS built-in functions. The UDF code is as follows:

/*B.C. Solidface q = -k*(dT/ds)**********************/

DEFINE_PROFILE(Diff_Flux, t, i)


face_t f;

cell_t c1;

Thread *t1;

real xc[ND_ND], xf[ND_ND], grad, dn;



c1 = F_C1(f,t);

t1 = THREAD_T1(t);



dn = sqrt(ND_SUM(pow(xc[0]-xf[0],2.),pow(xc[1]-xf[1],2.),pow(xc[2]-xf[2],2.)));

grad = (F_T(f,t)-C_T(c1,t1))/dn;

F_PROFILE(f,t,i) = -0.0242*grad;




/************************************************** **/

/*B.C. Bulkface Tbulkface = Tsolidface***************/



face_t fbulk, fsolid;

Domain *doma;

Thread *tsolid;

real xfbulk[ND_ND], xfsolid[ND_ND];

int ID;

doma = Get_Domain(1);

ID = 10; /*Zone ID for the solid face*/

tsolid = Lookup_Thread(doma,ID);







if (xfsolid[0]==xfbulk[0] && xfsolid[1]==xfbulk[1] && xfsolid[2]==xfbulk[2])


F_PROFILE(fbulk,t,i) = F_T(fsolid,tsolid);







/************************************************** **/

This UDF is working fine with one exception. My problem is that FLUENT in every iteration make use of the boundary condition for the scalar (i.e. Tbulkface = Tsolidface) before the boundary condition for the flux (i.e. q = -k*(dT/ds)). I want it to be the other way around!

So my question is: How can I force FLUENT to first make use of the boundary condition for the flux and then the one for the scalar?

If anybody knows the answer or at least have some suggestion, please share it with me!

Thanks! /Victor

Ajay Rao November 6, 2003 11:47

Re: UDF Boundary Condition
Instead of using two UDF's ,you could merge both in one. Use the one name have "two" FACE_LOOP's first one apply q = -k*(dT/ds) in the next face_loop apply Tbulkface = Tsolidface

Regards, Ajay

Victor November 6, 2003 12:37

Re: UDF Boundary Condition
Thank you very much for your respons Ajay! Sadly, I donīt think that your suggestion will work with my problem. I have realised that I was not that informative about my problem in my first message. I forgot to mention that the interface between the solid and the liquid contains of two faces (wall and shadow wall). This means that I have to put one boundary condition at the wall adjacent to the fluid (or bulk) cells (Tbulkface = Tsolidface) and one at the wall adjacent to the solid cells (q = -k*(dT/ds)) hence I need two different DEFINE_PROFILE macros to be activated in the boundary condition panel. So I guess that my problem still remains...


All times are GMT -4. The time now is 22:58.