-
-
December 5, 2019 at 1:32 am
atulsbhat
SubscriberThis UDF didnt Get Any Error message but its not running, Can someone correct the UDF BELOW? {Suggest Changes Required}
Should I add anything Related To Enthalpy or Some UDM MACRO like C_UDMI(c,t,0) = cp
DEFINE_SPECIFIC_HEAT(cell_SpecificHeat, T, Tref, h, yi)
{ Â
real T = C_T(c, t);
real cp;
if (500< T <550)
{
cp = (0.63464529*pow(T,2))-(356.13993666*T)+(61767.53243895);
}
else if (550< T <600.10)
{
cp = (0.23484528*pow(T,2))-(250.13953470*T)+(71466.09249852);
}
else if (600.10< T < 625.15)
{
cp = (1.58260392*pow(T,2))-(1873.17493506*T)+(560143.47661247);
}
else if (625.15< T <640)
{
cp = (16.13751699*pow(T,2))-(20137.03882161*T)+(6289718.12316515);
}
else
{
cp = 13000;
}
return cp;
}
Â
-
December 5, 2019 at 6:49 am
Amine Ben Hadj Ali
Ansys EmployeeJust likewise polynomial function in Fluent. Moreover the UDF is wrong. Check the specific macro in the docu. -
December 5, 2019 at 1:23 pm
-
December 5, 2019 at 4:07 pm
Amine Ben Hadj Ali
Ansys EmployeeI was specific that is why I referred to the manual. You forgot the most important line telling Fluent how to deal with enthalpy pointer. I still see no requirement for UDF as same functionality already in Fluent. -
December 5, 2019 at 5:45 pm
atulsbhat
SubscriberIs the UDF okay now ? Where to Add Tref ?Â
DEFINE_SPECIFIC_HEAT(cell_SpecificHeat, T, Tref, h, yi)
{Â Â
real T = C_T(c, t);
real cp;
if (500< T <550)
{
cp = (0.63464529*pow(T,2))-(356.13993666*T)+(61767.53243895);
*h = cp*(T-Tref);
}
else if (550< T <600.10)
{
cp = (0.23484528*pow(T,2))-(250.13953470*T)+(71466.09249852);
*h = cp*(T-Tref);
}
else if (600.10< T < 625.15)
{
cp = (1.58260392*pow(T,2))-(1873.17493506*T)+(560143.47661247);
*h = cp*(T-Tref);
}
else if (625.15< T <640)
{
cp = (16.13751699*pow(T,2))-(20137.03882161*T)+(6289718.12316515);
*h = cp*(T-Tref);
}
else
{
cp = 13000;
*h = cp*(T-Tref);
}
return cp;
}
Â
OR
Â
DEFINE_SPECIFIC_HEAT(cell_SpecificHeat, T, Tref, h, yi)
{Â Â
real T = C_T(c, t);
real cp;
if (500< T <550)
{
cp = (0.63464529*pow(T,2))-(356.13993666*T)+(61767.53243895);
}
else if (550< T <600.10)
{
cp = (0.23484528*pow(T,2))-(250.13953470*T)+(71466.09249852);
}
else if (600.10< T < 625.15)
{
cp = (1.58260392*pow(T,2))-(1873.17493506*T)+(560143.47661247);
}
else if (625.15< T <640)
{
cp = (16.13751699*pow(T,2))-(20137.03882161*T)+(6289718.12316515);
}
else
{
cp = 13000;
}
*h = cp*(T-Tref);
return cp;
Â
}
Â
I have Rational Polynomials too, So to add them i need UDF.
-
December 5, 2019 at 5:57 pm
Amine Ben Hadj Ali
Ansys EmployeeTry the second one seems fine. If it is not working start debugging. -
December 5, 2019 at 6:28 pm
atulsbhat
SubscriberThank You Sir,
I have a few Questions More,
1. When should we Set UDM Macros (UDM MACRO like C_UDMI(c,t,0) = cp)?
2. Where to Set Tref , Should We Give any Any Value to It?
3. Is The UDF independent of the Number of Cells (Total Number of Elements/nodes) ?
4. Will Units of Returned by UDF are Same As Default Units ?
Thank You Very Much In Advance
These Questions answer all my doubts..
-
December 6, 2019 at 9:04 am
Rob
Forum Moderator1) When you need it. Why do you need to save the value?
2) What does the manual say about Tref?
3) Pretty much, the UDF is attached to the whole domain (In most cases) and set via the material properties.
4) UDFs use the default SI units: if you've not changed anything they'll be the same.
-
December 14, 2022 at 10:21 am
pratheeba.chandanagarajan
SubscriberÂ
Hi,
I am trying to get UDF for solid (cordierite) specific heat as a function of temperature.
I made the following UDF:
DEFINE_SPECIFIC_HEAT(cell_specific_heat, T, Tref, h, yi)
{Â real T = C_T(c,t);
/* Units of Cp_Porous is in J/kg/K */
  real Cp_porous = 1.071 + 1.56e-4*T – 3.435e4/(T*T);
*h = Cp_porous*(T-Tref);
 return Cp_porous ;
}ReactionKineticsImplicitV2.c(268,8): error: redefinition of ‘T'
real T = C_T(c,t);
^
ReactionKineticsImplicitV2.c(265,42): note: previous definition is here
DEFINE_SPECIFIC_HEAT(cell_specific_heat, T, Tref, h, yi)
^
ReactionKineticsImplicitV2.c(268,18): error: use of undeclared identifier ‘t'
real T = C_T(c,t);
^
ReactionKineticsImplicitV2.c(268,16): error: use of undeclared identifier ‘c'
real T = C_T(c,t);
Â
Can you help me to resolve these errors?
2. The Polynomial is Cp = a + BT + C/(T^2). Can the built-in polynomial handle this equation?
Â
Thank you so much.
Pratheeba
Â
Â
-
- The topic ‘How To write a Correct UDF (FLUENT) for Specific heat as Function of Temperature for Polynomials ?’ is closed to new replies.
-
4999
-
1675
-
1386
-
1248
-
1021
© 2026 Copyright ANSYS, Inc. All rights reserved.
