Fluids

Fluids

Topics related to Fluent, CFX, Turbogrid and more.

UDF works in planar option but not axisymmetric

    • Zwernjayden
      Subscriber

      My udf works when I select the planar option, even with an axis BC, but when I select axisymmetric, the heat flux is 10x higher than expected. I only want the heat flux radial direction (y direction), which is maybe why.

       

      #include "udf.h"
      #include
       
      #define rho 950 // kg/m^3
      #define Hg 2033631 // J/Kg
      #define Hf -310000 // J/Kg
      #define T_ref 298 // K
      #define A1 0.01104 // m/s
      #define A2 3.9648 // m/s
      #define Cp 1500 // J/(Kg*K)
      #define E1 20557.188 // J/mol
      #define E2 55893.78 // J/mol
      #define R_u 8.314 // J/(mol*K)
      #define alpha 0.3
       
      DEFINE_PROFILE(surface_temperature_profile, t, position)
      {
          face_t f;
          real Ts, heat_flux, heat, a_face, Hv, r, Ts_old, Ts_new, error, Ts_new_prime, Area[ND_ND];
          int iter;
          begin_f_loop(f, t)
          {
              Ts = F_T(f, t);  // Current temperature at the face
              printf("Temp of face %d: %g K\n", f, Ts);
              heat = BOUNDARY_HEAT_FLUX(f, t);  // Calculating the heat flux at face f in watts
              F_AREA(Area, f, t);
              a_face = NV_MAG(Area);
              heat_flux = heat / a_face; // Heat flux in W/m^2
              printf("Heat flux on face %d: %g W/m^2\n", f, heat_flux);
              Ts_old = Ts;
              iter = 0;
              error = 1;
              while (error > 1e-6 && iter < 100)
              {
                  Hv = Hg - Hf + Cp * (Ts - T_ref);  // Calculation heat of formation
                  r = (fabs(heat_flux)) / (Hv * rho);  // Regression rate
                  if (Ts_old > 722)
                  {
                      Ts_new = E1 / (R_u * (log(A1) - log(r)));  // New surface temperature for high temperature
                  }
                  else
                  {
                      Ts_new = E2 / (R_u * (log(A2) - log(r)));  // New surface temperature for low temperature
                  }
                  error = fabs(Ts_new - Ts_old);  // Error calculation
                  Ts_old = Ts_new;  // Update Ts_old for next iteration
                  iter++;  // Increment iteration count
              }
       
              Ts_new_prime = Ts + (alpha * (Ts_new - Ts)); 
      r = (fabs(heat_flux)) / (Hv * rho);
              printf("New Temp %d: %g K\n", f, Ts_new_prime);
              printf("r_dot %d: %g mm/s\n", f, r*1000);
              F_PROFILE(f, t, position) = Ts_new_prime;  // Update the face temperature profile
          }
          end_f_loop(f, t)
      }
    • SRP
      Ansys Employee

      Hi,

      In axisymmetric simulations, Fluent automatically accounts for the circumferential integration when calculating fluxes and forces. In an axisymmetric case, the heat flux needs to be interpreted correctly. Fluent handles the circumferential scaling internally, so your calculations need to be adjusted accordingly. Specifically, the heat flux should be divided by 2*pi*r.

      Thank you.

Viewing 1 reply thread
  • The topic ‘UDF works in planar option but not axisymmetric’ is closed to new replies.