CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Fluent UDF and Scheme Programming (
-   -   UDF diffusivity (strain rate)-UDS (

Lilly September 6, 2013 02:47

UDF diffusivity (strain rate)-UDS
Dear all,

maybe I am more lucky in this UDF forum concerning the questions about my UDF:

I have got a probelm with a UDF describing the mass diffusivity of my species which should be calculated using the strain rate (or shear rate) of my fluid. I also used the strain rate for the calculation of the viscosity of the fluid and this seems to work fine (when I take a look at the results), but for any reason the strain rate seems to be set to zero for the calculation of the diffusivity (the value of the diffusivity is constant 7.95e-11 m^2/s even though the strain rate as shown at the contour plots lies in the range of 0.3 and 4000 1/s)
This is the UDF I am using (I also tried several variations):

#include "udf.h"
#include "math.h"

#define MU_INF 0.035
#define N_INF 1
#define DELTA_MU 0.25
#define DELTA_N 0.45
#define A 50
#define B 3
#define C 50
#define D 4
#define Dconst 1.5e-10

real mu;
real lambda;
real n;
real strain;
real d;

DEFINE_PROPERTY(cell_viscosity, c, t)
strain = C_STRAIN_RATE_MAG(c, t);
lambda = MU_INF+DELTA_MU*exp(-(1.+fabs(strain)/A)*exp(-B/fabs(strain)));
n = N_INF-DELTA_N*exp(-(1.+fabs(strain)/C)*exp(-D/fabs(strain)));
mu = 0.1*lambda*pow(fabs(strain),(n-1.));

return mu;

DEFINE_DIFFUSIVITY(diffusivity, c, t, i)
strain = C_STRAIN_RATE_MAG(c, t);
d = 0.53*Dconst+5.292e-9*strain;

return d;

Does anybody have an idea?

Another question is: is the strain rate and the shear rate calculated/read out the same way in Fluent (C_STRAIN_RATE_MAG)?

Another thing is: I am a little confused about the UDS. Do I always have to specify a UDS if I am modelling a changing mass diffusivity as mentioned in my UDF?
Or do I not need to specify a UDF since I am using the "Species Transport" model anyway?

Does sombebody have a good explanation about what UDS are and what they are for (since I was a little confused about the information I received at the Fluent manual).

It would be really kind, if somebody could help me since I didn' have any success yet!

All times are GMT -4. The time now is 17:36.