CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

UDF and window console termination error/problem

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 19, 2022, 13:05
Post UDF and window console termination error/problem
  #1
New Member
 
bilal
Join Date: Oct 2021
Location: pakistan
Posts: 27
Rep Power: 5
hbilal1076 is on a distinguished road
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);

}
hbilal1076 is offline   Reply With Quote

Old   March 31, 2022, 23:06
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
Did you define and allocate memory for scalar?
Code:
C_UDSI(c, ct, 0)
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Replicating Scalable Wall Function with a UDF yousefaz FLUENT 0 August 4, 2017 03:30
Can I change the variable in UDF via Fluent console or window without compiling? swtbkim FLUENT 0 July 12, 2017 23:15
compiling udf at window Nt(64BIT) noa FLUENT 3 July 30, 2014 00:01
Ansys Fluent 13.0 UDF compilation problem in Window XP (32 bit) Yogini Fluent UDF and Scheme Programming 7 October 3, 2012 08:24
udf and graphic window mohsen zendehbad FLUENT 0 December 19, 2009 00:46


All times are GMT -4. The time now is 17:38.