-
-
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 faceheat = BOUNDARY_HEAT_FLUX(f, t); // Calculating the heat flux at face f in wattsF_AREA(Area, f, t);a_face = NV_MAG(Area);heat_flux = heat / a_face; // Heat flux in w/m^2printf("Heat flux on face %d: %g W/m^2\n", f, heat_flux);// Iterative calculation for new surface temperatureTs_old = Ts;iter = 0;error = 1;while (error > 1e-6 && iter < 100){Hv = Hg - Hf + Cp * (Ts_old - T_ref); // Calculation heat of formationr = (fabs(heat_flux)) / (Hv * rho); // Regression rateTs_new = E / (R_u * (log(A) - log(r))); // New surface temperatureerror = fabs(Ts_new - Ts_old); // Error calculationTs_old = Ts_new; // Update Ts_old for next iterationiter++; // 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 faceheat = BOUNDARY_HEAT_FLUX(f, t); // Calculating the heat flux at face fF_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 dependencyr = (fabs(heat_flux)) / (Hv * rho); // Regression rate calculationm_dot = rho * r * a_face; // Mass flow rate calculationprintf("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.
- Non-Intersected faces found for matching interface periodic-walls
- Unburnt Hydrocarbons contour in ANSYS FORTE for sector mesh
- Help: About the expression of turbulent viscosity in Realizable k-e model
- Fluent fails with Intel MPI protocol on 2 nodes
- Cyclone (Stairmand) simulation using RSM
- error udf
- Mass Conservation Issue in Methane Pyrolysis Shock Tube Simulation
- Script Error
- Facing trouble regarding setting up boundary conditions for SOEC Modeling
- UDF, Fluent: Access count of iterations for “Steady Statistics”
-
1406
-
599
-
591
-
550
-
366
© 2025 Copyright ANSYS, Inc. All rights reserved.