|
[Sponsors] |
March 18, 2014, 09:01 |
problem with UDF - loop over DEFINE_PROFILE
|
#1 |
New Member
Tom
Join Date: Mar 2014
Posts: 19
Rep Power: 12 |
#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 |
|
March 20, 2014, 08:22 |
|
#2 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
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) } |
|
Tags |
loop over define_profile |
|
|
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 |