Fluids

Fluids

Defining Expressions in CFD Post

    • ashiadarsh
      Subscriber

      I have 10 set of data points...Y vs X...How can i Define this data as an Variable/Expression in CFD Post?

    • raul.raghav
      Subscriber
      This is not something that one would normally do. Can you explain why you want to define a specific data set as an expression or variable?

      If you want to define them as an expression, you can use the nested “if” function. For eg., if your X data is var2 and Y data is var1, then define expression for var2 as:

      if(var1=yValue1, xValue1, if(var2=yValue2, xValue2, if(var3=yValue3, xValue3, 0)))

      If your intention is to create a plot, then you can use the table.
    • ashiadarsh
      Subscriber

      I have to calculate the heat transfer coefficient..in my problem the wall temperature varies in the flow direction.

    • raul.raghav
      Subscriber

      Did you define the variable wall temperature in your simulation setup? If it has been setup in your simulation, you don't have to define it again in CFD-Post.

    • ashiadarsh
      Subscriber

      Hi Raul,


             I defined the wall temp as profile file in ANSYS FLUENT....I fitted the variation in temp to GAUSS function and incfreased the density of points...now I am facing convergence issue in the solver...the solution converged for the case of constant wall temp,other conditions including the mesh resolution remains the same..any suggestions?

    • Rob
      Ansys Employee

      How are you defining the profile? Ie is it a profile file or did you use a polynomial within a UDF? 

    • ashiadarsh
      Subscriber

      Profile file with more data points...But i also wanted to know how to write the UDF for a polynomial function ...say for example thermal conductivity variation as a funtion of temperature...if you could send a template for that will be really helpful.


      Thank You


      Adarsh

    • raul.raghav
      Subscriber

      To define thermal conductivity as a function of temperature, you don't really require a udf. You can use the polynomial option. See attached screenshots:





    • ashiadarsh
      Subscriber

      Dear Rahul,


          Thank You for the reply.......That option I Used in my problem...I Just wanted to know about UDF..for example if I wanted to input a variable temperature as boundary condition(I know the functional relationship) i need to write UDF file or I have to the use profile file.


      I have one question on the above...If i know the property variation as an exponential function of temp, how can i input the values?for that do i need to write UDF?


      Adarsh

    • raul.raghav
      Subscriber

      Profile file is easier to use and implement, while a UDF provides you the capability to do a lot more but involves quite a bit of learning in coding and implementing it. However, you can always start with the templates provided by Ansys in the UDF Manual and modify them to your needs. Refer the following UDF template for defining thermal conductivity as a function of temperature.



       #include "udf.h"
       
       DEFINE_PROPERTY(k_function,c,t)


      {
        real kay;
        real y, x[ND_ND];
       
        C_CENTROID(x,c,t);
        y = x[1];
        real temp = C_T(c,t);
        kay = /*define your function k(T)*/;
        return kay;
       }


    • DrAmine
      Ansys Employee

      The customization manual contains several examples like the one shared by Rahul. If you question is now answered please mark this thread as solved. Thanks.

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