CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   one quastion about r->reactant[i] (https://www.cfd-online.com/Forums/fluent-udf/91325-one-quastion-about-r-reactant-i.html)

m.beh August 7, 2011 15:59

one quastion about r->reactant[i]
 
hi

I am writing a udf for a volumetric reaction rate, (there is a example in fluent udf manual).
If I want to reach a specific species properties, I should use
r->reactant[i]
i is the index of my species.

I wonder how can I found my species index.

for example I have a 3 gasses in my gas phase as mixture.
in the species dialog box under selected species I have:
CO
H2
O2
so is it true that their index are:
CO->0
H2->1
O2->2
and when i write
r->reactant[1] it is equal to H2?

or their index are arrange by their order in the reactions dialog box?

gearboy August 7, 2011 21:23

Quote:

Originally Posted by m.beh (Post 319210)
hi

I am writing a udf for a volumetric reaction rate, (there is a example in fluent udf manual).
If I want to reach a specific species properties, I should use
r->reactant[i]
i is the index of my species.

I wonder how can I found my species index.

for example I have a 3 gasses in my gas phase as mixture.
in the species dialog box under selected species I have:
CO
H2
O2
so is it true that their index are:
CO->0
H2->1
O2->2
and when i write
r->reactant[1] it is equal to H2?

or their index are arrange by their order in the reactions dialog box?

If you want to store H2 and O2 index into H2_Num,O2_Num, then
//-----------------------------------------
int H2_Num,O2_Num,spe;
char *spe_name;
Domain*domain;
Material*mix_mat;
domain=Get_Domain(1);
mix_mat= mixture_material(domain);
mixture_species_loop_i(mix_mat,spe)
{
spe_name=MIXTURE_SPECIE_NAME(mix_mat,spe);
if(STREQ("H2",spe_name))
{
H2_Num=spe;
}
if(STREQ("O2",spe_name))
{
O2_Num=spe;
}

}

m.beh August 8, 2011 03:47

thank you
 
it is very use full and I use your code as ececute on demand


All times are GMT -4. The time now is 23:00.