Hi All,

I am trying to write a UDF for the Carreau-Yasuda viscosity model according to the following equation.

Everything in the equation is a parameter which I can define apart from the shear rate term. I believe in fluent I can call this value using;

C_STRAIN_RATE_MAG(c,t), but when I try and raise this to a power as in the equation, I get an error saying "invalid binary expression, double ^ float), implying that the magnitude isn't an integer? Any help is appreciated, and my UDF is below.

/* Carreau-Yasuda Viscosity Model */

#include "udf.h"

float mu_inf=0.00345;

float mu_zero=0.16;

float lambda=8.2;

float p=0.64;

float n=0.2128;

DEFINE_PROPERTY(cell_viscosity,c,t)

{

real mu_lam;

real rate;

rate=(C_STRAIN_RATE_MAG(c,t));

mu_lam=mu_inf+((mu_zero-mu_inf)*(1+(lambda*rate)^(p)))^((n-1)/p);

}