CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   CFX (https://www.cfd-online.com/Forums/cfx/)
-   -   Suggestion on new dynamic viscosity expression in CFX (https://www.cfd-online.com/Forums/cfx/118643-suggestion-new-dynamic-viscosity-expression-cfx.html)

 TitusOfei May 31, 2013 10:10

Suggestion on new dynamic viscosity expression in CFX

Dear friends,
I am using ANSYS CFX version 14.0 and I want to model a different non-Newtonian fluid dynamic viscosity other than those provided in CFX. I wish to write them in either CEL or CCL (I don't know which is better).

The dynamic viscosity is expressed as:

(1-exp(nu0*sstrnr/tau0))+((tau0/sstrnr)+K*sstrnr^(n-1))

where
nu0=1000 [Pa s] (viscosity at zero shear rate)

sstrnr=shear strain rate (min=0.001, max=1000) [s^-1]

tau0=8 [Pa] (yield stress)

n=0.30 (flow behavior index)

K=6 [Pa s^0.30] (consistency index)

I know CFX understands 'sstrnr', however, I do not know how to impose the limiting min, max condition.

Titus

 ghorrocks June 1, 2013 06:17

Have a look at the available CEL expressions in the reference manual. It has functions "min" and "max", also if and step. Any of these can do this sort of thing.

 rasool motamedi June 1, 2013 07:07

hi
You must specify shear stress?

 ghorrocks June 1, 2013 07:20

No, if you just use the sstnr variable by itself it means the local value at the point, and that is calculated for all points in the domain.

 TitusOfei June 2, 2013 00:08

Quote:
 Originally Posted by ghorrocks (Post 431333) Have a look at the available CEL expressions in the reference manual. It has functions "min" and "max", also if and step. Any of these can do this sort of thing.
BTW is there any way I can get access to the existing code for Herschel-Bulkley viscosity in ANSYS CFX 14.0 and then modify it as a UDF?

Thanks again

Titus

 ghorrocks June 2, 2013 06:12

No way at all. It is in the source code and that is propriety.

If your modification is minor you could try using CEL variables for some of the input variables, but if your change is more fundamental you are going to have to write a new relation either as CEL or as fortran.

 TitusOfei June 3, 2013 00:02

Hi Glenn, this is the error message I used to get any time I run with the defined dynamic viscosity:

(1-exp(nu0*sstrnr/tau0))+((tau0/sstrnr)+K*sstrnr^(n-1))

+--------------------------------------------------------------------+
| ERROR #002100004 has occurred in subroutine Out_Scales_Flu. |
| Message: |
| The Reynolds number is outside of the range expected based on the |
| Option selected for the TURBULENCE MODEL. Check this setting, |
| the values of the properties, mesh scale, consistency of units |
| and solution values in the input file. Execution will proceed. |
+--------------------------------------------------------------------+

Based on the given parameters, the flow should be laminar, however, the Reynolds number recorded shows it is in the turbulent regime.

Domain Name : dratio 05 eccen 0
Global Length = 5.8254E-02
Minimum Extent = 5.0800E-02
Maximum Extent = 1.5240E-01
Density = 7.9405E-07
Velocity = 5.0000E-01
Reynolds Number = 3.6682E+07

Even if I omit the first part of the viscosity equation, the classical Herschel-Bulkley equation remains [((tau0/sstrnr)+K*sstrnr^(n-1))]; yet I do get similar errors.

thanks

 Lance June 3, 2013 01:56

That's only a warning, CFX guess the Re by the mean velocity, square root of the domain volume and mean density and viscosity. It can be miles off the Re you calculated. If you are sure that the Re is low enough for the flow to be laminar, then ignore the warning.

 TitusOfei June 3, 2013 06:32

Thanks Glenn. Very informative.

 TitusOfei June 3, 2013 08:08

1 Attachment(s)
Hi Glenn, one more thing. Please find attached a plot of dynamic viscosity vs. shear rate (gamma from 1E-10 to 1E-01). It can be seen that for shear rate of 1E-10 and below, the dynamic viscosity is approx. zero (0) which will drastically increase the Reynolds number. Above that (1E-10), the dynamic viscosity increases to a maximum (yield) and then decreases due to the shear thinning nature of the fluid.

That is why I wish I could bound my 'sstrnr' within the range of 1E-03 to 1E+3 in the CEL which is a typical range for drilling fluids. These bounded range would produce the Reynolds number for laminar flow regime.

Within the reference material, I couldn't find examples on how to impose 'max', 'min', 'if', or 'step' functions on 'sstrnr'.
I hope to receive guidance on this.

 Lance June 3, 2013 08:16

a nested if-statement that bounds sstrnr between 1e-3 and 1e3:
if(sstrnr<1e-3[s^-1],1e-3[s^-1],if(sstrnr>1e3 [s^-1],1e3[s^-1],sstrnr))

(im not Glenn :) )

 ghorrocks June 3, 2013 08:16

MinValue = 1.0e-10
MaxValue = 1.0e+10
Bounded_sstrnr = min(max(sstrnr,MinValue),MaxValue)
dynvis = (1-exp(nu0*Bounded_sstrnr/tau0))+((tau0/Bounded_sstrnr)+K*Bounded_sstrnr^(n-1))

Easy. (But I will let you sort out the units)

 TitusOfei June 3, 2013 08:24

Quote:
 Originally Posted by Lance (Post 431620) a nested if-statement that bounds sstrnr between 1e-3 and 1e3: if(sstrnr<1e-3[s^-1],1e-3[s^-1],if(sstrnr>1e3 [s^-1],1e3[s^-1],sstrnr)) (im not Glenn :) )
Thanks alot Lance. I'll check the results and give you feedback

 TitusOfei June 3, 2013 08:27

Quote:
 Originally Posted by ghorrocks (Post 431621) How about: MinValue = 1.0e-10 MaxValue = 1.0e+10 Bounded_sstrnr = min(max(sstrnr,MinValue),MaxValue) dynvis = (1-exp(nu0*Bounded_sstrnr/tau0))+((tau0/Bounded_sstrnr)+K*Bounded_sstrnr^(n-1)) Easy. (But I will let you sort out the units)
Thanks Glenn for the quick reply. I'll sort out the units

 TitusOfei June 3, 2013 08:52

Thanks Glenn and Lance for your help. Problem solved!!!
Now the Reynolds number is completely laminar and no error message as before. I'm very grateful to you all. I love this forum.

Domain Name : dratio 05 eccen 0
Global Length = 6.1417E-02
Minimum Extent = 5.0800E-02
Maximum Extent = 1.5240E-01
Density = 1.0000E+03
Dynamic Viscosity = 6.1622E-02
Velocity = 5.0000E-01
Reynolds Number = 4.9834E+02

 Lance June 3, 2013 08:58

You're welcome. Note that the Reynolds number in the output from CFX has no meaning for the solution process.

I guess you also changed the density, in post #7 it was kind of low:

Quote:
 Originally Posted by TitusOfei (Post 431541) Domain Name : dratio 05 eccen 0 Global Length = 5.8254E-02 Minimum Extent = 5.0800E-02 Maximum Extent = 1.5240E-01 Density = 7.9405E-07 Velocity = 5.0000E-01 Advection Time = 1.1651E-01 Reynolds Number = 3.6682E+07

 TitusOfei June 3, 2013 09:34

Quote:
 Originally Posted by Lance (Post 431637) You're welcome. Note that the Reynolds number in the output from CFX has no meaning for the solution process. I guess you also changed the density, in post #7 it was kind of low:
Lance, the density has always been 1000kgm^-3, however, I do not know how it became so low in the output file. Maybe it could be due to the 'bounded' problem I was facing earlier.

 ghorrocks June 5, 2013 05:53

You will have to be careful with such a weird viscosity relation as this. The numerical stability will be low and you might have multiple solution issues. That is if you start with high viscosity and work down you get a different answer to if you start at low viscoisty and work up.

 TitusOfei June 5, 2013 07:03

Hi Glenn
The viscosity equation I wrote after cross-checking the units, should have been

dynvis = (1-exp(nu0*Bounded_sstrnr/tau0)) * ((tau0/Bounded_sstrnr)+K*Bounded_sstrnr^(n-1))