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

Simple UDF array question [Fluent]

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 19, 2012, 02:41
Default Simple UDF array question [Fluent]
  #1
New Member
 
Patrick
Join Date: Apr 2012
Posts: 28
Rep Power: 14
Patrick1 is on a distinguished road
Hello,

Edit: Solved..array positions start at 0 and not 1 in C
I'm making a simple UDF that is defined by a matrix of values, but am having problems in actually getting the UDF the access the matrix properly. Here's the bones of my code:


Quote:
real velocity; /*velocity value*/
real matrix[2]; /*1D array storing 2 velocity values*/
int value; /*variable describing the array position eg. column 1,2..*/

matrix[1]=1.1;
matrix[2]=1.5;

value=1;

{
F_CENTROID(radi_pos,f,thread);
velocity=matrix[value]; /* <<<PROBLEM LINE /*
F_PROFILE(f, thread, position) = velocity;
}
This code does NOT work for me. However, if I replace the problem line with:


Quote:
velocity=matrix[1]; or
velocity=matrix[2];
then my code works..so how can I access the matrix by an integer variable rather than by an actual integer?

Will post the full code if need be.

Thanks,
Patrick

Last edited by Patrick1; April 19, 2012 at 06:28.
Patrick1 is offline   Reply With Quote

Reply

Tags
udf


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
Problem with a simple UDF to calculate cell-averaged particle values kmayank FLUENT 1 January 18, 2011 02:40
question on UDF manual example ak6g08 FLUENT 0 June 25, 2009 12:58
UDF - Source Term Question Jacques FLUENT 0 December 8, 2008 14:40
Pb with simple Fluent UDF example for inlet francois FLUENT 0 October 9, 2008 11:34
easy UDF question Oleg FLUENT 4 March 17, 2008 08:07


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