Fluids

Fluids

HOW TO CREATE UDF FOR VISCOSITY CHANGE WITH HEIGHT FROM CENTERLINE

    • DEBA
      Subscriber

      HOW TO CREATE UDF FOR THIS


    • DEBA
      Subscriber

       


      The following code is ok sir?


      #include "udf.h"


      #define mu_p 0.00123


      #define H_ct 0.48


      #define k_0 3.96


      #define k_inf 1.71


      #define gamma_c 5.0


      DEFINE_PROPERTY(cell_viscosity,c,t)


      {


      real shear_rate;


      real mu;


      real k;


      real sqrt_gamma_ratio;


      shear_rate = C_STRAIN_RATE_MAG(c,t);


      sqrt_gamma_ratio = sqrt(shear_rate/gamma_c);


      k = (k_0+k_inf*sqrt_gamma_ratio)/(1+sqrt_gamma_ratio);


      if (y<50)


      {


      mu = mu_p/pow((1-0.5*k*H_ct),2);


      else


      mu=0.00345


      }


      mu=return mu;


      }

    • Karthik R
      Administrator

      Hello,


      Were you able to compile this code? Did you get any errors? Could you please share your errors? One note: I do not think you have defined defined 'y' in your code.


      As suggested by other experts, you should strongly consider looking into the DEFINE_PROFILE example in the customization manual. I am attaching a screenshot of the DEFINE_PROFILE here. Please go through similar examples for better understanding.



      I hope this helps.


      Best Regards,


      Karthik

    • Karthik R
      Administrator

      Hello,


      Also one additional note:


      please refrain from creating additional threads to ask follow-up questions related to an earlier thread because of the following reasons:



      • there is no continuity and you might receive repetitive answers from different sources.

      • If somebody has a similar issue as yours and is trying to find an answer, it becomes difficult to follow the discussion as it is scattered over several threads.


      Thank you.


      Best Regards,


      Karthik

    • DEBA
      Subscriber

      SIR I HAVE WRITTEN UDF  BUT SIR I AM GETTING error sir 


      ERROR IS fluent/14.0.0/src/dual_cell.h:line 1 : parse error.
       
       
    • DrAmine
      Ansys Employee

      Stop posting the same question everywhere please and bear in mind that this is an open community so everyone can have access into you UDF. 

    • Rob
      Ansys Employee

      Parse error typically means you've got the syntax wrong. If it's a UDF from the manual check for white space characters (HTML & pdf often contain these), if you wrote it check line 2 too.  I'm not entirely sure why you're trying to access the heat exchanger model, and would also recommend updating to R19. 


       

Viewing 6 reply threads
  • You must be logged in to reply to this topic.