|
[Sponsors] |
May 16, 2015, 20:16 |
UDF error for variable Cp
|
#1 |
Member
Mohamed
Join Date: Jan 2011
Location: Algeria
Posts: 46
Rep Power: 15 |
Hi all, I have written a UDF to a variable Cp, but when I interpreted it, an error appears on line 12:
line 12: exp: too many arguments supplied (argument 2) My UDF: HTML Code:
#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=1797.6;
real lf=232;
if (T <= Tmelt)
{
cp = cps+lf*exp(-0,5*(T-Tmelt)*(T-Tmelt));
}
else if (T > Tmelt)
{
cp = cpl+lf*exp(-0,5*(T-Tmelt)*(T-Tmelt));
}
*h = cp*(T-Tref);
return cp;
}
Last edited by B.Hamada; May 17, 2015 at 07:22. |
|
May 17, 2015, 16:27 |
|
#2 |
Member
Mohamed
Join Date: Jan 2011
Location: Algeria
Posts: 46
Rep Power: 15 |
PLeaaaaaaaaaaaaaaaaaaaaaaaaaaaaaase help meeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
|
May 18, 2015, 05:43 |
|
#3 |
Member
Join Date: Jul 2013
Posts: 80
Rep Power: 13 |
#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=1797.6; real lf=232; if (T <= Tmelt) { cp = cps+lf*exp(-0.5*(T-Tmelt)*(T-Tmelt)); } else if (T > Tmelt)/*no need if statement, "else" is enough*/ { cp = cpl+lf*exp(-0.5*(T-Tmelt)*(T-Tmelt)); } *h = cp*(T-Tref); return cp; } Last edited by upeksa; May 18, 2015 at 05:47. Reason: In case it was not clear |
|
May 18, 2015, 06:14 |
|
#4 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Upkesa gives the right answer, I can give some more explanation.
You used: Code:
exp(-0,5*(T-Tmelt)*(T-Tmelt)) |
|
May 18, 2015, 07:27 |
|
#5 | ||
Member
Mohamed
Join Date: Jan 2011
Location: Algeria
Posts: 46
Rep Power: 15 |
Quote:
Quote:
|
|||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Dynamic Mesh UDF | Qureshi | FLUENT | 7 | March 23, 2017 08:37 |
WILLING TO PAY/ FREELANCER REQUIRED / small UDF coding force loads over body / 6DOF | acasas | CFD Freelancers | 1 | January 23, 2015 08:26 |
Source Term UDF VS Porous Media Model | pchoopanya | Fluent UDF and Scheme Programming | 1 | August 28, 2013 07:12 |
UDF parallel error: chip-exec: function not found????? | shankara.2 | Fluent UDF and Scheme Programming | 1 | January 16, 2012 23:14 |
UDF, UDF, UDF, UDF | Luc SEMINEL | Main CFD Forum | 0 | November 25, 2002 05:01 |