CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   Re: UDF(urgent) (http://www.cfd-online.com/Forums/fluent/32384-re-udf-urgent.html)

li li October 24, 2003 19:17

Re: UDF(urgent)
 
Hi, I am using the interpreted UDF in Fluent 6.0.12. The following code is from section 4.3.12(UDF manual). I got error information as following:

line 17: THREAD_STORE: undeclared variable

Can anybody tell me what this means?

Any help will be appreciated.

Li

/************************************************** ********************/ /* UDF that implements a simplified advective term in the */ /* scalar transport equation */ /************************************************** ********************/

#include "udf.h"

DEFINE_UDS_FLUX(my_uds_flux, f, t, i) { Thread *t0, *t1 = NULL; cell_t c0, c1 = -1;

real NV_VEC(psi_vec), NV_VEC(A);

/* neighboring cells of face f, and their (corresponding) threads */

t0 = F_C0_THREAD(f,t); c0 = F_C0(f,t);

if (NULL != F_C1_THREAD(f,t)) /* Alternative: if (! BOUNDARY_FACE_THREAD_P(t)) */

{

t1 = F_C1_THREAD(f,t);

c1 = F_C1(f,t);

} else

{

t1 = NULL;

c1 = -1;

}

/* If Face lies at domain boundary, use face values; */ /* If Face lies IN the domain, use average of adjacent cells. */

if (NULL == t1) /* Alternative: if (BOUNDARY_FACE_THREAD_P(t)) */

{

NV_D(psi_vec, =, F_U(f,t), F_V(f,t), F_W(f,t));

NV_S(psi_vec, *=, F_R(f,t));

} else

{

NV_D(psi_vec, =, C_U(c0,t0), C_V(c0,t0), C_W(c0,t0));

NV_D(psi_vec, +=, C_U(c1,t1), C_V(c1,t1), C_W(c1,t1));

NV_S(psi_vec, /=, 2.); /* averaging. */

NV_S(psi_vec, *=, (((C_R(c0,t0) + C_R(c1,t1)) / 2.)));

}

/* Now psi_vec contains our "psi" from above. */ /* Next, get the face normal vector: */

F_AREA(A, f, t);

/* Finally, return the dot product of both. */ /* Fluent will multiply the returned value */ /* by phi_f (the scalar's value at the face) */ /* to get the "complete" advective term... */

return NV_DOT(psi_vec, A); }


li li October 25, 2003 00:08

Re: UDF(urgent)
 
HI,

Will it be helpful if I use compiled UDF?

Best regards.

Li

li li October 25, 2003 00:52

Re: UDF(urgent!!!!!)
 
Can anyone help me with this problem?

Best regards, Li

li li October 29, 2003 11:25

Re: It works out.
 
Hi, Using compiled UDF is the solution. Maybe my lesson will help someone else.

Li


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