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 nonNewtonian 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: (1exp(nu0*sstrnr/tau0))+((tau0/sstrnr)+K*sstrnr^(n1)) 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. Your suggestion are greatly appreciated Titus 
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.

hi
You must specify shear stress? shear stress @(your place) 
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.

Quote:
BTW is there any way I can get access to the existing code for HerschelBulkley viscosity in ANSYS CFX 14.0 and then modify it as a UDF? Thanks again Titus 
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. 
Hi Glenn, this is the error message I used to get any time I run with the defined dynamic viscosity:
(1exp(nu0*sstrnr/tau0))+((tau0/sstrnr)+K*sstrnr^(n1)) ++  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.8254E02 Minimum Extent = 5.0800E02 Maximum Extent = 1.5240E01 Density = 7.9405E07 Velocity = 5.0000E01 Advection Time = 1.1651E01 Reynolds Number = 3.6682E+07 Even if I omit the first part of the viscosity equation, the classical HerschelBulkley equation remains [((tau0/sstrnr)+K*sstrnr^(n1))]; yet I do get similar errors. Any ideas please? thanks 
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.

Thanks Glenn. Very informative.

1 Attachment(s)
Hi Glenn, one more thing. Please find attached a plot of dynamic viscosity vs. shear rate (gamma from 1E10 to 1E01). It can be seen that for shear rate of 1E10 and below, the dynamic viscosity is approx. zero (0) which will drastically increase the Reynolds number. Above that (1E10), 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 1E03 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. Thanks again for your patience. 
a nested ifstatement that bounds sstrnr between 1e3 and 1e3:
if(sstrnr<1e3[s^1],1e3[s^1],if(sstrnr>1e3 [s^1],1e3[s^1],sstrnr)) (im not Glenn :) ) 
How about:
MinValue = 1.0e10 MaxValue = 1.0e+10 Bounded_sstrnr = min(max(sstrnr,MinValue),MaxValue) dynvis = (1exp(nu0*Bounded_sstrnr/tau0))+((tau0/Bounded_sstrnr)+K*Bounded_sstrnr^(n1)) Easy. (But I will let you sort out the units) 
Quote:

Quote:

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.1417E02 Minimum Extent = 5.0800E02 Maximum Extent = 1.5240E01 Density = 1.0000E+03 Dynamic Viscosity = 6.1622E02 Velocity = 5.0000E01 Advection Time = 1.2283E01 Reynolds Number = 4.9834E+02 
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:

Quote:

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.

Hi Glenn
The viscosity equation I wrote after crosschecking the units, should have been dynvis = (1exp(nu0*Bounded_sstrnr/tau0)) * ((tau0/Bounded_sstrnr)+K*Bounded_sstrnr^(n1)) instead of dynvis = (1exp(nu0*Bounded_sstrnr/tau0))+((tau0/Bounded_sstrnr)+K*Bounded_sstrnr^(n1)) So far, all my solutions are reasonable. Unless there is something I should know. I am implementing your idea of MinValue, MaxValue. Thanks 
Yes, and MaxValue and MinValue will need to be declared with the correct units.

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