CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Compilation error (https://www.cfd-online.com/Forums/fluent-udf/121440-compilation-error.html)

uday sarkar July 29, 2013 02:37

Compilation error
 
Hi im trying to model unsteady heat transfer from wall with the following udf:

#include "udf.h"
DEFINE_PROFILE(unsteady_heat, thread, position)
{
face_t f;
begin_f_loop(f, thread)
{
real t = RP_Get_Real("flow-time");
F_PROFILE(f, thread, position) = 0.01072*(300.0+(1527.84*doubleexp(double(0.0854*t) )));
}
end_f_loop(f, thread)
}

However I am getting syntax error while compiling.
Can anybody help me out?
thanks in advance.

vasava July 29, 2013 02:53

You have not declared 'doubleexp'. Also use of type double within the code may not be valid.

uday sarkar July 29, 2013 03:34

hi thanks for the reply.
However "double exp (double x)" stands for the mathematical function exp(x) as defined under mathematical functions in udf help section.
does the error lie somewhere else?
please help.

vasava July 29, 2013 05:15

When I try to compile it says that there is a ')' is missing. I strongly suspect that it is because of the type declaration with in the statement.

I dont have fluent license for couple of hours. I will check again and get back to you.

vasava July 29, 2013 08:46

As I said earlier the error is in the declaration. Yes "double exp (double x)" stands for the mathematical function exp(x) but that doen not mean that you can use it as it is inside a statement.

Try this one, it works:

#include "udf.h"
DEFINE_PROFILE(unsteady_heat, thread, position)
{
face_t f;
double t1, t2;
real t = CURRENT_TIME;

begin_f_loop(f, thread)
{
real t = RP_Get_Real("flow-time");
t1 = 0.0854*t;
t2 = exp(t1);
F_PROFILE(f, thread, position) = 0.01072*(300.0+(1527.84*t2));
}
end_f_loop(f, thread)
}

uday sarkar July 30, 2013 03:31

Thanks Vasava....
It works fine now...


All times are GMT -4. The time now is 22:39.