CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > FLUENT

udf and threads

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   November 10, 2005, 20:27
Default udf and threads
  #1
sergei
Guest
 
Posts: n/a
I'm writing a udf source file that adds up density gradient (x-component) along cell faces. It either takes cell gradent itself (along a boundary face) or average two neiboring cells (along a non-boundary face). There is no problem with the first case but something is wrong with C_R_G(c0,t0) and C_R_G(c1,t1) for the second case. It gives me a segmentation fault. It looks like C_R_G(c0,t0) and/or C_R_G(c1,t1) do not exist or references incorrectly.

Can somebody help?

Thanks. Sergei

DEFINE_SOURCE(FSD_source, c, t, dS, eqn) { int j; real value; Thread *t0, *t1 = NULL; Thread *tf; cell_t c0, c1 = -1; value=0;

c_face_loop(c, t, j) {

f=C_FACE(c,t,j);

tf=C_FACE_THREAD(c,t,j);

t0 = THREAD_T0(tf);

c0 = F_C0(f,tf);

if (BOUNDARY_FACE_THREAD_P(tf))

value+=C_R_G(c,t)[0]; else

{

t1 = THREAD_T1(tf);

c1 = F_C1(f,tf);

value+=(C_R_G(c0,t0)[0]+C_R_G(c1,t1)[0])/2;

} } return value; }
  Reply With Quote

Old   November 11, 2005, 01:26
Default Re: udf and threads
  #2
RoM
Guest
 
Posts: n/a
Try the text command solve/set/expert and answer "yes" to the question "Keep temporary solver memory from being freed?". This should preserve all gradients and not remove them continually from memory.

RoM
  Reply With Quote

Old   November 11, 2005, 04:08
Default Re: udf and threads
  #3
Marc
Guest
 
Posts: n/a
Hi,

you also might encounter problems in the first step: since you have no values no gradients can be built. So you can try adding a big loop around your UDF, e.g. "if (N_ITER>1) {...}"

Hope that helps ...
  Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
parse error while interpreting udf Kristin Fluent UDF and Scheme Programming 3 March 15, 2012 07:43
UDF for Heat Exchanger model francois louw FLUENT 2 July 16, 2010 02:21
How to access only one phase in multiphase model by UDF wersoe Fluent UDF and Scheme Programming 0 September 23, 2009 07:57
separate cell threads via UDF pedro garcia FLUENT 0 September 19, 2006 06:36
UDF, Looping through threads or faces Zhang FLUENT 1 June 21, 2005 01:24


All times are GMT -4. The time now is 16:58.