Fluids

Fluids

Topics relate to Fluent, CFX, Turbogrid and more

UDF, heat transfer coefficient for Non-Equilibrium thermal model in porous media

    • Robbie Crosby
      Subscriber

      I am trying to edit the value of the heat transfer coefficient under heat transfer settings for a Non-equilibrium thermal model in porous media. I am trying to write a UDF to do this however I cant get my UDF to come up when compiled. Does anyone have any advice for where I am going wrong. Thank you.

      #include "udf.h"

      #include "mem.h"

      #define Tsolidus 300.0

      #define Tliquidus 304.0

      #define L_f 250 //Latent heat of fusion


       

      #define UDM_RHO_F_PREV 0  // UDM index for storing previous rho_f

      #define UDM_LAMBDA_PREV 1  // UDM index for storing previous lambda


       

      DEFINE_PROFILE(h_sfq, c, t)

      {

          real dl, epsilon, mu, nu, pr, rho_pcm, u, v, mu_pcm, k_pcm, Re_d, h_sfq, local_h_sfq;

          cell_t cell;


       

          dl = 0.0194; //Diameter Matlab

          epsilon = 0.85; //Porosity Matlab

          mu = C_MU_L(c, t);        // Laminar viscosity

          rho_pcm = C_R(c, t);          // Density

          nu = mu/rho_pcm;             // Kinematic Viscosity

          pr = nu/rng_alpha(1., mu, mu); // Prandtl Number


       

          u = C_U(c, t);

          v = C_V(c, t);

          mu_pcm = C_MU_L(c ,t);

          k_pcm = C_K_L(c, t);


       

          Re_d = (rho_pcm * sqrt(u*u + v*v) *dl) / (epsilon * mu_pcm);


       

          if (Re_d > 0 && Re_d <= 40)

              local_h_sfq = (0.76 * pow(Re_d, 0.4) * pow(pr, 0.37) * k_pcm)/dl;

          else if (Re_d > 40 && Re_d <= 1000)

              local_h_sfq = (0.52 * pow(Re_d, 0.5) * pow(pr, 0.37) * k_pcm)/dl;

          else if (Re_d > 1000 && Re_d <= 20000)

              local_h_sfq = (0.26 * pow(Re_d, 0.6) * pow(pr, 0.37) * k_pcm)/dl;

          else

         

          return local_h_sfq;

      }

    • Federico Alzamora Previtali
      Ansys Employee

      Are you having problems to get this to compile? Or is the UDF not working?

      If the former, are you getting any error/warning messages when you try to compile?

      If the second, I would look at the last section of your code, where you return the value of local_h_sfq only in the last else statement

Viewing 1 reply thread
  • You must be logged in to reply to this topic.