CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   error caused by UDF, plz help (https://www.cfd-online.com/Forums/fluent/95819-error-caused-udf-plz-help.html)

molixu January 4, 2012 03:45

error caused by UDF, plz help
 
Hi!
There is error as followed when I try to add the UDF boundary condition:
Error:
FLUENT received fatal signal (ACCESS_VIOLATION)
1. Note exact events leading to error.
2. Save case/data under new name.
3. Exit program and restart to continue.
4. Report error to your distributor.
Error Object: ()
I can't figure out what's the problem. It's a 2D model. I want to calculate the total heat added to the model by the function:
Q=cp*density*volume*(tempn-templ);
Q_tot +=Q;

Here's my UDF code, plz help me with that.. Thank you!!

#include "udf.h"
real Q_tot=0;
DEFINE_PROFILE (unsteady_heatflux, thread, position)
{
Domain *d;
real cp=880;
real density=2180;
real tempn, templ, volume, Q;
Thread *t;
cell_t c;
d= Get_Domain(1); /*Get the domain using Fluent utility *//*Loop over all cell threads in the domain*/
thread_loop_c(t,d) /*Compute Q */ /*Loop over all cells */
begin_c_loop(c,t)
{
real time= RP_Get_Real("flow-time");
real b=(int)(time/3600)+1;
int i=(int)((b-1)/24);
real Heat[4]={278.5, 280.7, 278.5, 280.5};
volume=C_VOLUME(c,t); /* get cell volume */
templ=C_T_M1(c,t); /*Get cell tempertuare of previous step*/
tempn=C_T(c,t); /*Get cell tempertuare*/
Q=cp*density*volume*(tempn-templ);
Q_tot +=Q;
if (Q_tot<= Heat[i])
F_PROFILE(c,t,position)=60;
else F_PROFILE(c,t,position)=0;
}
end_c_loop(c,t)
}


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