CFD Online Discussion Forums

CFD Online Discussion Forums (
-   FLUENT (
-   -   Doubt about F_FLUX(f,tf) macro & VOF ?!!!!!!!! (

asghari May 7, 2007 09:08

Doubt about F_FLUX(f,tf) macro & VOF ?!!!!!!!!

I have doubt about using this macro: F_FLUX(f,tf)

In the faces and in VOF two phase model , I use a UDF for proving that wether following relation is right or wrong:

D(rho)/D(t)+sigma on faces(Fe+Fn-Fs-Fw)=little value (in converge conditions)

But I sure F_FLUX(f,tf) isn't suitabe for this case(two-phase); I check this UDF in single phase ; results were quiet correct. I present UDF as follows:

/************************************************/ #include "udf.h" /* must be at the beginning of every UDF you write */

#include "mem.h" /* must be writen for accessing to memory */

#include "sg.h" /* needed for secondary gradient macro */

#include "flow.h"

#include "sg_mphase.h" /************************************************** */

DEFINE_ADJUST(my_define_adjust, domain) { /**beginig of define_adjust**/

Thread *tf;

Thread *t;

face_t f;

cell_t c,c0,c1;

real physical_dt,flow_time,convection2;

if(!Data_Valid_P()) return;

physical_dt = RP_Get_Real("physical-time-step");

flow_time= RP_Get_Real("flow-time");

thread_loop_c (t,domain) {

begin_c_loop(c,t) {

C_UDMI(c,t,0)= C_UDMI(c,t,1) ;

C_UDMI(c,t,1)= flow_time;

if(fabs(C_UDMI(c,t,1)-C_UDMI(c,t,0))>1e-10) /*(i.e if(C_UDMI(c,t,1)/=C_UDMI(c,t,0)) ( for discovering of :Is time step new or not? )for geting of density and anthalpy from last iteration in previous time step(dt=3e-7.0)*/


C_UDSI(c,t,0)=C_UDMI(c,t,2) ;

C_UDMI(c,t,5) = (C_UDMI(c,t,4)/C_VOLUME(c,t)+C_UDMI(c,t,3));

/*UDM for indirect accessing to mass imbalance in each cell*/






/*****beginning of Calculation of mass imbalance*****/

thread_loop_c (t,domain)


begin_c_loop (c,t)


C_UDMI(c,t,3)=(C_R(c,t)-C_UDSI(c,t,0))/ physical_dt; /*unsteady term in continuity equation*/

} /*end of computing unsteady term*/

end_c_loop (c,t)


thread_loop_c (t,domain) {

begin_c_loop(c,t) { /***15****/

int i=1 ;

C_UDMI(c,t,4)=0.0 ;



f = C_FACE(c,t,i);

tf = C_FACE_THREAD(c,t,i);



convection2 = (F_FLUX(f,tf));


else if(F_C0(f,tf)==c)


convection2 = (F_FLUX(f,tf));




convection2 = -(F_FLUX(f,tf));


C_UDMI(c,t,4) = C_UDMI(c,t,4)+(convection2);


end_c_loop(c,t) }


/**end of define_adjust**/

You can compare C_UDMI(c,t,5) with real mass imbalance in Display-->contours--->residual--->mass imbalance panel . discrepancy is clarified. Has anybody suggestion about improving of this UDF to take logical results for face fluxes?

For running of UDF, please turn off UDSI solution .

Thanks in advance for any help.


MikeWolf May 20, 2007 11:51

Re: Doubt about F_FLUX(f,tf) macro & VOF ?!!!!!!!!
f_flux in interior seems to have a unit of kg/m2-s, which is needed to multiply Area.

759599290 October 28, 2012 04:03

Hi @MikeWolf:
i have some problems with what does F_FLUX(f,tf) return in UDF, but i have done some tests, which showed that F_LUX is not equal to vec(velocity) dot vec(face area). so I am really puzzled, hope for your help.

All times are GMT -4. The time now is 05:24.