CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   Doubt about F_FLUX(f,tf) macro & VOF ?!!!!!!!! (http://www.cfd-online.com/Forums/fluent/44629-doubt-about-f_flux-f-tf-macro-vof.html)

 asghari May 7, 2007 09:08

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

Hi

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" /************************************************** */

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

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*/

}

C_UDMI(c,t,2)=C_R(c,t);

}

end_c_loop(c,t)

}

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

{

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)

}

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

int i=1 ;

C_UDMI(c,t,4)=0.0 ;

c_face_loop(c,t,i)

{

f = C_FACE(c,t,i);

{

convection2 = (F_FLUX(f,tf));

}

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

{

convection2 = (F_FLUX(f,tf));

}

else

{

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

}

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

}

end_c_loop(c,t) }

}

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.

Asghari

 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 22:43.