CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   Natural log for UDF (http://www.cfd-online.com/Forums/fluent-udf/69586-natural-log-udf.html)

ehkhor October 28, 2009 04:34

Natural log for UDF
 
Hi,

My model is J= k1*ln(x1) and the below is my codes. However, i received parse error in the line in pink font, which i could not detect any syntax error. please help.

#include "udf.h"

#define FLUID_ID 1
#define k1 2.00e-4
#define x1 1.3847
DEFINE_PROFILE(flux, thread, np)
{
cell_t c;
real x[ND_ND];


begin_c_loop (c,thread)
{
/* centroid is defined to specify position dependent profiles*/
C_CENTROID(x,c,thread);
F_PROFILE(c,thread,np) =
k1*double log (double x1);

}
end_c_loop (c,thread)
}

dmoroian October 28, 2009 08:18

I think the casting should be done with round paranthesis:
Code:

k1*(double)log((double)x1)

ehkhor October 28, 2009 23:13

Thanks a lot. it works!


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