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

The udf of specific heat can load but leading the case divergence

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 7, 2018, 12:21
Red face The udf of specific heat can load but leading the case divergence
  #1
New Member
 
Join Date: Jul 2018
Posts: 2
Rep Power: 0
Kobe Peng is on a distinguished road
Hello, everyone, i'm Kobe Peng.

I'm sorry that my English is not very well, i try to describe my question clearly.

I'm running a transcritical heat transfer case in which the transcritical fluid flows through a tube then it is heated.

I need to define the property of specific heat, and i have written, compiled and loaded the udf of cp but the case diverged after hundreds of interations.

Then I tried defining the specific by piecewise linear in FLUENT, and it did work!

I have checked the udf and the piecewise polynomial in it didn't have mistakes.

So, I am confused why once i use the udf then the case diverges.

If u guys know why, please tell me!

Thank you so much!
Kobe Peng is offline   Reply With Quote

Old   July 7, 2018, 12:27
Default
  #2
New Member
 
Join Date: Jul 2018
Posts: 2
Rep Power: 0
Kobe Peng is on a distinguished road
Here is the udf
#include "udf.h"
#include "math.h"

/*cp*/
DEFINE_SPECIFIC_HEAT(ac_spec,T,Tref,h,yi)
{
real spec;
{
if(T>=300)
spec = 265124.8831155-4464.82375371177*T+32.9231274086636*pow(T,2)-0.136039343632479*pow(T,3)+0.000339294051264547*po w(T,4)-5.09716373722217e-07*pow(T,5)+4.26496354634277e-10*pow(T,6)-1.53193177603194e-13*pow(T,7);
else if(T>=230&&T<300)
spec = 90820232.6991246-2323424.32743038*T+25493.1862659987*pow(T,2)-155.469810184518*pow(T,3)+0.569025894531809*pow(T, 4)-0.00124972693433267*pow(T,5)+1.52481826353193e-06*pow(T,6)-7.97246697067391e-10*pow(T,7);
else if(T>=208&&T<230)
spec = 61783405144.5027-2134905306.97295*T+31366437.2097949*pow(T,2)-254307.268382587*pow(T,3)+1229.96834217446*pow(T,4 )-3.55139768453823*pow(T,5)+0.00567176410739463*pow( T,6)-3.86692837907887e-06*pow(T,7);
else if(T>=185&&T<208)
spec = -107434137534.901+3791580172.91008*T-57290594.522828*pow(T,2)+480412.690572312*pow(T,3)-2414.4280687518*pow(T,4)+7.27206290466646*pow(T,5)-0.0121532810731963*pow(T,6)+8.69337002128947e-06*pow(T,7);
else if(T>=100&&T<185)
spec = -225762.297493954+12310.0037428643*T-282.185198740609*pow(T,2)+3.576418647329*pow(T,3)-0.0270693354002758*pow(T,4)+0.000122408921466647*p ow(T,5)-3.06380049304191e-07*pow(T,6)+3.2776859907096e-10*pow(T,7);
else
spec = 4000;
}
*h=spec*(T-Tref);
return spec;
}
Kobe Peng is offline   Reply With Quote

Old   July 8, 2018, 19:11
Default
  #3
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
First, there's a couple of spaces in your code such as "po w" on line 10 and "p ow" on line 18. Next, why have you written the coefficients with such a high precision? Perhaps rewrite with scientific notation with ~6 significant figures, e.g. 2.65124e5 for the first number. The nested if statements do not require the upper bound (e.g. T < 300) because of the preceding if condition (e.g. T >= 300). Then, have you checked with a plot that these equations are providing the expected heat capacity as a function of temperature, and is this relation a continuous function? Lastly, are the units from your equations in Kelvin or degrees Celsius? Fluent uses Kelvin for the units of temperature.
`e` is offline   Reply With Quote

Reply

Tags
divergence, heat transfer, specfic heat, udf

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
PEMFC model with FLUENT brahimchoice FLUENT 22 April 19, 2020 15:44
UDF for mass and heat source with heat transfer rajendra1 Fluent UDF and Scheme Programming 35 October 13, 2017 04:04
Divergence problem Smaras FLUENT 13 February 21, 2013 05:03
Water subcooled boiling Attesz CFX 7 January 5, 2013 03:32
specific heat in UDF gino FLUENT 3 November 22, 2001 23:16


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