CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Declation of a vector in a UDF (https://www.cfd-online.com/Forums/fluent-udf/119379-declation-vector-udf.html)

 Amelia2 June 16, 2013 04:02

Declation of a vector in a UDF

Hello,

I am having some troubles with the declaration of a vector in a UDF. The UDF is used for varying the time step. The vector is using for describing this variation.

In this exemple, I want a first time step of 1, then of 5, then of 2 and finally of 4 for having successively a flow time of 1, 6, 8, 12.

So, I declare the vector by this way :

V[3]=(1, 5, 2, 4);

And then I use a for loop by this way where dt is the time step:

for(i=0; i<=3; i++)

{dt=V[i];}

The problem is that I didn't have the except result. I have successively a flow time of 4, 8, 12, 16.

I think that only the last coordinate of the vector is taken into account. The resulting flow time is the last coordinate, two time the last coordinate, ect.

So, I suppose that I incorrectly declare the vector. In the bracket, I define the vector dimension and in the parenthesis I define the coordinates of the vector.

Can someone explain me how to declare a vector for my purpose ?