TAGGED: ansys-fluent, multiphase, udf, udf-fluent
-
-
October 25, 2021 at 12:17 pmisaps1860Subscriber
I have an UDF Code in which the the velocity and the mass fraction should be read in and give out a value of a table which is coded in. Example of the code for the velocity and mass frac:
real xinput = C_U(c,t);
real yinput =C_YI(c,t,i);
For the velocity the code works and the code works fine if I put a value for C_YI(c,t,i) --> real yinput=0,19.
But if I let C_YI(c,t.i) in the code, I get an error code 999999 and fluent crashes...
Is there an additionally thing for the C_YI(c,t,i) macro I have to pay attention or what can be the problem?
October 26, 2021 at 7:27 amaitor.amatriainSubscriberHave you defined the value of the species index (i)?
October 26, 2021 at 7:56 amisaps1860SubscriberNo I didn┬┤t define the value of the species index (i). Is this necessary? In the examples I have read there were no closer executions about i except the int i; -line
October 26, 2021 at 8:41 amaitor.amatriainSubscriberYes, you need to specify the species index
October 26, 2021 at 9:20 amisaps1860SubscriberThank you very much, is there an example for the specifying of the species index?
October 26, 2021 at 10:39 amaitor.amatriainSubscriberAs far as I am concerned, starting from 0, the order is the same as the list appearing in the "Mixture" section in the "Materials" panel.
October 26, 2021 at 11:00 amisaps1860SubscriberThanks for the answer but the problem still exists...Fluent also crashes with C_YI(c,t,0), C_YI(c,t,1) or other number values
Cannot understand why with C_U(c,t) everything is fine and with C_YI(c,t,i) theres a problem. Scheme is the same (except the i factor)
October 26, 2021 at 12:46 pmaitor.amatriainSubscriberTry to use C_YI in a simpler UDF (for example, you could define it as a post-processing variable by means of DEFINE_ADJUST macro).
October 26, 2021 at 1:01 pmRobForum ModeratorAs says C_YI(c,t,0) ought to pick up the first species in the mixture list. Please can you post the exact error message in it's entirety?
October 27, 2021 at 9:23 amisaps1860SubscriberThe exact error message in the console window is:
"999999: mpt_accept: error: accept failed: No error"
and this message several times before Fluent crashes and closes
October 27, 2021 at 10:00 amRobForum ModeratorThat's a parallel code warning. Is there anything just above that?
October 27, 2021 at 10:22 amisaps1860SubscriberYes there┬┤s another error message above but because Fluent closes automatically after initializing or running the code, I couldn┬┤t get it. I will try to screenshot it on console if I will be fast enough :D
October 27, 2021 at 10:29 amisaps1860SubscriberNode 0: Process 19356: Received signal. SIGSEV.
Is the first output in console after initializing or running
October 27, 2021 at 1:37 pmaitor.amatriainSubscriberCould you please shows us the UDF (code)?
October 27, 2021 at 1:40 pmRobForum ModeratorSo the value doesn't exist and is then called. Can you initialise and then hook up the code? You're defining real yinput =C_YI(c,t,i); but depending on the order things are called C_YI(c,t,i) has no value until it's initialised.
October 27, 2021 at 4:40 pmisaps1860Subscriber#include "udf.h"
#include
#include
DEFINE_SOURCE(source, c, t, dS, eqn)
{
Thread *tm=THREAD_SUPER_THREAD(t);
Thread **pt = THREAD_SUB_THREADS(tm);
Thread *tp = pt[0];
Thread *ts = pt[1];
Thread *sec;
real source;
int i;
typedef struct
{
double xCoordinate;
double yCoordinate;
double zCoordinate;
} Point;
int data[100];
int number_of_points = 25;
Point points[25];
int main();
{
Point test;
Point test2 ={1, 2, 3};
test.xCoordinate = 1;
points[0].xCoordinate = 0; points[0].yCoordinate = 0; points[0].zCoordinate = 0.0978;
points[1].xCoordinate = 0; points[1].yCoordinate = 0.10; points[1].zCoordinate = 0.068;
points[2].xCoordinate = 0; points[2].yCoordinate = 0.20; points[2].zCoordinate = 0.0532;
points[3].xCoordinate = 0; points[3].yCoordinate = 0.30; points[3].zCoordinate = 0.0132;
points[4].xCoordinate = 0; points[4].yCoordinate = 0.40; points[4].zCoordinate = 0.0324;
points[5].xCoordinate = 0.5; points[5].yCoordinate = 0; points[5].zCoordinate = 0.0244;
points[6].xCoordinate = 0.5; points[6].yCoordinate = 0.10; points[6].zCoordinate = 0.0166;
points[7].xCoordinate = 0.5; points[7].yCoordinate = 0.20; points[7].zCoordinate = 0.011;
points[8].xCoordinate = 0.5; points[8].yCoordinate = 0.30; points[8].zCoordinate = 0.05;
points[9].xCoordinate = 0.5; points[9].yCoordinate = 0.40; points[9].zCoordinate = 0.0092;
points[10].xCoordinate = 1; points[10].yCoordinate = 0; points[10].zCoordinate = 0.0264;
points[11].xCoordinate = 1; points[11].yCoordinate = 0.10; points[11].zCoordinate = 0.0148;
points[12].xCoordinate = 1; points[12].yCoordinate = 0.20; points[12].zCoordinate = 0.011;
points[13].xCoordinate = 1; points[13].yCoordinate = 0.30; points[13].zCoordinate = 0.0116;
points[14].xCoordinate = 1; points[14].yCoordinate = 0.40; points[14].zCoordinate = 0.0444;
points[15].xCoordinate = 1.5; points[15].yCoordinate = 0; points[15].zCoordinate = 0.0256;
points[16].xCoordinate = 1.5; points[16].yCoordinate = 0.10; points[16].zCoordinate = 0.0132;
points[17].xCoordinate = 1.5; points[17].yCoordinate = 0.20; points[17].zCoordinate = 0.0094;
points[18].xCoordinate = 1.5; points[18].yCoordinate = 0.30; points[18].zCoordinate = 0.0092;
points[19].xCoordinate = 1.5; points[19].yCoordinate = 0.40; points[19].zCoordinate = 0.258;
points[20].xCoordinate = 2; points[20].yCoordinate = 0; points[20].zCoordinate = 0.027;
points[21].xCoordinate = 2; points[21].yCoordinate = 0.10; points[21].zCoordinate = 0.014;
points[22].xCoordinate = 2; points[22].yCoordinate = 0.20; points[22].zCoordinate = 0.0106;
points[23].xCoordinate = 2; points[23].yCoordinate = 0.30; points[23].zCoordinate = 0.0122;
points[24].xCoordinate = 2; points[24].yCoordinate = 0.40; points[24].zCoordinate = 0.5102;
real xInput = C_U(c,tp);
real yInput = C_YI(c,ts,i);
printf("x = %.3f, y = %.3f", xInput, yInput);
Point neighbors[4];
neighbors[0] = points[0];
neighbors[1] = points[0];
neighbors[2] = points[0];
neighbors[3] = points[0];
for (int g = 0; g < number_of_points; g++)
{
Point currentPoint = points[g];
if (currentPoint.xCoordinate == floor(xInput))
{
if (currentPoint.yCoordinate == floor(yInput))
{
neighbors[0] = currentPoint;
}
if (currentPoint.yCoordinate == ceil(yInput))
{
neighbors[1] = currentPoint;
}
}
if (currentPoint.xCoordinate == ceil(xInput))
{
if (currentPoint.yCoordinate == floor(yInput))
{
neighbors[2] = currentPoint;
}
if (currentPoint.yCoordinate == ceil(yInput))
{
neighbors[3] = currentPoint;
}
}
if (currentPoint.xCoordinate <= xInput)
{
if (currentPoint.yCoordinate <= yInput)
{
if (xInput - currentPoint.xCoordinate <= xInput - neighbors[0].xCoordinate)
{
if (yInput - currentPoint.yCoordinate <= yInput - neighbors[0].yCoordinate)
{
neighbors[0] = currentPoint;
}
}
}
}
if (currentPoint.xCoordinate >= xInput)
{
if (currentPoint.yCoordinate <= yInput)
{
if (neighbors[2].xCoordinate < xInput)
{
neighbors[2] = currentPoint;
}
if ((currentPoint.xCoordinate - xInput <= neighbors[2].xCoordinate - xInput))
{
if (yInput - currentPoint.yCoordinate <= yInput - neighbors[2].yCoordinate)
{
neighbors[2] = currentPoint;
}
}
}
}
if (currentPoint.xCoordinate <= xInput)
{
if (currentPoint.yCoordinate >= yInput)
{
if ((xInput - currentPoint.xCoordinate <= xInput - neighbors[1].xCoordinate))
{
if (neighbors[1].yCoordinate < yInput)
{
neighbors[1] = currentPoint;
}
if (currentPoint.yCoordinate - yInput <= neighbors[1].yCoordinate - yInput )
{
neighbors[1] = currentPoint;
}
}
}
}
if (currentPoint.xCoordinate >= xInput)
{
if (currentPoint.yCoordinate >= yInput)
{
if (neighbors[3].xCoordinate < xInput)
{
neighbors[3] = currentPoint;
}
if ((currentPoint.xCoordinate - xInput <= neighbors[3].xCoordinate - xInput))
{
if (neighbors[3].yCoordinate < yInput)
{
neighbors[3] = currentPoint;
}
if ( currentPoint.yCoordinate - yInput <= neighbors[3].yCoordinate - yInput)
{
neighbors[3] = currentPoint;
}
}
}
}
}
double leftVertex = neighbors[0].zCoordinate + (neighbors[1].zCoordinate - neighbors[0].zCoordinate) / (neighbors[1].yCoordinate - neighbors[0].yCoordinate) * (yInput - neighbors[0].yCoordinate);
double rightVertex = neighbors[2].zCoordinate + (neighbors[3].zCoordinate - neighbors[2].zCoordinate) / (neighbors[3].yCoordinate - neighbors[2].yCoordinate) * (yInput - neighbors[2].yCoordinate);
double result = leftVertex + (rightVertex - leftVertex) / (neighbors[2].xCoordinate - neighbors[0].xCoordinate) * (xInput - neighbors[0].xCoordinate);
printf("result : %f\n", result);
source = result;
dS[eqn] = 0;
return source;
}
}
October 27, 2021 at 4:42 pmisaps1860SubscriberThank you for the note, that this error means a value is missing. But the result by starting it after the initialisation is the same
October 28, 2021 at 7:11 amaitor.amatriainSubscriberIt seems that the value of the integer "i" is undefined
October 28, 2021 at 7:16 amisaps1860SubscriberYes, in the sended code there is no definition of "i". But I┬┤ve also tried with the definition of 0 and 1 and the code crashes
--> int i = 0; or also
--> C_YI(c,ts,0)
October 28, 2021 at 11:00 amaitor.amatriainSubscriberBoth species are present in both phase, right? If yes, either the second argument is wrong, or the macroC_YI is not valid for multiphase flows. I am not an expert in advanced multiphase macros, so I cannot help you.
Viewing 19 reply threads- The topic ‘Problem with C_YI(c,t,i)’ is closed to new replies.
Ansys Innovation SpaceTrending discussions- Non-Intersected faces found for matching interface periodic-walls
- Unburnt Hydrocarbons contour in ANSYS FORTE for sector mesh
- Fluent fails with Intel MPI protocol on 2 nodes
- Help: About the expression of turbulent viscosity in Realizable k-e model
- 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”
Top Contributors-
1406
-
599
-
591
-
555
-
366
Top Rated Tags© 2025 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.
-