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/)
-   -   How to solve "invalid type for binary expression: double* function returning double"? (https://www.cfd-online.com/Forums/fluent-udf/140471-how-solve-invalid-type-binary-expression-double-function-returning-double.html)

B.Hamada August 15, 2014 14:54

How to solve "invalid type for binary expression: double* function returning double"?
 
hi friends

I write this UDF to represent unsteady heat flux, but an error appear, I can not understand how to solve it in the 13th line.

Error: line 13: invalid type for binary expression: double * function returning double.
Code:

#include "udf.h"
DEFINE_PROFILE(unsteady_flux, thread, position)
{
face_t f;
real t = CURRENT_TIME;
real Trise = 0;
real Tset = 48600;
real Tmax = 21900;
real Gs = 500; 
begin_f_loop(f, thread)
{
if((temp>=Trise) && (temp<Tmax))
F_PROFILE(f, thread, position) = Gs*sin*(90*(t-Trise)/(Tmax-Trise));
else if((temp>=Tmax) && (temp<Tset))
F_PROFILE(f, thread, position) = Gs*sin*(90*(t-Tmax)/(Tset-Tmax));
}
end_f_loop(f, thread)
}


upeksa August 22, 2014 10:45

You used the sine function wrong, so your code should be:

#include "udf.h"
DEFINE_PROFILE(unsteady_flux, thread, position)
{
face_t f;
real t = CURRENT_TIME;
real Trise = 0.0;
real Tset = 48600.0;
real Tmax = 21900.0;
real Gs = 500.0;
begin_f_loop(f, thread)
{
if((temp>=Trise) && (temp<Tmax))
F_PROFILE(f, thread, position) = Gs*sin(90.0*(t-Trise)/(Tmax-Trise));
else if((temp>=Tmax) && (temp<Tset))
F_PROFILE(f, thread, position) = Gs*sin(90.0*(t-Tmax)/(Tset-Tmax));
}
end_f_loop(f, thread)
}

By the way, I am almost sure that the unit of an angle is radian, not degree. Check it.


All times are GMT -4. The time now is 13:50.