CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   UDF for the critical rate of strain. (http://www.cfd-online.com/Forums/fluent/74175-udf-critical-rate-strain.html)

cryogenicT March 25, 2010 16:52

UDF for the critical rate of strain.
 
Hi,

I am trying to implement the following expression in fluent for the critical rate of strain:

gcr = 0.5*lam_flame_speed^2/unburnt_therm_diff

I tried to do it first using DEFINE_PROPERTY:

DEFINE_PROPERTY(udf_critical_strain_rate,c,t)
{
real gcr;
real ul;
real therm_diff;
real fmean;

real CA0 = 3.84e-5;
real CA1 = -2.4e-6;
real CA2 = 4.48e-7;
real CA3 = -6.1e-8;

fmean = C_FMEAN(c,t);
therm_diff = CA0 + CA1*fmean + CA2*pow(fmean,2.0) + CA3*pow(fmean,3.0);
ul = C_LAM_FLAME_SPEED(c,t);
gcr = 0.50*pow(ul,2.0)/therm_diff;

return gcr;
}

In the above, I'm using mean mixture fraction polynomial fits. I obtained the coefficients from Fluent. However, when I run my case, the data are off the charts with a minimum of 1.E+8 (which is the default value set by fluent).

So I tried to do it using DEFINE_ADJUST:
DEFINE_ADJUST(udf_critical_strain_rate,d)
{
Thread *t;
cell_t c;

real ul;
real therm_diff;
real fmean;
real gcr;

real CA0 = 3.84e-5;
real CA1 = -2.4e-6;
real CA2 = 4.48e-7;
real CA3 = -6.1e-8;

thread_loop_c(t,d)
{
begin_c_loop(c,t)
{

fmean = C_FMEAN(c,t);
therm_diff = CA0 + CA1*fmean + CA2*pow(fmean,2.0) + CA3*pow(fmean,3.0);
ul = C_LAM_FLAME_SPEED(c,t);
gcr = 0.50*pow(ul,2.0)/therm_diff;

C_CRITICAL_STRAIN_RATE(c,t) = gcr;
}
end_c_loop(c,t)
}
}

Bu this time, when I interpret it I get the following error message:
Invalid lvalue in assignment at the line where I set C_CRITICAL_STRAIN_RATE(c,t) = gcr.

Going through the UDF documentation, I realized that DEFINE_)ADJUST is only valid to modify variables that are not passed as arguments, which is not the case here. So DEFINE_ADJUST is not suitable.

Can anyone tell me if there is something wrong in my first UDF, or if there is a more elegant way to compute the unburnt thermal diffusivity?

Thanks,

Ace


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