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/)
-   -   Temperature dependent Non-Newtonian viscosity UDF (http://www.cfd-online.com/Forums/fluent-udf/116154-temperature-dependent-non-newtonian-viscosity-udf.html)

cric92 April 14, 2013 06:31

Temperature dependent Non-Newtonian viscosity UDF
 
Hi, I am trying to write a UDF for Temperature dependent non Newtonian viscosity.. The following UDF works,

#include "udf.h"

DEFINE_PROPERTY(u_visc,c,t)

{
real temp,mu,strain,Q,A,R,n,Y,alpha;
Q= 1e5;
A=5e13;
R=8.314;
n=5.86;
alpha=0.0118;
temp=C_T(c,t);
strain=C_STRAIN_RATE_MAG(c,t);
Y=strain*exp(Q/(R*temp))/A;

mu=pow(Y,(-1/n))+pow((1+pow(Y,(2/n))),0.5);
mu=(1/(3*alpha*strain))*log(mu);

return mu;
}

But however when I try to calculate the value of strain rate by the gradients of velocity using the following formula, instead of UDF command C_STRAIN_RATE_MAG(c,t), my solution diverges.

strain=(2/3)*(pow(C_DUDX(c,t),2)+pow(C_DVDY(c,t),2)+pow(C_DW DZ(c,t),2)+0.5*pow((C_DUDY(c,t)+C_DVDX(c,t),2)+0.5 *pow((C_DUDZ(c,t)+C_DWDX(c,t)),2)+0.5*pow((C_DWDY( c,t)+C_DVDZ(c,t)),2);

strain=pow(strain,0.5);


What might be the problem that is causing the solution to diverge???


All times are GMT -4. The time now is 05:18.