## Fluids

#### PROBLEMS WITH THE MACRO C_STRAIN_RATE_MAG(c, t)

• Luis Enrique
Subscriber

Hi everyone!

I 've working with a udf to simulate the viscosity of alumiunium in function of temperarture and strain rate. Neverthless, the macros C_STRAIN_RATE_MAG(c, t) its not working. When I write the macros fluent show a divergence problems. (I atached the udf)

#include "udf.h"

#include "mem.h"

#define Q 176867 //J/mol

#define A 4.46e+13

#define n 5.86

#define R 8.314 //J/molK

#define alpha 0.0118

DEFINE_PROPERTY(cell_viscosity, c, t)

{

real   temp = C_T(c, t);

real   mu_lam;

real   Z;

real   Flow_stress;

real   x;

real   strain;

if (strain < 0)

{

strain = 10;

}

else

{

strain = C_STRAIN_RATE_MAG(c, t);

}

Z = pow((strain), (Q / (R*temp)));

x = pow((Z / A), (1. / n));

Flow_stress = (1. / alpha)*(log(x + sqrt(pow(x, 2) + 1.)));

mu_lam = Flow_stress / (3.*strain);

if (mu_lam > 0)

return mu_lam;

}

But when I use a constante value of strain rate, the udf works perfect and match whith my had writing calculus ( I atached the another udf)

#include "udf.h"

#include "mem.h"

#define Q 176867 //J/mol

#define A 4.46e+13

#define n 5.86

#define R 8.314 //J/molK

#define alpha 0.0118

DEFINE_PROPERTY(cell_viscosity, c, t)

{

real   temp = C_T(c, t);

real   mu_lam;

real   Z;

real   Flow_stress;

real   x;

real   strain = 10;

Z = pow((strain), (Q / (R*temp)));

x = pow((Z / A), (1. / n));

Flow_stress = (1. / alpha)*(log(x + sqrt(pow(x, 2) + 1.)));

mu_lam = Flow_stress / (3.*strain);

if (mu_lam > 0)

return mu_lam;

}

I hope someone could help me, thanks by advanced.

• DrAmine
Ansys Employee

Perhaps you need to provide limiters and/or tune a bit URF's, time scales, etc..

You need also to provide a well educated standard value for start...

• Luis Enrique
Subscriber

Hi everyone, the problem was that fluent need a inmediatly viscosity value to begin the simulation, because the strain rate value is zero en the t=0. Only implement a if condition and works perfect