Fluids

Fluids

Topics related to Fluent, CFX, Turbogrid and more.

How to get shear rate macro in UDF?

    • montenegro
      Subscriber

      Hello.


      I'm modelling a 2D channel with a non-newtonian fluid flow and I need to describe its viscosity through an equation that depends on the shear rate ( η=f(gamma_dot) ). I am doing this through an UDF. How can I access the shear rate? Should I use the C_STRAIN_RATE(c, t) macro or the C_DUDY(c, t) (in this case, the absolute value of it) one?


      Thank you.

      Best regards

    • Rob
      Forum Moderator
      If you search for C_STRAIN_RATE on here you'll find one or two helpful answers.
    • montenegro
      Subscriber
      Hello.

      Thank you for the reply.
      I asked the question because I've seen some discussions where it is told that the C_STRAIN_RATE(c,t) macro is the shear rate and other where it is said that it is indeed the strain rate. I also read in the Fluent User's Guide that the strain rate is the shear rate.
      However, I ran my calculations (with C_STRAIN_RATE(c,t) macro in my viscosity equation) and checked if the results made sense. The value of the shear rate should be zero all over a centerline in my channel and it is not when I pull the results for the "Strain Rate" in the "Derivatives" top down menu. The "dX-velocity/dy" is, though, hence my confusion.
      Moreover, I used the C_DUDY(c,t) macro in my UDF (needed to use abs(C_DUDY(c,t)), because Fluent returns it with negative values in the lower side of my channel) and I could not achieve convergence.

      Can you tell if there is something wrong with my procedure?

      Thank you Best regards.
    • Karthik Remella
      Administrator
      Hello Just to add to 's answer - you can use Fluent expressions directly without using UDF. You should find the parameter you are looking for under 'Derivatives'.
      Karthik
    • montenegro
      Subscriber
      Hi.

      Yes, I know I can set the viscosity equation via the 'custom field functions' option, but the problem persists. I am still doubtful regarding which parameter should I use, the "Strain rate" (C_STRAIN_RATE_MAG(c, t)) or the "dX-velocity/dy" (C_DUDY(c,t)) and if I use the latter one, my solution doesn't converge.

      Thank you.
      Best regards.
    • Rob
      Forum Moderator
      Can you show the plot of shear rate that you're looking at?
      As an aside, I use C_STRAIN_RATE_MAG(c, t) in viscosity UDFs, and I don't think I've seen anyone using (or discussing) C_DUDY(c,t) the same purpose.
    • montenegro
      Subscriber
      Hello.

      I'll upload the pictures. So, if I plot the contour for the strain rate it it is noticeable that in the center of the channel the value is very low, circa 0.26 1/s, but not zero.
      This can be confirmed by plotting the same contour over a horizontal (xx) line I drew exactly in the middle of the channel.

      I then plotted the contour for the dx-velocity/dy over this same centerline and you can see it is exactly zero, as the shear rate is supposed to be.
      And I will send you the contour of the dx-velocity/dy over the channel as a confirmation that it is being calculated.

      Thank you.
      Best regards.


    • Rob
      Forum Moderator
      Turn off node values & replot. You may also want to have a look at xy plots rather than contours.
Viewing 7 reply threads
  • The topic ‘How to get shear rate macro in UDF?’ is closed to new replies.