CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Not able to rectify a UDF compiler erro ?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 15, 2018, 11:17
Default Not able to rectify a UDF compiler erro ?
  #1
Member
 
Join Date: Apr 2017
Location: india
Posts: 96
Rep Power: 9
sooraj546 is on a distinguished road
#include "udf.h"
#include "mem.h"

DEFINE_SPECIFIC_HEAT(iron_sp, Tf, Cp, c, t)
{

Tf = C_T(c,t);
if (Tf<800)
{
Cp= 14.379+(49.006*Tf/1000)+(-57.471*Tf*Tf/1000000)+(41.243*Tf*Tf*Tf/1000000000);
}
else if (Tf>=800 && Tf<1000)
{
Cp= 213.76+(-460.596*Tf/1000)+(301.135*Tf*Tf/1000000);
}
else if (Tf>=1000 && Tf<1040)
{
Cp= 8759.86+(-17497.2*Tf/1000)+(8773.75*Tf*Tf/1000000);
}
else if (Tf>=1040 && Tf<1042)
{
Cp= -6415.79+(6237.5*Tf/1000);
}
else if (Tf>=1042 && Tf<1060)
{
Cp= 124237.633+(-234458.544*Tf/1000)+(110661.111*Tf*Tf/1000000);
}
else if (Tf>=1060 && Tf<1184)
{
Cp= 542.908+(-816.002*Tf/1000)+(331.482*Tf*Tf/1000000);
}
else
{
Cp= 24.036+(8.295*Tf/1000)+(0.022*Tf*Tf/1000000);
}
return Cp;
}




i am getting an error saying "error C2223: left of '->storage' must point to struct/union" for line 7 i.e. Tf = C_T(c,t);
i know this is a declaration error but still i am not able to resolve it, Kindly help me out
sooraj546 is offline   Reply With Quote

Old   May 15, 2018, 12:26
Default
  #2
Senior Member
 
Join Date: Sep 2017
Posts: 246
Rep Power: 12
obscureed is on a distinguished road
Hi sooraj546,

Are you using the correct syntax for DEFINE_SPECIFIC_HEAT? What version of Fluent is this?

Good luck!
Ed
obscureed is offline   Reply With Quote

Old   May 15, 2018, 12:32
Default
  #3
Member
 
Join Date: Apr 2017
Location: india
Posts: 96
Rep Power: 9
sooraj546 is on a distinguished road
Quote:
Originally Posted by obscureed View Post
Hi sooraj546,

Are you using the correct syntax for DEFINE_SPECIFIC_HEAT? What version of Fluent is this?

Good luck!
Ed
thanks a lot for replying .................i have given the link of the UDF , I am currently using fluent 18.0

https://www.sharcnet.ca/Software/Ans...e_sp_heat.html
sooraj546 is offline   Reply With Quote

Old   May 15, 2018, 17:25
Default
  #4
Member
 
mohamed
Join Date: Apr 2016
Posts: 34
Rep Power: 10
moh_zain is on a distinguished road
HI you need to define this C_T is it real or later or what just or delete line 7 and the code is also will be fine
moh_zain is offline   Reply With Quote

Old   May 15, 2018, 22:41
Default
  #5
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
for v18.0 specific heat macro:
Code:
DEFINE_SPECIFIC_HEAT (name,T,Tref,h,yi)
example
Code:
/**********************************************************************
UDF that computes specific heat and sets the sensible enthalpy
to the referenced value
***********************************************************************/
#include "udf.h"
DEFINE_SPECIFIC_HEAT(my_user_cp, T, Tref, h, yi)
{
real cp=2000.;
*h = cp*(T-Tref);
return cp;
}
more details in Ansys Fluent Customization manual

best regards
AlexanderZ is offline   Reply With Quote

Old   May 15, 2018, 23:51
Default
  #6
Member
 
Join Date: Apr 2017
Location: india
Posts: 96
Rep Power: 9
sooraj546 is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
for v18.0 specific heat macro:
Code:
DEFINE_SPECIFIC_HEAT (name,T,Tref,h,yi)
example
Code:
/**********************************************************************
UDF that computes specific heat and sets the sensible enthalpy
to the referenced value
***********************************************************************/
#include "udf.h"
DEFINE_SPECIFIC_HEAT(my_user_cp, T, Tref, h, yi)
{
real cp=2000.;
*h = cp*(T-Tref);
return cp;
}
more details in Ansys Fluent Customization manual

best regards
I have shared this link above as well. Thanks lot for replying still can u give me som suggestions how to rectify that error
sooraj546 is offline   Reply With Quote

Old   May 15, 2018, 23:54
Default
  #7
Member
 
Join Date: Apr 2017
Location: india
Posts: 96
Rep Power: 9
sooraj546 is on a distinguished road
Quote:
Originally Posted by moh_zain View Post
HI you need to define this C_T is it real or later or what just or delete line 7 and the code is also will be fine
C_T is the macro for getting temperature at each cell along the thread I needed it else this code is meaningless

