-
-
March 19, 2022 at 5:08 pm
hbilal1076
SubscriberDear 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~1v212fluentfluent21.2.0win642D_nodef1 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 , species %", T);
P = C_P(c, ct); /* Cell Presdsure */
if (c == 400)
Message("Press is %g , ", 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 , ", Ysoot);
bNuc = C_UDSI(c, ct, 1); /* Calling soot number density from n_sourceterm scalar */
if (c == 400)
Message("bNuc is %g , ", 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 , ", dNdT);
/**********End of Calculations**************************************/
return (dNdT / N_norm);
}
March 21, 2022 at 11:40 amRob
Ansys EmployeeI'm not sure why you're using the IF(c==400) lines, otherwise I'm not checking the rest of the code.
March 21, 2022 at 12:30 pmKarthik R
AdministratorHello:
To add to Rob's thought, please use 'fprintf' or 'message' statements to make sure that your code is running as intended. This would be the best way to identify the root cause of this issue and debug it. You should be able to find the syntax for these commands in the Fluent customization manual.
Karthik
March 23, 2022 at 5:19 amhbilal1076
SubscriberDear Prof. Rob and Kremella Thank you very much for your reply.
The error process is changes now, when I load UDF and click on built it worked and in console "done building targets" appear, but when I click on compile, in the console the following error occurred.
===============Message from the Cortex Process================================
Compute processes interrupted. Processing can be resumed.
=============================================================================
Error: Error code: 126\n
For your convenience I attached the screenshot.
Please help. TIA
March 24, 2022 at 4:15 pmRob
Ansys EmployeeAssuming you've added enough UDS space I'm not sure. Compile/Build will flag if the code is grammatically correct. Load just makes it available to the solver; you then need to hook up the terms. If it's then failing it's something you've written. Rather than using the source term, can you put the output into a UDM and return a fixed value to test the code?
Viewing 4 reply threads- You must be logged in to reply to this topic.
Ansys Innovation SpaceEarth Rescue – An Ansys Online Series
The climate crisis is here. But so is the human ingenuity to fight it. Earth Rescue reveals what visionary companies are doing today to engineer radical new ideas in the fight against climate change. Click here to watch the first episode.
Ansys Blog
Subscribe to the Ansys Blog to get great new content about the power of simulation delivered right to your email on a weekly basis. With content from Ansys experts, partners and customers you will learn about product development advances, thought leadership and trends and tips to better use Ansys tools. Sign up here.
Trending discussions- Suppress Fluent to open with GUI while performing in journal file
- Floating point exception in Fluent
- What are the differences between CFX and Fluent?
- Heat transfer coefficient
- Getting graph and tabular data from result in workbench mechanical
- The solver failed with a non-zero exit code of : 2
- Difference between K-epsilon and K-omega Turbulence Model
- Time Step Size and Courant Number
- Mesh Interfaces in ANSYS FLUENT
- error in cfd post
Top Contributors-
2656
-
2120
-
1345
-
1118
-
461
Top Rated Tags© 2023 Copyright ANSYS, Inc. All rights reserved.
Ansys does not support the usage of unauthorized Ansys software. Please visit www.ansys.com to obtain an official distribution.
-