-
-
August 23, 2021 at 2:36 am
waqas12345
SubscriberHello everyone. Please find below the specific heat UDF which I intend to compile in 2021R1 academic version of fluent. I receive the following error message shown in the image.Â
ji.c
....srcji.c(81) : error C2143: syntax error : missing ')' before 'constant'
....srcji.c(81) : error C2143: syntax error : missing '{' before 'constant'
....srcji.c(81) : error C2059: syntax error : 'constant'
....srcji.c(81) : error C2059: syntax error : ')'
NMAKE : fatal error U1077: '"C:Program Files (x86)Microsoft Visual Studio 12.0VCBINx86_amd64cl.EXE"' : return code '0x2'
Stop.
Done.
Line 81 is the very first line of my UDF. DEFINE_SPECIFIC_HEAT(my_udf_sp,T,Tref,h,yi), also mentioned in bold letter.
DEFINE_SPECIFIC_HEAT(my_udf_sp,T,Tref,h,yi)
{
 real Cp;
real gamma;
if (T >= 298.0 && T <= 855.0)
{
gamma = 0;
}
else if (T > 855.0 && T < 925.0)
{
gamma = (T - 855.0) / (925.0 - 855.0);
}
else if (T >= 925.0 && T<=2790)
{
gamma = 1.0;
}
else
{
gamma = 0;
}
if (T >= 298.0 && T <= 855.0)
{
Cp = 900.0 + 0.3*(T - 298.0);
}
else if (T > 855.0 && T < 925.0)
{
Cp = (1 - gamma)*(900.0 + 0.3*(T - 298.0)) + gamma*1170.0;
}
else if (T >=925.0)
{
Cp = 1170.0;
}
*h = Cp*(T - Tref);
return Cp;
}
Can someone please help me in identifying the problem.?
Thank you for your time and support.
August 23, 2021 at 10:36 amRob
Forum ModeratorCheck lines 75-80 too, it may be you've missed a bracket terminating the previous block of text. If you save the file as .c in Notepad++ (for example) the editor is good for working out which bracket pairs are closed.
August 23, 2021 at 11:11 amDrAmine
Ansys EmployeeUse good Editors with Syntax Highlighting to avoid missing brackets. I won't use any UDF here you can just rely on NASA Polynomials for Cp or piecewise linear profile.
August 23, 2021 at 10:08 pmwaqas12345
SubscriberThanx Rob and Dr Amine.
I tried to change the location specific heat UDF. I even tried to compile it alone but the console always pointed towards the line containing the DEFINE_SPECIFIC_HEAT
I will also try with NASA polynomial but I am not understanding why this error occurs. My fluent version is 2021R1 academic and I am using VS 2013. Up till now, all my UDFs are working fine. Only this is creating problem in compiling.
August 23, 2021 at 10:08 pmAugust 24, 2021 at 9:59 amRob
Forum ModeratorDid you copy the line from the manual using CTRL+C or did you type it in? Check for white space characters if it's the former.
August 24, 2021 at 11:21 amDrAmine
Ansys EmployeeIn Editor display Tabs and White Spaces and remove unnecessary.
August 28, 2021 at 12:24 pmwaqas12345
SubscriberProblem solved as advised by both of you. Thank you
Viewing 7 reply threads- The topic ‘Problem in compiling specific heat UDF’ is closed to new replies.
Innovation SpaceTrending discussionsTop Contributors-
5874
-
1906
-
1420
-
1306
-
1021
Top Rated Tags© 2026 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.
-
Ansys Assistant will be unavailable on the Learning Forum starting January 30. An upgraded version is coming soon. We apologize for any inconvenience and appreciate your patience. Stay tuned for updates.
