CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   new-parameter :surface integral of velocity (http://www.cfd-online.com/Forums/fluent-udf/127208-new-parameter-surface-integral-velocity.html)

nenazarian December 5, 2013 20:18

new-parameter :surface integral of velocity
 
Hi,

I need to define air exchange rate in each node by integrating y and z velocity on a face surface. For that purpose, I have wrote the following UDF

/************************************************** *********************/
/* UDF for computing the magnitude of ACH */
/************************************************** *********************/
#include "udf.h"

DEFINE_EXECUTE_AT_END(ach,f,t,d,dt,w,v)
{
face_t f; Thread *t; Domain *d; real NV_VEC(A);
/* Integrate w velocity. */
real flow_time = CURRENT_TIME;
real dt = CURRENT_TIMESTEP;
real w= F_W(f,t) ; real v= F_V(f,t) ;

real sum_ACHt_in=0.; real sum_ACHs_in=0.;
real sum_ACHt_out=0.; real sum_ACHs_out=0.;
real ACHt_in, ACHt_out, ACHt_it, ACHt_ot;
real ACHs_in, ACHs_out, ACHs_it, ACHs_ot;
/*cell_t c;*/

d = Get_Domain(1); /* mixture domain if multiphase */
thread_loop_f(t,d)
{
begin_f_loop(f,t)

if (w<=0)
{
ACHt_in= w * NV_MAG(A)/16 ;
sum_ACHt_in +=ACHt_in;
ACHt_it=sum_ACHt_in*dt/flow_time;
}
else
{
ACHt_out= w * NV_MAG(A)/16;
sum_ACHt_out +=ACHt_out;
ACHt_ot=sum_ACHt_out*dt/flow_time;
}
if (v<=0)
{
ACHs_in= v * NV_MAG(A)/16 ;
sum_ACHs_in +=ACHs_in;
ACHs_it=sum_ACHs_in*dt/flow_time;
}
else
{
ACHs_out= v * NV_MAG(A)/16;
sum_ACHs_out +=ACHs_out;
ACHs_ot=sum_ACHs_out*dt/flow_time;
}

end_f_loop(c,t)
}

}


However, I am confused on how to access and output this parameter in each node after calculation.
Also, is it possible to use sampling option for time averaging this parameter?

I would appreciate your help.
Cheers,
Negin

pakk December 6, 2013 03:16

Use user defined memories (UDM) for your variables.
For example, if you want to access ACHs_ot, replace it by F_UDMI(f,t,0).


All times are GMT -4. The time now is 19:50.