CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   surface integral at the interior surface!! (https://www.cfd-online.com/Forums/fluent/72395-surface-integral-interior-surface.html)

rajamanimech February 4, 2010 07:13

surface integral at the interior surface!!
 
Is it possible to take surface integral (of temperature) from any interior surface and given it as B.C at the inlet (temperature) using DEFINE_EXECUTE_AT_END macro in fluent????
i am getting error at the end of iteration when i use the following udf,

#include "udf.h"
#include "mem.h"
face_t f;
real mass_tot,mass_temp_sum,mw_temp_outlet;
DEFINE_EXECUTE_AT_END(outlet)
{
Domain *d;
d=Get_Domain(1);
real zone_ID=5;
Thread *tf;
tf=Lookup_Thread(d,zone_ID);
mass_tot=0.0;
mass_temp_sum=0.0;
begin_f_loop(f,tf)
{
mass_tot += fabs(F_FLUX(f,tf));
mass_temp_sum += fabs(F_FLUX(f,tf)) * F_T(f,tf);
}
end_f_loop(f,tf)
mw_temp_outlet = mass_temp_sum/mass_tot;
}
DEFINE_PROFILE(inlet_temp,t,i)
{
begin_f_loop(f,t)
{
F_PROFILE(f,t,i) = mw_temp_outlet;
}
end_f_loop(f, t)
}


ERROR I AM GETTING



================================================== ============================
Stack backtrace generated for process id 8912 on signal 1 :
Please include this information with any bug report you file on this issue!
================================================== ============================

/usr/local/Fluent.Inc/fluent6.3.26/lnamd64/3d/fluent.6.3.26[0xdd6fcb]
/usr/local/Fluent.Inc/fluent6.3.26/lnamd64/3d/fluent.6.3.26[0xdd6f21]
/lib64/libpthread.so.0[0x323fc0de80]
libudf/lnamd64/3d/libudf.so(outlet+0xa8)[0x2b740be9e5bc]

Error: fluent.6.3.26 received a fatal signal (SEGMENTATION VIOLATION).
Error Object: #f

can any one can help?

Billion thanks in advance!!!

Praneetha October 30, 2012 21:52

surface integral help
 
I am trying to do something similar, I am calculating surface integral over boundary which has zone id 15 and trying to use tohis as source for domain (cell zone). the code compiles and loads without any errors. But after 1st iteration nothing happens. It just hovers over 1st iteration. looks like it is going into infinite loop. But cannot figure out how?

#include "udf.h"
#define C 1.7e-8
#define V 5.7e-4
DEFINE_SOURCE(source3, c, t, dS, i)
{
real flux=0;
real ID=15;
face_t f;
Domain *d;
d=Get_Domain(1);
t=Lookup_Thread(d, ID);
begin_f_loop(f,t)
{
flux += ((pow(F_T(f,t),4))-(pow(297,4)))*(-C)/V;
}
end_f_loop(f,t)
dS[i]=0;
return flux;
}

Praneetha October 30, 2012 22:14

DEFINE_EXECUTE_AT_END is a void function
 
Your are trying to return a value from void function i think tht is causing the issue

rajamanimech August 19, 2013 16:34

#include "udf.h"
#include "mem.h"

real area_tot;
real area_temp_sum;
real aw_temp_outlet;
int zone_ID=3712;
DEFINE_EXECUTE_AT_END(outlet)
{

#if !RP_HOST
Domain *d;
Thread *tf;
Thread *t0 = NULL;
cell_t c0;
face_t f;
real A[ND_ND],area;
#endif

/*#if !RP_NODE

#endif */

#if !RP_HOST
d=Get_Domain(1);
tf=Lookup_Thread(d,zone_ID);
area_tot=0.0;
area_temp_sum=0.0;

begin_f_loop(f,tf)
{
F_AREA(A,f,tf);
area=NV_MAG(A);
c0 = F_C0(f,tf);
t0 = F_C0_THREAD(f,tf);
area_tot += fabs(area);
area_temp_sum += fabs(area) * C_T(c0,t0);
}
end_f_loop(f,tf)

# if RP_NODE
area_tot = PRF_GRSUM1(area_tot);
area_temp_sum = PRF_GRSUM1(area_temp_sum);
#endif
aw_temp_outlet = area_temp_sum/area_tot;
#endif
}


you can use this UDF to get the average temperature on interior boundary and it will stored in the variable aw_temp_outlet

saurabhmangal350 August 20, 2013 02:13

hey..
i want to know how to write UDF function and in which i have to write this.
my problem is like that i want to apply a continuous temperature change as a boundary condition on a building roof.
please help me i have no idea about this UDF function.

thanks in advance


All times are GMT -4. The time now is 06:47.