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

UDF for specific heat

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 1 Post By pakk
  • 1 Post By AlexanderZ
  • 1 Post By pakk

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 24, 2021, 03:57
Default UDF for specific heat
  #1
New Member
 
Gaurav Kumar
Join Date: Jan 2018
Location: Delhi
Posts: 17
Rep Power: 8
gauravkmr is on a distinguished road
Hi all,
I am modelling the supercritical fluids and as the thermophysical properties changes abruptly, I need to write the UDF for the specific heat of the water. I have fitted the curve in a piecewise manner as follows
200 <= T < 385
C_p=(10.57678-0.02301T)/(1+0.00537T-2.05557×〖10〗^(-5) T^2 )

385 <= T < 600
C_p=(0.83318-0.0033T)/(1-0.00319T-1.49076×〖10〗^(-6) T^2 )

Please help me to write the UDF for the same. Parallelize the code if needed as I am using 20 cores processor
Thanks
gauravkmr is offline   Reply With Quote

Old   August 24, 2021, 04:39
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Of course we can help you to make this UDF!

Step 1: find a similar UDF in the Fluent Manual.
Step 2: change it so that you think it does what you want.
Step 3: compile it, check for errors.
Step 4: fix errors until it compiles.
Step 5: check if the UDF does what you want.

Which step is giving you problems?
gauravkmr likes this.
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build".
pakk is offline   Reply With Quote

Old   August 24, 2021, 04:39
Default
  #3
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
specific heat can be defined through material properties, you don;t need UDF for that
gauravkmr likes this.
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   August 24, 2021, 08:55
Default
  #4
New Member
 
Gaurav Kumar
Join Date: Jan 2018
Location: Delhi
Posts: 17
Rep Power: 8
gauravkmr is on a distinguished road
I have written the code as you suggested, here is my code:
#include "udf.h"
DEFINE_SPECIFIC_HEAT(my_user_cp, T, Tref, h, yi)
{
real cp;
if (200 <= T < 385)
cp = 10.57678-0.02301*T/(1+0.00537*T-2.05557*pow(10,-5)*pow(T,2));
else
cp = 0.83318-0.0033*T/(1-0.00319*T-1.49076*pow(10,-6)*pow(T,2));
*h = cp*(T-Tref);
return cp;
}

But when I check the value of Cp after running the program in C, the value for 385 <= T <600 is not correct while it is correct for other ranges what is wrong please check it.
Thanks and Regards.
gauravkmr is offline   Reply With Quote

Old   August 24, 2021, 15:30
Default
  #5
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Code:
if (200 <= T < 385)
This does not do what you expect it does. Split it in two :
Code:
if ((200 <= T) && (T< 385))
gauravkmr likes this.
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build".
pakk is offline   Reply With Quote

Old   August 25, 2021, 04:54
Default
  #6
New Member
 
Gaurav Kumar
Join Date: Jan 2018
Location: Delhi
Posts: 17
Rep Power: 8
gauravkmr is on a distinguished road
Thanks, Pakk it works.
gauravkmr is offline   Reply With Quote

Reply

Tags
fluent - udf, specific heats, udf


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
Surface Heat Transfer Coefficient driven by a UDF, using coupled wall ryanbezz11 CFD Freelancers 1 March 16, 2018 04:01
Doubt - Variable Heat Flux input - UDF Neethu_N FLUENT 1 December 19, 2017 12:48
Error finding variable "THERMX" sunilpatil CFX 8 April 26, 2013 08:00
UDF for heat convection coefficient with fixed surface temperature Boo85 Fluent UDF and Scheme Programming 2 July 10, 2012 19:43
heat flow UDF on coupled surface (wall-shadow wall) Friedmann Fluent UDF and Scheme Programming 0 August 5, 2010 11:25


All times are GMT -4. The time now is 17:29.