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 variable cp

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 22, 2015, 09:38
Red face udf for variable cp
  #1
Member
 
Mohamed
Join Date: Jan 2011
Location: Algeria
Posts: 46
Rep Power: 15
B.Hamada is on a distinguished road
Hi all.
I work on the phase change, so to modeling this situation, I have to write an UDF for variable Cp.
My UDF :
PHP Code:
#include "udf.h" 
DEFINE_SPECIFIC_HEAT(my_user_cpTTrefhyi

    
real cp;
        
real delta=6;
    
real Tmelt=299.5;
    
real cps=1413;
    
real cpl=2705;
    
real lf=232000;

    if (
Tmelt)
    {
        
cp cps;
    }
    else if ((
T>Tmelt) && (T<Tmelt+delta))
    {
        
cp = ((cps+cpl)/2)+(lf/delta);
    }
    else (
Tmelt+delta
    {
        
cp cpl;
    }
    *
cp*(T-Tref);
    return 
cp

But when i interpret my UDF, I found errors on line 20 and 23
Please help me to solve the problem.
Attached Images
File Type: jpg cp.jpg (12.0 KB, 10 views)

Last edited by B.Hamada; April 22, 2015 at 11:03.
B.Hamada is offline   Reply With Quote

Old   April 22, 2015, 11:25
Default
  #2
Member
 
Join Date: Jul 2013
Posts: 80
Rep Power: 12
upeksa is on a distinguished road
#include "udf.h"
DEFINE_SPECIFIC_HEAT(my_user_cp, T, Tref, h, yi)
{
real cp;
real delta=6;
real Tmelt=299.5;
real cps=1413;
real cpl=2705;
real lf=232000;

if (T < Tmelt)
{
cp = cps;
}
else if ((T>=Tmelt) && (T<=(Tmelt+delta)))
{
cp = ((cps+cpl)/2)+(lf/delta);
}
else
{
cp = cpl;
}
*h = cp*(T-Tref);
return cp;
}

//It works now
upeksa is offline   Reply With Quote

Old   April 22, 2015, 14:20
Talking
  #3
Member
 
Mohamed
Join Date: Jan 2011
Location: Algeria
Posts: 46
Rep Power: 15
B.Hamada is on a distinguished road
Quote:
Originally Posted by upeksa View Post
#include "udf.h"
DEFINE_SPECIFIC_HEAT(my_user_cp, T, Tref, h, yi)
{
real cp;
real delta=6;
real Tmelt=299.5;
real cps=1413;
real cpl=2705;
real lf=232000;

if (T < Tmelt)
{
cp = cps;
}
else if ((T>=Tmelt) && (T<=(Tmelt+delta)))
{
cp = ((cps+cpl)/2)+(lf/delta);
}
else
{
cp = cpl;
}
*h = cp*(T-Tref);
return cp;
}

//It works now
Thank you it works normally
B.Hamada is offline   Reply With Quote

Reply


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
Dynamic Mesh UDF Qureshi FLUENT 7 March 23, 2017 07:37
WILLING TO PAY/ FREELANCER REQUIRED / small UDF coding force loads over body / 6DOF acasas CFD Freelancers 1 January 23, 2015 07:26
UDF parallel error: chip-exec: function not found????? shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 22:14
How to add a UDF to a compiled UDF library kim FLUENT 3 October 26, 2011 21:38
UDF...UDF...UDF...UDF Luc SEMINEL FLUENT 0 November 25, 2002 04:03


All times are GMT -4. The time now is 01:19.