-
-
August 4, 2025 at 1:20 pm
eng_m_m.abd89
SubscriberHello, I am using a UDF to simulate a heat source, chemical reactions, and gas vent from a Li-ion battery, and when I compile the UDF, I get no error, but when running the simulation with the following solvers being active, I get some errors:
- Energy Equation
- SST K-omega
- DO radiation
- Species transport.
Below are errors I get:
Divergence detected in AMG solver: species
Divergence detected in AMG solver: temperature
Divergence detected in AMG solver: do-intensity
Divergence detected in AMG solver: x-momentum
Divergence detected in AMG solver: y-momentum
Divergence detected in AMG solver: pressure correction
Â
And below is the UDF itself. Any suggestions or recommendations?
/*my_battery_heat_source_trial.c*/#include "udf.h"#include "stdio.h"#include "math.h"#include "mem.h"#include "time.h"#include "sg_pollut.h"Â// Inputs#define V_bat 0.0000165 // Battery volume (m^3)#define H_chem 11740   // Total heat release of chemical reaction (J)#define H_sc 17560    // Total heat release of short circuit (J)#define rho 2600     // Density of battery (kg/m^3)#define Cp 1720     // Specific heat capacity (J/kg.K)#define A 0.92      // Pre-exponential factor (unitless)#define b 28.5      // Reaction rate constant (unitless)#define T_ref 533.15   // Normalized temperature coefficient (K)#define T_chem 413.15  // Start temperature of chemical reactions (K)#define T_tr 533.15   // Triggering temperature of thermal runaway (K)#define C_chem_max 12  Â#define C_elec_max 12  Â#define NUM_UDM 17Â// Molar Mass for species#define MW_H2 2.016    // Molar mass of H2 (g/mol)#define MW_C2H4 28.05   // Molar mass of C2H4(g/mol)#define MW_CH4 16.04   // Molar mass of CH4(g/mol)#define MW_CO 28.01   // Molar mass of CO(g/mol)#define MW_CO2 44.01   // Molar mass of CO2(g/mol)#define MW_O2 32   // Molar mass of O2(g/mol)Â#define P_atm 101325   // Aymospheric pressure (Pa)#define V_void_init 0.00000152   // Initial void volume (m3)#define d_void 0.000007594   // volume increase (m3)#define Area_valve 0.00001539 // Safety valve area (dia 7mm) (m^2)ÂÂ// Global variable of generation rates and temperaturereal T_avg; // Initial assumption (K)real G_x_1; // H2 Gas Generation Rate (mol/s m3)real G_x_2; // C2H4 Gas Generation Ratereal G_x_3; // CH4 Gas Generation Ratereal G_x_4; // CO Gas Generation Ratereal G_x_5; // CO2 Gas Generation Ratereal G_x_6; // O2 Gas Generation Ratereal G_total;Â// number of generated molesreal n_x_1_gen = 0.0; // H2 number of molesreal n_x_2_gen = 0.0; // C2H4 number of molesreal n_x_3_gen = 0.0; // CH4 number of molesreal n_x_4_gen = 0.0; // CO number of molesreal n_x_5_gen = 0.0; // CO2 number of molesreal n_x_6_gen = 0.0; // O2 number of molesreal n_total_gen;Â// number of ejected molesreal n_x_1_exit; // H2 number of molesreal n_x_2_exit; // C2H4 number of molesreal n_x_3_exit; // CH4 number of molesreal n_x_4_exit; // CO number of molesreal n_x_5_exit; // CO2 number of molesreal n_x_6_exit; // O2 number of molesreal n_exit; // rate of exit (moles/sec)real n_exit_total; // total number of moles exit the battery (moles)Â//number of moles in the battery (generated - ejected)real n_x_1 = 0.0; // H2 number of molesreal n_x_2 = 0.0; // C2H4 number of molesreal n_x_3 = 0.0; // CH4 number of molesreal n_x_4 = 0.0; // CO number of molesreal n_x_5 = 0.0; // CO2 number of molesreal n_x_6 = 0.0; // O2 number of molesreal n_total;   // total number of moles (accumulated - exit)real R_gas = 8.314; // Universal gas constant (J/mol.K)real m_x_1 = 0.0; // H2 mass (g)real m_x_2 = 0.0; // C2H4 mass (g)real m_x_3 = 0.0; // CH4 mass (g)real m_x_4 = 0.0; // CO mass (g)real m_x_5 = 0.0; // CO2 mass (g)real m_x_6 = 0.0; // O2 mass (g)real m_total;   // total mass (g) (accumulated - exit)Â// Variables for the third submodelreal P_avg; // Average internal pressurereal V_void; // void volumereal rho_mix; // void volumereal gama_H2 = 1.4;real gama_C2H4 = 1.19;real gama_CH4 = 1.3;real gama_CO = 1.4;real gama_CO2 = 1.29;real gama_O2 = 1.39;real gama;real Ma;real P2;real T2;real P3;real u2;real u3;Â// Function to Compute Average Temperature in Battery Zone (2D)DEFINE_EXECUTE_AT_END(average_temp) {Domain* d;cell_t c;real area = 0.0;real area_tot = 0.0;real T;int ID = 6; // Set the battery zone IDThread* t;int zone_ID;d = Get_Domain(1);// Get thread corresponding to battery zonet = Lookup_Thread(d, ID);T_avg = 0.0; // Reset T_avg for the new calculationbegin_c_loop(c, t){  area = C_VOLUME(c, t);  T = C_T(c, t);  // Get the temperature from the cell  area_tot += area;  T_avg += T * area;}end_c_loop(c, t)T_avg /= area_tot; // Compute area-weighted avg tempprintf("1.T_avg = %g area_tot = %g\n", T_avg, area_tot);begin_c_loop(c, t){  C_T(c, t) = T_avg;  // Return Average temp to the cell}end_c_loop(c, t)}ÂÂDEFINE_INIT(init_concentrations, domain){  Thread* t;  cell_t c;  thread_loop_c(t, domain)  {    if (THREAD_ID(t) == 6)    {      begin_c_loop(c, t)      {        // Initialize UDM slots with starting concentrations        C_UDMI(c, t, 0) = 1;    // c_chem_old initial        C_UDMI(c, t, 1) = 1;    // c_elec_old initial        C_UDMI(c, t, 2) = 2.2e5;  // c_x_1 initial        C_UDMI(c, t, 3) = 1.02e3;  // c_x_2 initial        C_UDMI(c, t, 4) = 5.6e3;  // c_x_3 initial        C_UDMI(c, t, 5) = 8e3;   // c_x_4 initial        C_UDMI(c, t, 6) = 1.02e3;  // c_x_5 initial        C_UDMI(c, t, 7) = 7.6e2;  // c_x_6 initial        C_UDMI(c, t, 8) = 5.6e3;  // c_x_7 initial        C_UDMI(c, t, 9) = 1e3;   // c_x_8 initial        C_UDMI(c, t, 10) = 2.4e3;  // c_x_9 initial        C_UDMI(c, t, 11) = 0.12;  // c_x_10 initial        C_UDMI(c, t, 12) = 0.12;  // c_x_11 initial      } end_c_loop(c, t)    }  }}// UDF to define heat generation source termDEFINE_SOURCE(my_battery_heat_source,c,t,ds,eqn){// Declaring Local variable for chemical and electrical energy concentrationreal C_chem_old = C_UDMI(c,t,0); // UDM[0] for C_chemreal C_elec_old = C_UDMI(c,t,1); // UDM[1] for C_elecreal C_chem;real C_elec;real dC_chem_dt = 0.0;real dC_elec_dt = 0.0;real q_chem;real q_elec;real qv;real A_x, E_a_x, n_x1, n_x2;real g_x = 1.0; // chemical reaction correction termÂ// declaring reaction ratesreal R_x_1 = 0.0; // chemical reaction one (mol/s m3)real R_x_2 = 0.0; // chemical reaction tworeal R_x_3 = 0.0; // chemical reaction threereal R_x_4 = 0.0; // chemical reaction fourreal R_x_5 = 0.0; // chemical reaction fivereal R_x_6 = 0.0; // chemical reaction sixreal R_x_7 = 0.0; // chemical reaction sevenreal R_x_8 = 0.0; // chemical reaction eightreal R_x_9 = 0.0; // chemical reaction ninereal R_x_10 = 0.0; // chemical reaction tenreal R_x_11 = 0.0; // chemical reaction elevenÂ// declaring UDMs for concentrationsreal c_x_1_old = C_UDMI(c, t, 2);  // UDM[2] for concentration of equation 1real c_x_2_old = C_UDMI(c, t, 3);  // UDM[3] for concentration of equation 2real c_x_3_old = C_UDMI(c, t, 4);  // UDM[4] for concentration of equation 3real c_x_4_old = C_UDMI(c, t, 5);  // UDM[5] for concentration of equation 4real c_x_5_old = C_UDMI(c, t, 6);  // UDM[6] for concentration of equation 5real c_x_6_old = C_UDMI(c, t, 7);  // UDM[7] for concentration of equation 6real c_x_7_old = C_UDMI(c, t, 8);  // UDM[8] for concentration of equation 7real c_x_8_old = C_UDMI(c, t, 9);  // UDM[9] for concentration of equation 8real c_x_9_old = C_UDMI(c, t, 10); // UDM[10] for concentration of equation 9real c_x_10_old = C_UDMI(c, t, 11); // UDM[11] for concentration of equation 10real c_x_11_old = C_UDMI(c, t, 12); // UDM[12] for concentration of equation 11Âreal c_x_1; // (mol/m3)real c_x_2;real c_x_3;real c_x_4;real c_x_5;real c_x_6;real c_x_7;real c_x_8;real c_x_9;real c_x_10;real c_x_11;Âreal T_avg = C_T(c, t);  // Return Average temp from the cellreal dt = CURRENT_TIMESTEP; // Get the simulation time stepÂ// Function to compute the gas generation ratesÂif (T_avg > T_chem) {  // H2 and CH4 Gas Generation Rate = reaction one and three  R_x_1 = (1.917e25 * pow(c_x_1_old, 1) * pow(1 - c_x_1_old, 0) * exp(-2.86e5 / (R_gas * T_avg)) * g_x);  c_x_1 = c_x_1_old - (R_x_1 * dt);if (c_x_1 < .00001){c_x_1 = 0.0;}  R_x_3 = (4e28 * pow(c_x_3_old, 1) * pow(1 - c_x_3_old, 0) * exp(-4.7e5 / (R_gas * T_avg)) * g_x);  c_x_3 = c_x_3_old - (R_x_3 * dt);if (c_x_3 < .00001){c_x_3 = 0.0;}  G_x_1 = (0.5 * R_x_1) - (1 * R_x_3); // Generation rate for H2  G_x_3 = 2 * R_x_3; // Generation rate for CH4  // C2H4 Gas Generation Rate = reation two and nine  R_x_2 = (1.95e20 * pow(c_x_2_old, 1) * pow(1 - c_x_2_old, 0) * exp(-2e5 / (R_gas * T_avg)) * g_x);  c_x_2 = c_x_2_old - (R_x_2 * dt);if (c_x_2 < .00001){c_x_2 = 0.0;}  R_x_9 = (7.88e36 * pow(c_x_9_old, 1) * pow(1 - c_x_9_old, 0) * exp(-2.81e5 / (R_gas * T_avg)) * 1);  c_x_9 = c_x_9_old - (R_x_9 * dt);if (c_x_9 < .00001){c_x_9 = 0.0;}  G_x_2 = R_x_2 + R_x_9; // Generation rate for C2H4   // CO Gas Generation Rate  R_x_4 = (4e28 * pow(c_x_4_old, 1) * pow(1 - c_x_4_old, 0) * exp(-4.7e5 / (R_gas * T_avg)) * g_x);  c_x_4 = c_x_4_old - (R_x_4 * dt);if (c_x_4 < .00001){c_x_4 = 0.0;}  G_x_4 = R_x_4; // Generation rate for CO  // CO2 Gas Generation Rate  R_x_5 = (5.14e25 * pow(c_x_5_old, 1) * pow(1 - c_x_5_old, 0) * exp(-2.74e5 / (R_gas * T_avg)) * 1);  c_x_5 = c_x_5_old - (R_x_5 * dt);if (c_x_5 < .00001){c_x_5 = 0.0;}  R_x_6 = (5.14e25 * pow(c_x_6_old, 1) * pow(1 - c_x_6_old, 0) * exp(-2.74e5 / (R_gas * T_avg)) * 1);  c_x_6 = c_x_6_old - (R_x_6 * dt);if (c_x_6 < .00001){c_x_6 = 0.0;}  R_x_7 = (5.14e25 * pow(c_x_7_old, 1) * pow(1 - c_x_7_old, 0) * exp(-2.74e5 / (R_gas * T_avg)) * 1);  c_x_7 = c_x_7_old - (R_x_7 * dt);if (c_x_7 < .00001){c_x_7 = 0.0;}  R_x_8 = (5.14e25 * pow(c_x_8_old, 1) * pow(1 - c_x_8_old, 0) * exp(-2.74e5 / (R_gas * T_avg)) * 1);  c_x_8 = c_x_8_old - (R_x_8 * dt);if (c_x_8 < .00001){c_x_8 = 0.0;}  G_x_5 = (3 * R_x_5) + (4 * R_x_6) + (3 * R_x_7) + R_x_8 + R_x_9 - (2 * R_x_4); Â  // O2 Gas Generation Rate  R_x_10 = (1.75e9 * pow(c_x_10_old, 1) * pow(1 - c_x_10_old, 0) * exp(-1.1495e5 / (R_gas * T_avg)) * 1);  c_x_10 = c_x_10_old - (R_x_10 * dt);if (c_x_10 < .00001){c_x_10 = 0.0;}  R_x_11 = (1.077e12 * pow(c_x_11_old, 1) * pow(1 - c_x_11_old, 0) * exp(-1.5888e5 / (R_gas * T_avg)) * 1);  c_x_11 = c_x_11_old - (R_x_11 * dt);if (c_x_11 < .00001){c_x_11 = 0.0;}  G_x_6 = R_x_10 + R_x_11 + (0.5 * R_x_9) - (2.5 * R_x_5) - (4 * R_x_6) - (3 * R_x_7);  // Store the new concentration  C_UDMI(c, t, 2) = c_x_1;  C_UDMI(c, t, 3) = c_x_2;  C_UDMI(c, t, 4) = c_x_3;  C_UDMI(c, t, 5) = c_x_4;  C_UDMI(c, t, 6) = c_x_5;  C_UDMI(c, t, 7) = c_x_6;  C_UDMI(c, t, 8) = c_x_7;  C_UDMI(c, t, 9) = c_x_8;  C_UDMI(c, t, 10) = c_x_9;  C_UDMI(c, t, 11) = c_x_10;  C_UDMI(c, t, 12) = c_x_11;  Â  // Calculate the total gas generation rate and total number of moles  G_total = G_x_1 + G_x_2 + G_x_3 + G_x_4 + G_x_5 + G_x_6;/* n_x_1_gen += G_x_1 * dt * V_bat; // Accumulated number of moles for H2 (moles)n_x_2_gen += G_x_2 * dt * V_bat; // Accumulated number of moles for C2H4 (moles)n_x_3_gen += G_x_3 * dt * V_bat; // Accumulated number of moles for CH4 (moles)n_x_4_gen += G_x_4 * dt * V_bat; // Accumulated number of moles for CO (moles)n_x_5_gen += G_x_5 * dt * V_bat; // Accumulated number of moles for CO2 (moles)n_x_6_gen += G_x_6 * dt * V_bat; // Accumulated number of moles for O2 (moles)n_total_gen += G_total * dt * V_bat; // Accumulated number of moles for all species (moles) */Ân_x_1_gen += G_x_1 * V_bat; // Accumulated number of moles for H2 (moles/sec)n_x_2_gen += G_x_2 * V_bat; // Accumulated number of moles for C2H4 (moles/sec)n_x_3_gen += G_x_3 * V_bat; // Accumulated number of moles for CH4 (moles/sec)n_x_4_gen += G_x_4 * V_bat; // Accumulated number of moles for CO (moles/sec)n_x_5_gen += G_x_5 * V_bat; // Accumulated number of moles for CO2 (moles/sec)n_x_6_gen += G_x_6 * V_bat; // Accumulated number of moles for O2 (moles/sec)n_total_gen += G_total * V_bat; // Accumulated number of moles for all species (moles/sec)  // Calculations for the third submodel  P_avg = ((n_total * R_gas * T_avg) / V_void) + P_atm;V_void = V_void_init + ((n_exit_total/n_total) * d_void);gama = ((gama_H2 * n_x_1 * MW_H2) + (gama_C2H4 * n_x_2 * MW_C2H4) + (gama_CH4 * n_x_3 * MW_CH4) + (gama_CO * n_x_4 * MW_CO) + (gama_CO2 * n_x_5 * MW_CO2) + (gama_O2 * n_x_6 * MW_O2))/ ((n_x_1 * MW_H2) + (n_x_2 * MW_C2H4) + (n_x_3 * MW_CH4) + (n_x_4 * MW_CO) + (n_x_5 * MW_CO2) + (n_x_6 * MW_O2));rho_mix = ((n_x_1 * MW_H2) + (n_x_2 * MW_C2H4) + (n_x_3 * MW_CH4) + (n_x_4 * MW_CO) + (n_x_5 * MW_CO2) + (n_x_6 * MW_O2) / V_void);ÂÂif ((P_atm/P_avg) > pow(2 / (gama + 1), gama / (gama - 1))){Ma = sqrt((2 / (gama - 1)) * (pow(P_avg / P_atm, (gama - 1) / gama) - 1));}else {  Ma = 1.0;}Â// Function to compute the temperature and velocity at the orificeT2 = T_avg / (1.0 + ((gama - 1.0) / 2.0) * Ma * Ma);u2 = Ma * sqrt(gama * R_gas * T2);Âif (Ma<=1){P2 = P_atm;u3 = u2 *0.7;}else{P2 = P_avg / pow((1.0 + (gama - 1.0) / 2.0), (gama / (gama - 1)));u3 = 0.7 * (u2 - ((P3-P2)/rho_mix *u2));P3 = P_atm;}Ân_exit = (u3 * Area_valve * P2) / (R_gas * T2); // rate of ejected moles (moles /sec)n_exit_total = n_exit * dt; // number of ejected moles (moles)n_total = fabs(n_total_gen - n_exit_total);Â/*n_x_1_exit = (n_x_1_gen/n_total_gen) * n_exit_total;n_x_1 = n_x_1_gen - n_x_1_exit;Ân_x_2_exit = (n_x_2_gen/n_total_gen) * n_exit_total;n_x_2 = n_x_2_gen - n_x_2_exit;Ân_x_3_exit = (n_x_3_gen/n_total_gen) * n_exit_total;n_x_3 = n_x_3_gen - n_x_3_exit;Ân_x_4_exit = (n_x_4_gen/n_total_gen) * n_exit_total;n_x_4 = n_x_4_gen - n_x_4_exit;Ân_x_5_exit = (n_x_5_gen/n_total_gen) * n_exit_total;n_x_5 = n_x_5_gen - n_x_5_exit;Ân_x_6_exit = (n_x_6_gen/n_total_gen) * n_exit_total;n_x_6 = n_x_6_gen - n_x_6_exit;*/Ân_x_1_exit = (n_x_1_gen/n_total_gen) * n_exit; //(moles/sec)n_x_1 = n_x_1_gen - n_x_1_exit;m_x_1 = (n_x_1 * MW_H2)/ Area_valve //(g/m2 sec)Ân_x_2_exit = (n_x_2_gen/n_total_gen) * n_exit;n_x_2 = n_x_2_gen - n_x_2_exit;m_x_2 = (n_x_2 * MW_C2H4)/ Area_valve; //(g/m2 sec)Ân_x_3_exit = (n_x_3_gen/n_total_gen) * n_exit;n_x_3 = n_x_3_gen - n_x_3_exit;m_x_3 = (n_x_3 * MW_CH4)/ Area_valve; //(g/m2 sec)Ân_x_4_exit = (n_x_4_gen/n_total_gen) * n_exit;n_x_4 = n_x_4_gen - n_x_4_exit;m_x_4 = (n_x_4 * MW_CO)/ Area_valve; //(g/m2 sec)Ân_x_5_exit = (n_x_5_gen/n_total_gen) * n_exit_total;n_x_5 = n_x_5_gen - n_x_5_exit;m_x_5 = (n_x_5 * MW_CO2)/ Area_valve; //(g/m2 sec)Ân_x_6_exit = (n_x_6_gen/n_total_gen) * n_exit_total;n_x_6 = n_x_6_gen - n_x_6_exit;m_x_6 = (n_x_6 * MW_O2)/ Area_valve; //(g/m2 sec)Â//UDMS for measured quantities (Stores)  C_UDMI(c, t, 13) = P_avg; // UDM[13] for internal average pressure within the batteryC_UDMI(c, t, 14) = Ma; // UDM[14] for internal Mach numberC_UDMI(c, t, 15) = n_total; // UDM[15] for internal average pressure within the batteryC_UDMI(c, t, 16) = T2; // UDM[16] for temperature at the orificeC_UDMI(c, t, 17) = u2; // UDM[17] for velocity at the orificeÂ}// Function to compute the rate of change of C_chem (dC_chem/dt)if (T_avg > T_chem && T_avg <= T_tr && C_chem_old >= 0 && C_chem_old <= 1) {  dC_chem_dt = (Cp / H_chem) * A * rho * V_bat * pow((T_avg / T_ref), b);}else if (T_avg > T_tr && C_chem_old >= 0 && C_chem_old <= 1) {  dC_chem_dt = C_chem_max;}else {  dC_chem_dt = 0.0;}printf("dC_chem_dt = %e", dC_chem_dt);// Update the chemical energy concentrationC_chem = C_chem_old - (dC_chem_dt * dt);Â// Function to compute volumetric chemical heat generation rate (q_chem)q_chem = (1.0/V_bat) * H_chem * dC_chem_dt;C_UDMI(c, t, 0) = C_chem;printf("C_chem = %e", C_chem);// Function to compute short-circuit reaction rate (dC_elec/dt)if (T_avg > T_tr && C_elec_old >= 0 && C_elec_old <= 1) {  dC_elec_dt = C_elec_max;}else {  dC_elec_dt = 0.0;}// Update the electrical energy concentrationC_elec = C_elec_old - (dC_elec_dt * dt);// Function to compute volumetric electric heat generation rate (q_elec)q_elec = (1.0/V_bat) * H_sc * dC_elec_dt;C_UDMI(c, t, 1) = C_elec;printf("C_elec = %e", C_elec);// Compute heat generation ratesqv = q_chem + q_elec; // Total heat generation rate (W/m³)ds[eqn]=0;printf("q_chem = %g q_elec = %g\n", q_chem, q_elec);return qv; // Return total heat source term for Fluent}Â// Define profiles for the boundry conditionÂ//Define H2 ProfileDEFINE_PROFILE(mass_flux_H2, t, i){  real x[ND_ND]; /* this will hold the position vector */  real y;  face_t f;  begin_f_loop(f, t)  {    if (G_total > 0)    {      F_CENTROID(x, f, t);      y = x[1];      F_PROFILE(f, t, i) = m_x_1;    }    else    {      F_PROFILE(f, t, i) = 0.0;    }   }  end_f_loop(f, t)}//Define C2H4 ProfileDEFINE_PROFILE(mass_flux_C2H4, t, i){  real x[ND_ND]; /* this will hold the position vector */  real y;  face_t f;  begin_f_loop(f, t)  {    if (G_total > 0)    {      F_CENTROID(x, f, t);      y = x[1];      F_PROFILE(f, t, i) = m_x_2;    }    else    {      F_PROFILE(f, t, i) = 0.0;    }   }  end_f_loop(f, t)}//Define CH4 ProfileDEFINE_PROFILE(mass_flux_CH4, t, i){  real x[ND_ND]; /* this will hold the position vector */  real y;  face_t f;  begin_f_loop(f, t)  {    if (G_total > 0)    {      F_CENTROID(x, f, t);      y = x[1];      F_PROFILE(f, t, i) = m_x_3;    }    else    {      F_PROFILE(f, t, i) = 0.0;    }   }  end_f_loop(f, t)}Â//Define CO ProfileDEFINE_PROFILE(mass_flux_CO, t, i){  real x[ND_ND]; /* this will hold the position vector */  real y;  face_t f;  begin_f_loop(f, t)  {    if (G_total > 0)    {      F_CENTROID(x, f, t);      y = x[1];      F_PROFILE(f, t, i) = m_x_4;    }    else    {      F_PROFILE(f, t, i) = 0.0;    }   }  end_f_loop(f, t)}Â//Define CO2 ProfileDEFINE_PROFILE(mass_flux_CO2, t, i){  real x[ND_ND]; /* this will hold the position vector */  real y;  face_t f;  begin_f_loop(f, t)  {    if (G_total > 0)    {      F_CENTROID(x, f, t);      y = x[1];      F_PROFILE(f, t, i) = m_x_5;    }    else    {      F_PROFILE(f, t, i) = 0.0;    }   }  end_f_loop(f, t)}Â//Define O2 ProfileDEFINE_PROFILE(mass_flux_O2, t, i){  real x[ND_ND]; /* this will hold the position vector */  real y;  face_t f;  begin_f_loop(f, t)  {    if (G_total > 0)    {      F_CENTROID(x, f, t);      y = x[1];      F_PROFILE(f, t, i) = m_x_6;    }    else    {      F_PROFILE(f, t, i) = 0.0;    }   }  end_f_loop(f, t)}Â//Define T2 ProfileDEFINE_PROFILE(inlet_temperature, t, i){  real x[ND_ND]; /* this will hold the position vector */  real y;  face_t f;  begin_f_loop(f, t)  {    if (G_total > 0)    {      F_CENTROID(x, f, t);      y = x[1];      F_PROFILE(f, t, i) = T2;    }    else    {      F_PROFILE(f, t, i) = 0.0;    }   }  end_f_loop(f, t)}Â//Define U3 ProfileDEFINE_PROFILE(inlet_velocity, t, i){  real x[ND_ND]; /* this will hold the position vector */  real y;  face_t f;  begin_f_loop(f, t)  {    if (G_total > 0)    {      F_CENTROID(x, f, t);      y = x[1];      F_PROFILE(f, t, i) = u3;    }    else    {      F_PROFILE(f, t, i) = 0.0;    }   }  end_f_loop(f, t)} -
August 4, 2025 at 2:30 pm
Rob
Forum ModeratorAssuming you initialise OK, what values are the UDMs showing? Are these sensible? Have you remembered that values from Fluent to the UDF and UDF to Fluent are SI (K, Pa, m, kg etc).Â
-
August 4, 2025 at 3:13 pm
eng_m_m.abd89
SubscriberMost of the UDMS are used to save the chemical concentrations in unit of (mol/m3) the remaining are just to draw them in a graph.
I assume the issue could be in the boundary condition, as I have a wall that I use to identify the mass flux profiles.
-
August 4, 2025 at 4:10 pm
Rob
Forum ModeratorPossibly, I've not read the code (and won't be). Check units and boundary settings. Are you adding mass along with species?Â
-
- You must be logged in to reply to this topic.
-
3597
-
1258
-
1107
-
1068
-
953
© 2025 Copyright ANSYS, Inc. All rights reserved.