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

problem with UDF - loop over DEFINE_PROFILE

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 18, 2014, 09:01
Default problem with UDF - loop over DEFINE_PROFILE
  #1
New Member
 
Tom
Join Date: Mar 2014
Posts: 19
Rep Power: 12
blowback is on a distinguished road
#include "udf.h"
#include <math.h>
#include <stdio.h>
#include <conio.h>
#include <string.h>
#define M=2, L=15

void profile(char t[][15]);

int main()
{
char t[2][15];
profile(t);
return 0;
}

void profile(char t[][15])
{
int i;
for(i=0;i<2;++i)
{
fprintf(t[i],"power_profile%d",i+1);
}

for ( i = 0 ; i<2 ; ++i)
{
DEFINE_PROFILE(t[i], ft, var) - LINE 27
{
float x[3];
float z;
face_t f;
float q[0] = 1000;
float q[1] = 5000;

begin_f_loop(f,ft)
{
F_CENTROID(x,f,ft);
z = x[2];
F_PROFILE(f,ft,var)= q[i]*sin(((z-0.287)/0.02)*M_PI);
}
end_f_loop(f,ft)
}
}

}

during interpreting I got message:
line 27: missing initializer for computed-length array
blowback is offline   Reply With Quote

Old   March 20, 2014, 08:22
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
It is obvious that your attempted trick of defining functions in a loop does not work. It is good that you tried it, but the code does not work like that.

So, once you saw that, why do you put the code here? Just write it out in full...
Code:
DEFINE_PROFILE(t0, ft, var)
 {
float x[3];
float z;
 face_t f;
float q = 1000;

begin_f_loop(f,ft)
{
F_CENTROID(x,f,ft);
z = x[2];
F_PROFILE(f,ft,var)= q*sin(((z-0.287)/0.02)*M_PI);
}
end_f_loop(f,ft)
}
DEFINE_PROFILE(t1, ft, var) 
 {
float x[3];
float z;
 face_t f;
float q = 5000;

begin_f_loop(f,ft)
{
F_CENTROID(x,f,ft);
z = x[2];
F_PROFILE(f,ft,var)= q*sin(((z-0.287)/0.02)*M_PI);
}
end_f_loop(f,ft)
}
pakk is offline   Reply With Quote

Reply

Tags
loop over define_profile


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
ATTN ALL: SOLUTON TO UDF COMPILE PROBLEM Rizwan Fluent UDF and Scheme Programming 40 March 18, 2018 07:05
UDF Problem ozgur Fluent UDF and Scheme Programming 18 January 17, 2016 15:40
Urgent UDF Problem .... angelicapeygo Fluent UDF and Scheme Programming 12 May 29, 2013 10:29
UDF compiling problem in Flient 6.3 jeevan kumar FLUENT 2 February 25, 2009 01:43
UDF variables F1, y / problem with UDF Fabian FLUENT 6 June 2, 2003 11:22


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