|
[Sponsors] |
![]() |
![]() |
#1 |
Member
Join Date: Apr 2017
Location: india
Posts: 96
Rep Power: 9 ![]() |
#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 |
|
![]() |
![]() |
![]() |
![]() |
#2 |
Senior Member
Join Date: Sep 2017
Posts: 246
Rep Power: 11 ![]() |
Hi sooraj546,
Are you using the correct syntax for DEFINE_SPECIFIC_HEAT? What version of Fluent is this? Good luck! Ed |
|
![]() |
![]() |
![]() |
![]() |
#3 | |
Member
Join Date: Apr 2017
Location: india
Posts: 96
Rep Power: 9 ![]() |
Quote:
https://www.sharcnet.ca/Software/Ans...e_sp_heat.html |
||
![]() |
![]() |
![]() |
![]() |
#4 |
Member
mohamed
Join Date: Apr 2016
Posts: 34
Rep Power: 10 ![]() |
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
|
|
![]() |
![]() |
![]() |
![]() |
#5 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 ![]() ![]() |
for v18.0 specific heat macro:
Code:
DEFINE_SPECIFIC_HEAT (name,T,Tref,h,yi) 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; } best regards |
|
![]() |
![]() |
![]() |
![]() |
#6 | |
Member
Join Date: Apr 2017
Location: india
Posts: 96
Rep Power: 9 ![]() |
Quote:
|
||
![]() |
![]() |
![]() |
![]() |
#7 |
Member
Join Date: Apr 2017
Location: india
Posts: 96
Rep Power: 9 ![]() |
||
![]() |
![]() |
![]() |
![]() |
#8 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 ![]() ![]() |
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; } |
|
![]() |
![]() |
![]() |
![]() |
#9 | |
Member
Join Date: Apr 2017
Location: india
Posts: 96
Rep Power: 9 ![]() |
Quote:
Once again thanks a lot for replying.....................! |
||
![]() |
![]() |
![]() |
![]() |
#10 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 ![]() ![]() |
read macro header
Code:
DEFINE_SPECIFIC_HEAT(my_user_cp, Tf, Tref, h, yi) 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; Code:
return Cp; |
|
![]() |
![]() |
![]() |
![]() |
#11 |
Member
Join Date: Apr 2017
Location: india
Posts: 96
Rep Power: 9 ![]() |
thanks a lot for your reply ...........it really helped me out.
|
|
![]() |
![]() |
![]() |
Tags |
udf - warning c2223, udf code, udf compilation |
|
|
![]() |
||||
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 02:18 |
UDF fluent compiler error | Vijayakumar_M | Fluent UDF and Scheme Programming | 3 | May 9, 2018 08:53 |
Save output of udf in another udf! | JuanJoMex | FLUENT | 0 | February 8, 2018 12:43 |
Replicating Scalable Wall Function with a UDF | yousefaz | FLUENT | 0 | August 4, 2017 02:30 |
udf - c++ compiler does not work | Matthias | FLUENT | 1 | January 9, 2009 00:44 |