-
-
May 17, 2024 at 6:40 amZwernjaydenSubscriber
I have attached the UDF at the end. I am trying to use the heat flux to update the mass flow rate at different x values on the inlet surface. I keep getting errors and the temp distribution is weird. On some faces it make sense and others its completely wrong
Temp of face 391: -nan(ind) K
Heat flux on face 392: -4.41347e+07 W/m^2
Temp of face 392: -nan(ind) K
Heat flux on face 393: -2.6595e+06 W/m^2
Temp of face 393: 99.0877 K
Heat flux on face 408: 6.20341e+06 W/m^2
Temp of face 408: 1249.73 K
Heat flux on face 409: 4.17052e+06 W/m^2
Temp of face 409: 921.292 K
Heat flux on face 410: 3.9361e+06 W/m^2
Temp of face 410: 900.957 K
pdf_initial_enthalpy: failed to converge for T = -nan(ind), fmean = 0.7, fvar = 0, error = -nan(ind)
pdf_initial_enthalpy: failed to converge for T = -nan(ind), fmean = 0.7, fvar = 0, error = -nan(ind)
pdf_initial_enthalpy: failed to converge for T = -nan(ind), fmean = 0.7, fvar = 0, error = -nan(ind)
Â
#include "udf.h"#include#define rho 754 //kg/m^3#define Hg 2033631 //J/Kg#define Hf -310000 //J/Kg#define T_ref 298 //T#define A 0.01104 //m/s#define Cp 1500 //J/(Kg*K)#define E 20557.188 //J/mol#define R_u 8.314 //J(m*K)#define D_p 0.04064 //port diameter (m)#define L 0.43815 //Length (m)#define alpha .1DEFINE_PROFILE(surface_temperature_profile, t, position){  face_t f;  real Ts, heat_flux, heat, a_face, Hv, r, Ts_old, Ts_new_prime, Ts_new, error, Area[ND_ND];  int iter;  begin_f_loop(f, t)  {    if (THREAD_ID(t) == 8) // Adjust the surface thread ID as per your case    {      Ts = F_T(f, t); // Current temperature at the face Â      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);      // Iterative calculation for new surface temperature      Ts_old = Ts;      iter = 0;      error = 1;      while (error > 1e-6 && iter < 100)      {        Hv = Hg - Hf + Cp * (Ts_old - T_ref); // Calculation heat of formation        r = (fabs(heat_flux)) / (Hv * rho); // Regression rate        Ts_new = E / (R_u * (log(A) - log(r))); // New surface 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));  printf("Temp of face %d: %g K\n", f, Ts_new_prime);      F_PROFILE(f, t, position) = Ts_new_prime; // Update the face temperature profile    }  }  end_f_loop(f, t)}DEFINE_PROFILE(mass_flow_rate_profile, t, position){  face_t f;  real heat_flux, heat, a_face, Hv, r, m_dot, Ts, Area[ND_ND];  begin_f_loop(f, t)  {    if (THREAD_ID(t) == 8) // Adjust the inlet thread ID as per your case    {      Ts = F_T(f, t); // Get the current temperature at the face      heat = BOUNDARY_HEAT_FLUX(f, t); // Calculating the heat flux at face f      F_AREA(Area, f, t);      a_face = NV_MAG(Area);      heat_flux = heat / a_face;      Hv = Hg - Hf + Cp * (Ts - T_ref); // Adjusted Hv calculation with temperature dependency      r = (fabs(heat_flux)) / (Hv * rho); // Regression rate calculation      m_dot = rho * r * a_face; // Mass flow rate calculation  printf("m_dot fuel %d: %g kg/s\n", f, m_dot);      F_PROFILE(f, t, position) = m_dot; // Set the profile for the mass flow rate    }  }  end_f_loop(f, t)}Â
-
May 17, 2024 at 10:12 amRobForum Moderator
Why are you assigning a thread to the DEFINE_PROFILE? You write a profile and then manually attach it to a surface as per the example in the manual.Â
-
May 17, 2024 at 5:09 pm
-
May 20, 2024 at 8:33 amRobForum Moderator
Single or multiphase?Â
-
May 20, 2024 at 9:19 pmZwernjaydenSubscriber
The oxidizer steam is n2o with a shower head injector so maybe 2 phase flow not sure. The fuel inlet described in the udf is a solid heating up and turning into a gas. Is this something I would specify or does Fluent solve it automatically
-
-
May 21, 2024 at 8:45 amRobForum Moderator
Did you set a multiphase model? Solid to gas? What inlet type did you set, and what materials?Â
-
May 22, 2024 at 12:02 amZwernjaydenSubscriber
I tried setting the fuel inlet to both the composition of the solid fuel, as well as the gaseous monomer for HTPB. I used a mass flow inlet for the solid fuel and tried both a mass flow inlet and pressure inlet for the nitrous oxide oxizider. I didnt specifically set a multiphase model, im not sure how to do that.
-
- The topic ‘UDF Error’ is closed to new replies.
- error udf
- Help: About the expression of turbulent viscosity in Realizable k-e model
- Unburnt Hydrocarbons contour in ANSYS FORTE for sector mesh
- Fluent fails with Intel MPI protocol on 2 nodes
- Cyclone (Stairmand) simulation using RSM
- Diesel with Ammonia/Hydrogen blend combustion
- Non-Intersected faces found for matching interface periodic-walls
- Mass Conservation Issue in Methane Pyrolysis Shock Tube Simulation
- Encountering Error in Heterogeneous Surface Reaction
- How to obtain axial and tangential velocity in CFX-post?
-
1156
-
471
-
468
-
225
-
201
© 2024 Copyright ANSYS, Inc. All rights reserved.