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/)
-   -   Initialising a 2-Dimensional Array in a UDF (http://www.cfd-online.com/Forums/fluent-udf/63616-initialising-2-dimensional-array-udf.html)

morourke April 14, 2009 12:55

Initialising a 2-Dimensional Array in a UDF
 
Hi All,

Does anyone have any insight as to what might be wrong with the following coding extracted from my inlet boundary condition.

#include"udf.h"
DEFINE_PROFILE(x_velocity, thread, index)
{
float a1[2][2] = { { 0.00000000f, 1.00000000f } ,
{ 1.00000000f, 0.00000000f } }
}

I get an error as follows when i interpret the routine.
line 5: invalid type conversion: float -> array 2 of float.


Any help appreciated!

Even more worrying is the following:

#include"udf.h"
DEFINE_PROFILE(x_velocity, thread, index)
{
int i, j;
float a1[2][2];

a1[0][0] = 1.0;
a1[0][1] = 2.0;
a1[1][0] = 3.0;
a1[1][1] = 4.0;
for (j=0; j<2; j++)
{
for (i=0; i<2; i++)
{
printf(
" a1[%d][%d] = %12.8f", j, i, a1[j][i]);
}
printf(
"\n");
}
}

which return in the text interface
a1[0][0] = 1.00000000 a1[0][1] = 2.00000000
a1[1][0] = 0.00000000 a1[1][1] = 0.00000000




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