|
[Sponsors] |
August 20, 2013, 07:59 |
non-integer subscript expression: float
|
#1 |
New Member
Join Date: Aug 2013
Posts: 12
Rep Power: 13 |
Hi,
Being a total rookie at programming I am trying to set free steam temperature as a function of flow time. While interpreting UDF i get this error: Code:
non-integer subscript expression: float Code:
F_PROFILE(f, thread, index) = tab[s]; Code:
#include "udf.h" DEFINE_PROFILE (T_ot, thread, index) { real s; double tab[8547]={}; //There are 8547 temperature values set in the correct order (as they change with every time step). I had to cut them off to make the code shorter face_t f; s=RP_Get_Real("flow-time"); begin_f_loop(f, thread) { F_PROFILE(f, thread, index) = tab[s]; } end_f_loop(f, thread); } How else can I specify array index? Does code look ok? EDIT I have changed "real s" to "int s" and now fluent do interpret UDF. Does the rest looks fine? |
|
August 20, 2013, 10:16 |
|
#2 |
Senior Member
|
You might need to change the code if the index of tab corresponds to time step rather than flow time. Also you need to avoid index out of range.
Code:
#include "udf.h" DEFINE_PROFILE (T_ot, thread, index) { int s; real tval; double tab[8547]={}; //There are 8547 temperature values set in the correct order (as they change with every time step). I had to cut them off to make the code shorter face_t f; s = N_TIME; tval = s < 8547 ? tab[s] : tab[8546]; begin_f_loop(f, thread) { F_PROFILE(f, thread, index) = tval; } end_f_loop(f, thread); } |
|
August 21, 2013, 19:41 |
|
#3 |
New Member
Join Date: Aug 2013
Posts: 12
Rep Power: 13 |
Thanks a lot!
|
|
Tags |
array, flow, index, time |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to install CGNS under windows xp? | lzgwhy | Main CFD Forum | 1 | January 11, 2011 19:44 |
CGNS lib and Fortran compiler | manaliac | Main CFD Forum | 2 | November 29, 2010 07:25 |
Missing math.h header | Travis | FLUENT | 4 | January 15, 2009 12:48 |
Lift, Drag Vs time chart,calculations | Jamesd69climber | CFX | 8 | February 17, 2005 18:23 |
to correct me an udf program | farida hamadi | FLUENT | 0 | December 18, 2004 06:54 |