CFD Online Discussion Forums

CFD Online Discussion Forums (
-   FLUENT (
-   -   strain rate in UDF (

Paulina April 20, 2004 10:25

strain rate in UDF
Can anyone tell me how to define in Fluent 6.1.18 a strain rate in UDF?

I have read the UDF manual Fluent book, but I only have found:


I have used it in my udf, but I got an error:

"error:>(greater-than) :invalid argument [2]: wrong type [not a number] error object:nan".

In UDF manual I have found a definition for velocity derivatives but without strain rate.

I have checked that Fluent calculate strain rate during calculation using Mixture model, but how can I name "strain rate" in UDF?

Should I construct it from velocity derivatives or it should be used one name or symbol?

Thanks for any help


2L April 20, 2004 10:34

Re: strain rate in UDF
I think you should try with C_STRAIN_RATE_MAG(c,t) if you want to access strain rate from your UDF.

Paulina April 20, 2004 10:36

Re: strain rate in UDF
Hi 2L,

Thank you for so quickly response.

I will try it.

Best regards


Paulina April 20, 2004 10:42

Re: strain rate in UDF
Hello 2L once again!

I have included in the UDF: #include "mem.h" for C_STRAIN_RATE_MAG(c,t).

Should I put something else or it is correct?


Paulina April 21, 2004 02:54

Re: strain rate in UDF - please help
Dear 2L,

I have written in the UDF the strain rate

as you told me:


but I have got an error:

"Error:> (greater-than):invalid argument [2]:

wrong type [not a number],

Error Object: nan"

Maybe have you got another advice?

I also have tried to put under strain rate

the velocity derivative as following:

strain rate = sqrt(S*S) = sqrt[[C_DUDX(c,t)*(C_DUDX(c,t)+C_DUDX(c,t))]+[C_DUDY(c,t)*(C_DUDY(c,t)+C_DVDY(c,t))]+[C_DUDZ(c,t)*(C_DUDZ(c,t)+C_DWDZ(c,t))]+[C_DVDX(c,t)*(C_DVDX(c,t)+C_DUDY(c,t))]+[C_DVDY(c,t)*(C_DVDY(c,t)+C_DVDY(c,t))]+[C_DVDZ(c,t)*(C_DVDZ(c,t)+C_DWDY(c,t))]+[C_DWDX(c,t)*(C_DWDX(c,t)+C_DUDZ(c,t))]+[C_DWDY(c,t)*(C_DWDY(c,t)+C_DVDZ(c,t))]+[C_DWDZ(c,t)*(C_DWDZ(c,t)+C_DWDZ(c,t))]];

and of course: #include "mem.h"

But the result was negative too, the same as above.

If you know how can I ascribe the strain rate propertly in UDF, could you help me please?

Thanks in advance



2L April 21, 2004 03:18

Re: strain rate in UDF - please help
Hello !

In my case, I used the VOF model and I wanted simply to define a power law viscosity. I have pasted here my code for viscosity. Hope it can help you.

Good luck !

#include "udf.h" DEFINE_PROPERTY(viscosity, c, t) {

real visco;

visco = K*pow(C_STRAIN_RATE_MAG(c,t),n-1.);

return visco; }

Paulina April 24, 2004 11:28

Re: strain rate in UDF - please help

Thank you for your advice.

I tried your suggestion,but it didn't work.

I am still looking for a proper symbol for strain rate.

I have tried to calculate the value of the strain rate

from the following equation,

where strain rate has defined as:

strain_rate(c,t) = sqrt[[C_DUDX(c,t)*(C_DUDX(c,t)+C_DUDX(c,t))+C_DUDY(c,t)* (C_DUDY(c,t)+C_DVDX(c,t))+C_DUDZ(c,t)*(C_DUDZ(c,t) +C_DWDX(c,t))]+ [C_DVDX(c,t)*(C_DVDX(c,t)+C_DUDY(c,t))+C_DVDY(c,t)* (C_DVDY(c,t)+C_DVDY(c,t))+C_DVDZ(c,t)*(C_DVDZ(c,t) +C_DWDY(c,t))]+ [C_DWDX(c,t)*(C_DWDX(c,t)+C_DUDZ(c,t))+C_DWDY(c,t)* (C_DWDY(c,t)+C_DVDZ(c,t))+C_DWDZ(c,t)*(C_DWDZ(c,t) +C_DWDZ(c,t))]];

But I have got also an error:

"line 287: strain_rate: no function prototype,

Error: Set_Thread_Variables: wta(real)

Error Object: ((constant . 1) (profile " " " "))

Maybe have you got any suggestions?

Once again thanks for answer.

Best regards


m zahid November 19, 2014 05:09

vorticity rate/strain rate
i want to write the UDF of the ratio

scale of voticity rate/scale of strain rate

if anybody have an idea about UDF, please share this


pakk November 19, 2014 07:05

I have a great idea:

A = scale of vorticity rate;
B = scale of strain rate;

You just have to write the first two lines yourself.
Please share your attempts to write this udf, so we can comment on it. That will work much better.

m zahid November 19, 2014 12:04

thanks pakk, after writing i will share UDF for your review.

m zahid November 19, 2014 19:19

hi, pakk, do u know the difference between "scale of strain rate" and strain rate. In CFD, word "Scale" is very common with various quantities, such as length scale, time scale or scale of vorticity etc if u know the meaning of "scale" regarding CFD, please share this.


pakk November 20, 2014 04:06

You are the one who wants the UDF. I can not tell you what you want to have. Maybe you want the magnitude? I don't know. You tell me!

If you don't know what you mean with your words, how should I know? Go back to the person who gave you these words.

By the way: it would have made more sense if you would have asked the question about the meaning of "scale of strain rate" before you asked us to make the UDF.

All times are GMT -4. The time now is 22:03.