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/)
-   -   Error UDF (https://www.cfd-online.com/Forums/fluent-udf/175015-error-udf.html)

flo90000 July 22, 2016 05:28

Error UDF
 
Hello

I write some UDfs. I have some errors when I compile it and I don't know to resolve the last ones.

My code where I have this errors is:

Code:

#include "udf.h"
#include "math.h"

DEFINE_SDOF_PROPERTIES(valve2, prop, dt, time, dtime)
{
#if !RP_HOST
  prop[SDOF_MASS] = 0.016624115;
  prop[SDOF_IYY] = 0.000010947;
  prop[SDOF_ZERO_TRANS_X] = TRUE;
  prop[SDOF_ZERO_TRANS_Y] = TRUE;
  prop[SDOF_ZERO_TRANS_Z] = TRUE;
  prop[SDOF_ZERO_ROT_X] = TRUE;
  prop[SDOF_ZERO_ROT_Y] = FALSE;
  prop[SDOF_ZERO_ROT_Z] = TRUE;
  prop[SDOF_LOAD_M_Y] = -9.81*0.045*sin(DT_THETA (dt[1])*0.045);
printf("\n 3d : Update 6DOF properties DT_THETA_Z:%e, Mz:%e, Mass:%e\n", DT_THETA (dt)[1],prop[SDOF_LOAD_M_Z], prop[SDOF_MASS]);
#endif;
}

The errors which I have are:

Code:

valve2.c: In function valve2:
valve2.c:15: error: invalid type argument of -> (have Dynamic_Thread)
valve2.c:17:7: warning: extra tokens at end of #endif directive

Thanks for your help

D.M July 23, 2016 00:42

Hi,
your problem actually apeared in this line:

prop[SDOF_LOAD_M_Y] = -9.81*0.045*sin(DT_THETA (dt[1])*0.045);

try to use prantesis for dt , cause the way you have used dt[1] seems to be that you have used it as an array!!(and thats wrong!) so type like this:

prop[SDOF_LOAD_M_Y] = -9.81*0.045*sin(DT_THETA (dt)[1]*(0.045));

and enother problem is that u shouldnt use semicolon after #endif

regards.


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