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/)
-   -   Defining species mass fraction using a UDF (http://www.cfd-online.com/Forums/fluent-udf/63003-defining-species-mass-fraction-using-udf.html)

T81 March 25, 2009 12:06

Defining species mass fraction using a UDF
 
Hi there,
I'd like to know how to define species mass fraction with a UDF.

I found the macro C_YI(c,t,i), for defining the species mass fraction.
But how to hook this in fluent?
Probably under inlet at the boundary conditions panel,
but which is the appropriate general-purpose macro for this?

I tried the following but the mass fraction doesn't change.

Code:

DEFINE_PROFILE(species_profile, t, position)
{
  cell_t c;

  begin_c_loop(c, t)
  {
    if (temp_avg  > 700)
    {
      C_YI(c,t,0) = 0.2;
    }
    else
    {
      C_YI(c,t,0) = 0.8;
    }
 }
 end_c_loop(c, t)
}

Thanks in advance

coglione March 26, 2009 03:57

Hello,

DEFINE_PROFILE has to return a value using C_PROFILE(c,t,i):

DEFINE_PROFILE(species_profile, t, i)
{
cell_t c;

begin_c_loop(c, t)
{
if (temp_avg > 700)
{
C_PROFILE(c,t,i) = 0.2;
}
else
{
C_PROFILE(c,t,i) = 0.8;
}
}
end_c_loop(c, t)
}Hook it in the boundary condition panel for your fluid zone(s) and make sure that Sum[C_YI(i)] = 1 is still valid after executing this UDF !

cheers

T81 March 26, 2009 04:59

coglione thank you very much for the quick response.
It works!!!

Thanks again :)


All times are GMT -4. The time now is 13:30.