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/)
-   -   ACCESS_VIOLATION error for tempreture jump boundary condition (http://www.cfd-online.com/Forums/fluent-udf/79799-access_violation-error-tempreture-jump-boundary-condition.html)

eeman September 4, 2010 09:22

ACCESS_VIOLATION error for tempreture jump boundary condition
 
hi all

I am trying to simulate heat transfer between parallel plates with tempreture jump boundary condition.

this is my udf:

#include "udf.h"
#define TMAC 1
#define meanfreepath 6.8e-8
#define underrlx 0.02
#define SPHR 1.4
#define THAC 1
#define prandtl 0.707
DEFINE_PROFILE(temprature_jump_top,f_thread,index)
{
face_t f;

cell_t c;
Thread *cell_thread;
real gamma;
real temp;
begin_f_loop(f,f_thread)
{
c=F_C0(f,f_thread);

cell_thread=THREAD_T0(f_thread);
gamma=(2*SPHR)/(SPHR+1);
temp=(-2+THAC)/(THAC)*gamma*meanfreepath/prandtl*(C_T_G(c,cell_thread)[1]);
temp=(1-underrlx)*F_T(f,f_thread)+(underrlx*temp);
F_PROFILE(f,f_thread,index)=temp;
}
end_f_loop(face,f_thread)
}


but when i want to use them as a boundary condition,or when i want to iterate it,this error will be appear:

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: ()

how can i solve this error?:(

I appreciate for any help

dmoroian September 10, 2010 07:54

I think the problem is from the temperature gradient C_T_G. Read in the manual how to instruct fluent to keep the gradients. Check the udf manual, section 3.2.3, the paragraph Gradient (G) Vector Macros.

eeman September 13, 2010 03:45

hi
 
hi
thank you dmoroian
same as you i think the problem is from the temperature gradient C_T_G,but i dont know how can i solve it.
i read section 3.2.3, the paragraph Gradient (G) Vector Macros,but i couldnt find any thing that be useful for me:(:o

dmoroian September 13, 2010 04:48

"In order to retain the gradient data (when you want to set up user-defined scalar transport equations, for example), you can prevent the solver from freeing up memory by issuing the text command solve/set/expert and then answering yes to the question Keep temporary solver memory from being freed?."

eeman September 15, 2010 04:33

hi dmoroian,and thank you so much

i do it,but it's not useful.
do you have any other idea???:(

dmoroian September 15, 2010 04:50

Debugger
 
Try to debug it!
One way is to insert
Code:

  Message("debug 0\n");
  ...
  Message("debug 1\n");
  ...

after each line of code and see where it crashes, or use a proper debugger like gdb.
See this link for a hint on how to do it: http://www.cfd-online.com/Wiki/Udf_debug


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