CFD Online Discussion Forums

CFD Online Discussion Forums (
-   FLUENT (
-   -   how to used C_YI(f,t,i)??? (

kevin November 7, 2001 22:23

how to used C_YI(f,t,i)???
i simulated a mixtures(include oxygen, water vapor,nitrogen)into flow channel in first floor , and mixtures backward diffuse in second floor , i used C code(user-defined-function) to calculate electrochemical equation in third floor , i want to give mass fraction of second gas(water vapor) C_YI(f,t,1) sovler's DEFINE/materials panel's inside have button (mixture species) , i choices order is oxygen ,water vapor,nitrogen ,

C_YI(f,t,0)..........get mass fraction of oxygen C_YI(f,t,1)..........get mass fraction of water vapor

i don't know answer is correct or incorrect ???????

hampton November 8, 2001 01:53

Re: how to used C_YI(f,t,i)???

Both C_YI(f,t,0) and C_YI(f,t,1) are not right expressions .C_YI(c, t, 0) or F_YI(f, t,0 ) is right expression .C_YI gets the cell values, and F_YI gets the face values.

However , You need to know what "0" and "1" are. So, you should see the panel "Define-Material-Material Type-Mixture-Mixture Species-names-Edit".

Then ,the species that you've selected are found in the panel "Species" , and the species are located like this oxygen, water vapor,nitrogen.

In this case, oxygen is to be set "0" . In the same manner, water-vapor is to be set "1, nitrogen is to be set "2"


kevin November 8, 2001 02:28

Re: how to used C_YI(f,t,i)???
thanks hampton to give info for me . i have one problem i want to simulate electro-chemical , so i writted C code to describe it's electro-chemical reaction. but~~~~~~~~~

DEFINE_SOURCE(test,c,t,ds,eqn) { cell_t c; Thread *t; Domain *d; real source1; thread_loop_c(t, domain) { if( THREAD_ID(t) == 2 ) { begin_c_loop(c, t) { Yo2=C_Y(c,t,0); /* 0--oxygen */ Ywc=C_YI(c,t,1); /* 1--water vapor */ Pc=C_P(c,t); Xo2=Yo2*(Xn2*Mn2-Xn2*Mw+Mw)/(Mo2+Yo2*Mw-Yo2*Mo2); Xwc=(Ywc*Xo2*Mo2+Ywc*Xn2*Mn2)/(Mw-Mw*Ywc); C_UDSI(c,t,AA)=Xo2*Xwc; } end_c_loop(c,t) } }

thread_loop_c(t, domain) { if( THREAD_ID(t) == 2 ) { begin_c_loop(c, t) { source=C_UDSI(c,t,AA); ds[eqn]=0; } end_c_loop(c,t) } }

Fluent solver give me error message don't run C code

hampton November 8, 2001 04:45

Re: how to used C_YI(f,t,i)???

Are you calculating a Fuel-Cell???. I checked your UDF and found some mistakes.

(1)Need to "return source" .

(2)In this case,you don't need to use "THREAD_ID(t)" and "thread_loop_c(t,domain)". Because your domain(zone) that you want to adapt to your UDF is defined explicitly in the BC panel by you.

If a DEFINE_ADJUST function is used, you have to use "THREAD_ID(t)" and "thread_loop_c(t,domain)" to define the domain(zone).


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