CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Initialising a 2-Dimensional Array in a UDF

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 14, 2009, 12:55
Default Initialising a 2-Dimensional Array in a UDF
  #1
New Member
 
Malachy O'Rourke
Join Date: Apr 2009
Posts: 6
Rep Power: 16
morourke is on a distinguished road
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



Last edited by morourke; April 14, 2009 at 13:56.
morourke is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic Mesh UDF Qureshi FLUENT 7 March 23, 2017 08:37
array in UDF Kamal FLUENT 1 November 7, 2013 02:15
How to add a UDF to a compiled UDF library kim FLUENT 3 October 26, 2011 22:38
can we initialize an array in UDF? blueberry Fluent UDF and Scheme Programming 2 April 14, 2009 13:00
UDF array problem Malachy FLUENT 0 February 10, 2009 11:41


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