Dear Concern,
In Ansys Fluent, when I compile and load the UDF file, and also in the Cell zone conditions>Fluid I added/enabled the source term and uploaded the UDF file and even initialize but when I click on calculate, after 5 second the console window get terminated/crashed/disappeared.
Before getting crashed I see this below error
999999: mpt_accept: error: accept failed: no such file or directory
999999: mpt_accept: error: accept failed: no such file or directory
999999: mpt_accept: error: accept failed: no such file or directory
999999: mpt_accept: error: accept failed: no such file or directory
----error analysis-----
(0-1) on DESKTOP-145MM28
C: \ PROGRA ~1 \ANSYSI~1 \ ANSYSS~1\v212\fluent\fluent21.2.0\win64\2D_node\f1 m.exepi2021 ended prematurely and may have crashed exit code 2
----error analysis-----
I tried the other UDF sample model from fluent manual and it work well and get calculated.
Kindly explain the possible mistake or the modification that I need to do in my attached UDF.
#include "udf.h"
#include "pdf_props.h"
#include "pdf_table.h"
#include "mem.h"
#include "materials.h"
/*********Constant Declarations*************************************/
#define c_alph 54.0 /* Units: 1/s */
#define N_avog 6.022045e+26 /* 1/kmol */
#define c_bet 1.0 /* no units */
#define rho_soot 1800.0 /* kg/m3 */
#define T_alph 21000.0 /* activation temperature of soot inception in K */
#define N_norm 1.0e+15 /* Moss-Brookes model: normalizing parameter */
#define l 1.0 /* l indicates the particle nucleation sensitivity to Pressure: defined as 1.0 for now */
#define PI 3.14159265358979324 /* Pi as a constant...alternatively pi=4.0*atan(1.0) */
#define SpNo 19 /* The number of species in the mechanism file: should be adjusted according to the mechanism */
#define Species 7 /* This is the index for the species of interest (CO2 in this case) */
/*********End Constant Declarations*********************************/
DEFINE_SOURCE(n_sourceterm, c, ct, dS, eqn)
{
/*********Variable Declarations*************************************/
double dNdT, dp, X_CO2, T, P, rho_cell, M, N, Ysoot, bNuc, R;
double x[SpNo], y[SpNo]; /* x is the array for species mole fractions and y is the array for mass fractions */
int id_co2;
/*********End Variable Declarations*********************************/
/*********Variable Assignments**************************************/
Material *mat = THREAD_MATERIAL(ct);
id_co2 = mixture_specie_index(mat, "co2");
Pdf_XY(c, ct, x, y); /* Calling the species mole and mass fractions for this cell */
X_CO2 = x[id_co2]; /* arbitrarily defined for now */
T = C_T(c, ct); /* Temperature at the cell */
if (c == 400)
Message("Temp is %g\n, species %", T);
P = C_P(c, ct); /* Cell Presdsure */
if (c == 400)
Message("Press is %g\n, ", P);
rho_cell = C_R(c, ct); /* Cell average Density */
R = UNIVERSAL_GAS_CONSTANT; /* Universal gas constant is called with the built-in Fluent Macro */
Ysoot = C_UDSI(c, ct, 0); /* Calling soot mass fraction from m_sourceterm scalar */
if (c == 400)
Message("Ysoot is %g\n, ", Ysoot);
bNuc = C_UDSI(c, ct, 1); /* Calling soot number density from n_sourceterm scalar */
if (c == 400)
Message("bNuc is %g\n, ", bNuc);
/**********End Variable Assignments*********************************/
/**********Start Calculations************************************** */
M = rho_cell * Ysoot;
N = bNuc * rho_cell * N_norm;
dp = pow(((6.0 * M)/(PI * N * rho_soot)), (1.0/3.0));
dNdT = c_alph * N_avog * pow(((X_CO2 * P)/(R * T)), l) * exp(-1.0 * T_alph / T) - c_bet * pow(((24.0 * R * T) / ( rho_soot * N_avog)), 0.5) * sqrt(dp) * pow(N, 2);
if (c == 400)
Message("dNdT is %g\n, ", dNdT);
/**********End of Calculations**************************************/
return (dNdT / N_norm);
}