-
-
July 29, 2019 at 6:50 am
Azim07
SubscriberHere i have a UDF which Shows the undeclared variable error in line 6. How can i remove this?
#include "udf.h"
DEFINE_PROPERTY(cell_density,c,t)
{
real rho;
real T = C_T(c,t);
rho = 885/(0.0008(temp-321.35)+1);
C_UDMI(c,t,0) = rho;
return rho;
} -
July 29, 2019 at 1:59 pm
Rob
Ansys EmployeeI find deleting the line to solve many problems. Read the error carefully, and tell me which variable is undefined.
-
July 29, 2019 at 2:24 pm
rachels1001
SubscriberI may be wrong, but is the "temp" variable defined anywhere?
-
July 30, 2019 at 4:43 am
Azim07
SubscriberI just need to define the density in the way of following Equation
rho = 885/(0.0008*(t-321.35)+1)
How can i easily enter it ?
-
July 30, 2019 at 11:51 am
rachels1001
Subscriberby using the macro C_T, you are finding the temperature for the cell that you are passing into the UDF, and you are defining this temperature as T. If this is the temperature that you want to evaluate density by, the line should read
"rho = 885/(0.008*(T-321.35)+1)"
not "rho = 885/(0.008*(Temp-321.35)+1)"
-
July 30, 2019 at 2:33 pm
Rob
Ansys Employeecvelikonja: correct. T is defined, temp is not so will cause an error when used in the code.
Note, UDFs may be case sensitive so always consider this too. T is also a slightly dangerous letter to use when you're using t for thread in Line 2.
-
July 31, 2019 at 9:34 am
Azim07
SubscriberThank you very much Gentleman......
I am getting Floating Error in the following UDF of viscosity......
#include "udf.h"
DEFINE_PROPERTY(cell_viscosity,c,t)
{
real mu;
real temp=C_T(c,t);
mu =(0.00727)+((((-8.6022)+(1871.3/temp)+(0.0152*temp)-(0.000012043*temp*temp))-(0.00727))/1+(exp((10/343-temp)*(temp-321.35))));
return mu;
}
How can i remove this?
-
July 31, 2019 at 10:18 am
Rob
Ansys EmployeeI doubt the floating point is in the UDF: it'll be the value produced by the UDF. Plot the value of your function against temperature and see what it produces.
-
- You must be logged in to reply to this topic.

Earth 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.
- 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
-
2656
-
2120
-
1345
-
1118
-
461
© 2023 Copyright ANSYS, Inc. All rights reserved.