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/)
-   -   error in udf of property (https://www.cfd-online.com/Forums/fluent-udf/228344-error-udf-property.html)

zese June 28, 2020 07:50

error in udf of property
 
1 Attachment(s)
Dear Friends

I have to simulate an axisymmetric swirling flow and to prevent reversed flow from outlet, the paper proposed a variable Re number which decreases in a sponge region from the Re of flow to 0.1 at the outlet. To consider this, I tried to write a UDF for variable viscosity based on the formulation. the formula and the UDF are brought here but Fluent gives error when I interpret it. I already defined density and velocity as 1 to make it non-dimensional

#include "udf.h"
DEFINE_PROPERTY(cell_Viscosity,c,t)
{
double x,y,theta;
real mu_lam,zita;
real cellcentroid[ND_ND];
real pi=3.14159265;
cell_t c;
Thread *t;
begin_c_loop(c,t)
{
C_CENTROID(cellcentroid,c,t);
y=cellcentroid[1];
x=cellcentroid[0];
if (x<=40)
mu_lam=0.00333;
else
{
zita=0.5+0.5*tanh(4.0*tan(-(pi/2)+pi*abs(x-40.)/60.));
mu_lam=1./(300.0+(0.1-300.0)*zita);
}
}
return mu_lam;
}


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