CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Need help with this UDF (https://www.cfd-online.com/Forums/fluent-udf/214567-need-help-udf.html)

zakmt293 February 5, 2019 08:39

Need help with this UDF
 
Hi guys

I've written this UDF which generate a mass source by searching for a particular phase in a cell. In the mass source one of requirement is the temp on the west side.
I need to retrive after the loop finds the respective cell as given in condition. Can anyone help me how I can do this.
Here is my UDF

# include "udf.h"
DEFINE_ADJUST(my_adjust,domain)
{
cell_t c;
int zone_ID=2;
Thread*t=Lookup_Thread(domain,zone_ID=2);
int phase_domain_index_p=0;
int phase_domain_index_s=1;
Thread *tp=THREAD_SUB_THREAD(t,phase_domain_index_p=0);
Thread *ts=THREAD_SUB_THREAD(t,phase_domain_index_s=1);
real xc[ND_ND];
real Fi=0;
real Fve=0;
real Fvw=0;
real Ts;
real Tp;
real Tw;
real Te;
real m;

begin_c_loop_all(c,t)
{
if (C_VOF(c,tp)!=0 && C_VOF(c,tp)!=1)
{
Tp=C_T(c,t);
printf("The current temp =%g of cell \n",Tp);
mass source= (Tp-Tw)/(hfg*dpi);
}
}
end_c_loop_all(c,t)
}

AlexanderZ February 11, 2019 00:39

so what is the problem with your UDF? looks like it is only a part

here you have equation
Code:

mass source= (Tp-Tw)/(hfg*dpi);
Tw
hfg
dpi
are not defined (if you dont see)

best regards


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