CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   C_UDMI & C_UDSI problem. (https://www.cfd-online.com/Forums/fluent/68222-c_udmi-c_udsi-problem.html)

dfytanid September 10, 2009 12:28

C_UDMI & C_UDSI problem.
 
I want to run a DEFINE_ON_DEMAND udf in order to save the UDS at the wall in a UDM.
Actualy, I dont have any problem if i save the whole UDS result but i am not able to do it too.

I used the following code:


DEFINE_ON_DEMAND(wall_UDS_value)
{
Domain *d;
face_t f;
cell_t c, c0;
Thread *t,*t0, *c_thread;
int Zone_ID=3; /* Zone ID of the wall on which UDS to be calculated */
/* It can be obtained from the boundary condition panel.*/
d=Get_Domain(1);

/* Initialize the UDM value to zero in complete domain */
thread_loop_c(c_thread,d)
{
begin_c_loop(c, c_thread)
{
C_UDMI(c,c_thread,0)= 0;
}
end_c_loop(c, c_thread)
}

t=Lookup_Thread(d,Zone_ID);
begin_c_loop (c,t)
{
c0 = F_C0(f,t);
t0 = THREAD_T0(t);
C_UDMI(c0,t0,0) = C_UDSI(c,t,0);

}
end_c_loop (c,t)
}


Can anyone help me. What i did wrong?

Thank you for your answer.

Dim

coglione September 11, 2009 04:01

hello dimitrios,

to access the values on a wall, which is, from the geometrical point of view a 2-d plane and in the context of fluent a "face", you need to loop over faces and not cells.
Thus, use something like begin_f_loop and F_UDMI and you wil get what you want.

cheers

dfytanid September 11, 2009 19:44

Hello Max,
Firstly, thank you very much for your quick reply and help.
I tried what you said but I had some problems. When i used the following code the result is an "ACCESS_VIOLATION".

Could you tell me please if you know something more about that?

DEFINE_ON_DEMAND(wall_UDS_value)
{
Domain *d;
face_t f;
cell_t c;
Thread *t,*t0, *f_thread;
int Zone_ID=3; /* Zone ID of the wall on which UDS to be calculated */
/* It can be obtained from the boundary condition panel.*/
d=Get_Domain(1);
/* Initialize the UDM value to zero in complete domain */
thread_loop_f (f_thread,d)
{
begin_f_loop(f, f_thread)
{
F_UDMI(f,f_thread,0)=0;
}
end_f_loop(f,f_thread)
}

t=Lookup_Thread(d,Zone_ID);
begin_f_loop (f,t)
{
t0 = THREAD_T0(t);
F_UDMI(f,t0,0) = F_UDSI(f,t,0);
}
end_f_loop (f,t)
}

Thank you for your answer.

Dim


ivanbuz September 13, 2009 04:26

if I may throw in my 2 cents. first, f is from thread t, I am NOT sure if you can use it in F_UDMI(f,t0,0). correct me if I am wrong. second, F UDMI is available for wall and
flow boundary faces only and t0 may NOT be either of those.

dfytanid September 13, 2009 05:11

Hello Ivan,
Thank you very much for your reply.
You are right! Sorry I posted by mistake the wrong udf.

actually i used the following udf with the same "ACCESS_VIOLATION".

DEFINE_ON_DEMAND(wall_UDS_value)
{
Domain *d;
face_t f;
cell_t c;
Thread *t, *f_thread;
int Zone_ID=3; /* Zone ID of the wall on which UDS to be calculated */
/* It can be obtained from the boundary condition panel.*/
d=Get_Domain(1);
/* Initialize the UDM value to zero in complete domain */
thread_loop_f (f_thread,d)
{
begin_f_loop(f, f_thread)
{
F_UDMI(f,f_thread,0)=0;
}
end_f_loop(f,f_thread)
}
t=Lookup_Thread(d,Zone_ID);
begin_f_loop (f,t)
{
F_UDMI(f,t,0) = F_UDSI(f,t,0);
}
end_f_loop (f,t)
}

Any ideas?

Thank you for your answers.
Dim


All times are GMT -4. The time now is 22:11.