|
[Sponsors] |
November 10, 2005, 20:27 |
udf and threads
|
#1 |
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; } |
|
November 11, 2005, 01:26 |
Re: udf and threads
|
#2 |
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 |
|
November 11, 2005, 04:08 |
Re: udf and threads
|
#3 |
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 ... |
|
|
|
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 07:11 |
parse error while interpreting udf | Kristin | Fluent UDF and Scheme Programming | 3 | March 15, 2012 06: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 |