CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   retrieve, access flow variables on interior boundary (http://www.cfd-online.com/Forums/fluent-udf/112095-retrieve-access-flow-variables-interior-boundary.html)

macfly January 22, 2013 01: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);
}
end_c_loop(f,thread)
}

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,
François

beer January 23, 2013 15: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("...")

Greetings

macfly January 23, 2013 22: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);
F_CENTROID(coord,c0,t0);
T = F_T(c0,t0);
printf("x = %f\ty = %f\tT = %f\n",coord[0], coord[1], T);
}
end_f_loop(f,thread)
}


solved :D


All times are GMT -4. The time now is 09:21.