CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   how to use C_YI(cell, thread, I) in UDF core (http://www.cfd-online.com/Forums/fluent/29036-how-use-c_yi-cell-thread-i-udf-core.html)

Zhang_clement November 5, 2001 01:58

how to use C_YI(cell, thread, I) in UDF core
 
Does anyone know how to use C_YI(cell, thread, I) in UDF core?

I have two fluid zones and the core should be used in zone 1. But I have to know the species mass fraction in zone 2. Then how to set the ¡°cell¡± or ¡°thread¡±? I have tried the thread to be 1 or 2 but it will cause fatal error. And I am also try the cell to be 1, 100, 1000,10000¡*, but the answer doesn¡¯t reasonable!

Thank you!

hampton November 6, 2001 04:21

Re: how to use C_YI(cell, thread, I) in UDF core
 
Hi,

The macro C_YI(cell, thread, I) should be used in the form of following.

thread_loop_c(thread, domain) { if( THREAD_ID(t) == 8 ) { begin_c_loop(cell, thread) {

C_YI(cell, thread, I) ; } } }

The value "8" specified above is the "thread id" that will be got in Define-Boundary Conditions . And , "I" of C_YI(cell, thread, I) shows species which you want to get the mass fraction.

Thanks.

Zhang_clement November 8, 2001 21:51

Re: how to use C_YI(cell, thread, I) in UDF core
 
Thanks a lot! But i have try it in this several days and the mass-fraction that got from zone 2 is always zero. This is my core.

#include "udf.h" extern Domain* domain; cell_t c; face_t f; Thread *t; Domain *d; int i;

DEFINE_SOURCE(source_ball, cell, thread, dS, eqn) {

float source, mass_c;

thread_loop_c (thread, domain)

{

if (THREAD_ID(thread)=2)

{ begin_c_loop_all(cell,thread)

{

mass_c = C_YI(cell, thread, 0);

}

end_c_loop_all(cell, thread)

}

}

source=4e-4*(0.5-mass_c*150); /*when I set this as source=4e-4*(0.5-0); the result is the same*/

if (source > 0)

{

return source;

}

else

{

return source=0;

} }

kevin November 8, 2001 22:14

Re: how to use C_YI(cell, thread, I) in UDF core
 
try this equation

DEFINE_SOURCE(source_ball, cell, thread, dS, eqn) {

float source, mass_c;

thread_loop_c (thread, domain) { if (THREAD_ID(thread)=2) { begin_c_loop_all(cell,thread) { mass_c = C_YI(cell, thread, 0); source=4e-4*(0.5-mass_c*150); /*when I set this as } end_c_loop_all(cell, thread) }

Zhang_clement November 15, 2001 20:53

Re: how to use C_YI(cell, thread, I) in UDF core
 
Thanks! It seems the problem solved. But I still have a little confuse. The "thread ID" should refer to the BC or that show in the surface management?

joby November 15, 2001 23:32

Re: how to use C_YI(cell, thread, I) in UDF core
 
You have to specify the zone ID which you want to adapt to your UDF.can choice specify zone from Fluent's solver Defines/Boundary Condition /(ID of Boundary Condition )



All times are GMT -4. The time now is 15:59.