CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Fluent UDF and Scheme Programming (
-   -   retrieve, access flow variables on interior boundary (

macfly January 22, 2013 02:34

retrieve, access flow variables on interior boundary
2 Attachment(s)
Hi all,

I'm looking for a way to retrieve temperature data along an interior boundary in a simple pipe flow. See figures 1 and 2, I would like to retrieve the temperature along the interior boundary ID 30. Figure 1 shows the location of the interior boundary, and figure 2 shows the mesh in this region. Here's my udf:

#include "udf.h"
DEFINE_ADJUST(Tint, domain)
real T=0;
cell_t c;
int ID = 30;
Thread *thread = Lookup_Thread(domain, ID);
begin_c_loop(c, thread)
T = C_T(c,thread);
printf("Température = %.4f\n", T);

Which produces the following error messages when I start calculation:

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: #f

I understand that the temperature is defined on boundaries and cells, but not on faces where I loop. But I can't find a way to use F_C0 to get the adjacent cells temperature. I'm a rookie with C coding and I would appreciate a little help to make my udf working. It works just fine on external boundaries, but I'm missing something regarding the interior boundaries.

Thanks ahead,

beer January 23, 2013 16:26

I think you loop over cells in a face, that won't work at all. Try the face loop. Than you ca use F_C0 and F_C1 to interpolate the temperature on the boundary. I already worked with the face loops, but I can't find the UDF right now...
Oh and you can't use printf, use Message("...")


macfly January 23, 2013 23:04

Hi beer,

You're right, it works with a face loop and then I get adjacent cell values with F_C0 and THREAD_T0 (or F_C1 and THREAD_T1). The printf command works fine in my interpreted udf. Here is my code:

#include "udf.h"
DEFINE_ADJUST(Tint, domain,t)
real coord[ND_ND];
real T;
face_t f;
cell_t c0;
int ID = 30;
Thread *thread, *t0;
thread = Lookup_Thread(domain, ID);
begin_f_loop(f, thread)
c0 = F_C0(f,thread);
t0 = THREAD_T0(thread);
T = F_T(c0,t0);
printf("x = %f\ty = %f\tT = %f\n",coord[0], coord[1], T);

solved :D

All times are GMT -4. The time now is 03:53.