Ansys Innovation Courses

Ansys Innovation Courses

Provide feedback or ask questions related to the Ansys Innovation Courses content.

UDF for Interstitial heat transfer coefficient in non equilibrium porous media

    • Robbie Crosby
      Subscriber

      Hello, I am trying to create a UDF to fit a numerical model which must be applied as UDFs in ANSYS Fluent to model a phase change material in a porous medium. I have attached the mathematical model I am trying to follow as well as my current code. I am currently stuck on getting the interstitial heat transfer coefficient to come up as a UDF, that can be selected in ANSYS Fluent, for the non-equilibrium model of porous medium. Any help would be greatly appreciated. Should it be define_profile or define_property

      #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;

      }

    • Atharva Nagarkar
      Ansys Employee

      Hello,

      The DEFINE_PROFILE macro is used to define a custom boundary profile or cell zone condition that varies as a function of spatial coordinates or time while you can use the DEFINE_PROPERTY to specify a custom material property in Ansys Fluent for single-phase and multiphase flows. Based on this, the DEFINE_PROPERTY macro would be more suited for your use.

      Please find the links from the Ansys UDF Manual related to both these macros. Check sections 2.3.29 and 2.3.30. I would also request you to have a look at the examples given below these sections to understand the use of these DEFINE macros.

      2.3. Model-Specific DEFINE Macros (ansys.com)

      If you are not able to access the link, please refer to this forum discussion: Using Help with links (ansys.com)

      Thanks!

Viewing 1 reply thread
  • The topic ‘UDF for Interstitial heat transfer coefficient in non equilibrium porous media’ is closed to new replies.