CFD Online Discussion Forums

CFD Online Discussion Forums (
-   FLUENT (
-   -   error caused by UDF, plz help (

molixu January 4, 2012 04:45

error caused by UDF, plz help
There is error as followed when I try to add the UDF boundary condition:
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_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 */
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_tot +=Q;
if (Q_tot<= Heat[i])
else F_PROFILE(c,t,position)=0;

All times are GMT -4. The time now is 14:17.