CFD Online Logo CFD Online URL
Home > Forums > FLUENT

udf and threads

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

Like Tree1Likes
  • 1 Post By Marc

LinkBack Thread Tools Display Modes
Old   November 10, 2005, 21:27
Default udf and threads
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) {



t0 = THREAD_T0(tf);

c0 = F_C0(f,tf);


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


t1 = THREAD_T1(tf);

c1 = F_C1(f,tf);


} } return value; }
  Reply With Quote

Old   November 11, 2005, 02:26
Default Re: udf and threads
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.

  Reply With Quote

Old   November 11, 2005, 05:08
Default Re: udf and threads
Posts: n/a

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 ...
aestas likes this.
  Reply With Quote


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
How to access only one phase in multiphase model by UDF wersoe Fluent UDF and Scheme Programming 1 January 4, 2017 08:11
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
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 15:46.