CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   STAR-CCM+ (http://www.cfd-online.com/Forums/star-ccm/)
-   -   dynamic viskosity field function (http://www.cfd-online.com/Forums/star-ccm/79223-dynamic-viskosity-field-function.html)

jarry August 17, 2010 05:13

dynamic viskosity field function
 
Hello,

i have the following problem:
Turbulent Flow
non newton viskosity (paint)

i have to create an user defined field function for viskosity depends on strainrate.

my formulation is:

($StrainRate <= 10) ? 0.01 : ((10 < $StrainRate > 1000 ) : (1.35*$StrainRate*pow(-0.25)) : 0.14)

What is wrong with my formulation?

Thank you for your answer!

Jarry

svenne August 17, 2010 06:56

The tertiary operator works like this

(if) ? (then) : (else)

if you want to use multiple if clauses use

(if1) ? (then1) : (
(if2) ? (then2) : (
(if3) ? (then3) : (finalElse)
)
)


in your case it should be something like this:
($StrainRate <= 10) ? 0.01 : (
($StrainRate < 1000 ) ? (1.35*$StrainRate*pow(-0.25)) :
0.14
)

=============================
(10 < $StrainRate > 1000 ) <-- you already checked in the first if clause that $StrainRate > 10, so its unnecessary to check it again you use an > then where I assume <


jarry August 18, 2010 04:53

Hello svenne,

thank you for your answer.

I tried you formulation, but you make a little mistake. This are the formulation that works:

($StrainRate < 10) ? 0.01 : (($StrainRate < 1000 ) ? (3.2*pow($StrainRate,-0.35)) : 0.14)


For all ather users who have the same problem.

jarry


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