Thanks a lot for replying,
sooraj546 is offline   Reply With Quote

Old   May 16, 2018, 02:13
Default
  #8
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
Code:
/**********************************************************************
UDF that computes specific heat and sets the sensible enthalpy
to the referenced value
***********************************************************************/
#include "udf.h"
DEFINE_SPECIFIC_HEAT(my_user_cp, Tf, Tref, h, yi)
{
real Cp;
if (Tf<800)
{
Cp= 14.379+(49.006*Tf/1000)+(-57.471*Tf*Tf/1000000)+(41.243*Tf*Tf*Tf/1000000000);
}
else if (Tf>=800 && Tf<1000)
{
Cp= 213.76+(-460.596*Tf/1000)+(301.135*Tf*Tf/1000000);
}
else if (Tf>=1000 && Tf<1040)
{
Cp= 8759.86+(-17497.2*Tf/1000)+(8773.75*Tf*Tf/1000000);
}
else if (Tf>=1040 && Tf<1042)
{
Cp= -6415.79+(6237.5*Tf/1000);
}
else if (Tf>=1042 && Tf<1060)
{
Cp= 124237.633+(-234458.544*Tf/1000)+(110661.111*Tf*Tf/1000000);
}
else if (Tf>=1060 && Tf<1184)
{
Cp= 542.908+(-816.002*Tf/1000)+(331.482*Tf*Tf/1000000);
}
else
{
Cp= 24.036+(8.295*Tf/1000)+(0.022*Tf*Tf/1000000);
}
*h = Cp*(Tf-Tref);
return cp;
}
best regards
AlexanderZ is offline   Reply With Quote

Old   May 16, 2018, 02:23
Default
  #9
Member
 
Join Date: Apr 2017
Location: india
Posts: 96
Rep Power: 9
sooraj546 is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
Code:
/**********************************************************************
UDF that computes specific heat and sets the sensible enthalpy
to the referenced value
***********************************************************************/
#include "udf.h"
DEFINE_SPECIFIC_HEAT(my_user_cp, Tf, Tref, h, yi)
{
real Cp;
if (Tf<800)
{
Cp= 14.379+(49.006*Tf/1000)+(-57.471*Tf*Tf/1000000)+(41.243*Tf*Tf*Tf/1000000000);
}
else if (Tf>=800 && Tf<1000)
{
Cp= 213.76+(-460.596*Tf/1000)+(301.135*Tf*Tf/1000000);
}
else if (Tf>=1000 && Tf<1040)
{
Cp= 8759.86+(-17497.2*Tf/1000)+(8773.75*Tf*Tf/1000000);
}
else if (Tf>=1040 && Tf<1042)
{
Cp= -6415.79+(6237.5*Tf/1000);
}
else if (Tf>=1042 && Tf<1060)
{
Cp= 124237.633+(-234458.544*Tf/1000)+(110661.111*Tf*Tf/1000000);
}
else if (Tf>=1060 && Tf<1184)
{
Cp= 542.908+(-816.002*Tf/1000)+(331.482*Tf*Tf/1000000);
}
else
{
Cp= 24.036+(8.295*Tf/1000)+(0.022*Tf*Tf/1000000);
}
*h = Cp*(Tf-Tref);
return cp;
}
best regards
this code will work sir fine, but my intention is to obtain temperature of each control volume at each iteration and use it for Cp calculation, Thats y i have specified Tf = C_T(c,t) .............if i use here Tf the fluent database will never know its the temperature depending on the control volume ..............am i right sir?

Once again thanks a lot for replying.....................!
sooraj546 is offline   Reply With Quote

Old   May 16, 2018, 03:45
Default
  #10
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
read macro header
Code:
DEFINE_SPECIFIC_HEAT(my_user_cp, Tf, Tref, h, yi)
Tf here (was T) is temperature of cell, it is provided automatically. You do not need to redefine it
test this code, initialize your case with different temperatures and check Cp. Sounds easy

By the way, change very last line
was
Code:
return cp;
to be
Code:
return Cp;
best regards
AlexanderZ is offline   Reply With Quote

Old   May 16, 2018, 03:48
Default
  #11
Member
 
Join Date: Apr 2017
Location: india
Posts: 96
Rep Power: 9
sooraj546 is on a distinguished road
thanks a lot for your reply ...........it really helped me out.
sooraj546 is offline   Reply With Quote

Reply

Tags
udf - warning c2223, udf code, udf compilation


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
udf for one dimensional linear motion based on force maccheese Fluent UDF and Scheme Programming 2 September 1, 2019 03:18
UDF fluent compiler error Vijayakumar_M Fluent UDF and Scheme Programming 3 May 9, 2018 09:53
Save output of udf in another udf! JuanJoMex FLUENT 0 February 8, 2018 13:43
Replicating Scalable Wall Function with a UDF yousefaz FLUENT 0 August 4, 2017 03:30
udf - c++ compiler does not work Matthias FLUENT 1 January 9, 2009 01:44


All times are GMT -4. The time now is 13:09.