CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   problem with real number in udf (https://www.cfd-online.com/Forums/fluent-udf/132492-problem-real-number-udf.html)

 amr mobarez April 1, 2014 14:38

problem with real number in udf

hi guys i'm making udf for unsteady inlet velocity ( step train ) with certain value
with respect to time but i having problem with direction and magnitude as some of the flow goes into the reverse direction here is the code i wrote i hope someone can tell me what is wrong with it

#include "udf.h"

{
face_t f;

real t = CURRENT_TIME;
if(t < 0.1)
{
}
if(0.1 < t > 0.2)
{
}
if(0.2 < t <0.3)
{
}
if(0.3 < t > 0.4)
{
}
if(0.4 < t < 0.5)
{
}
if(0.5 < t < 0.6)
{
}
if(t > 0.6)
{
}
}

 diamondx April 2, 2014 16:57

I think you should have a loop !!

 amr mobarez April 3, 2014 18:14

you are right diamond x i tried the loop and it corrected the direction , still have problems with values but thanks for helping

 upeksa April 4, 2014 06:03

You have ambiguous instructions, for example t>0.4 is defined twice:
in (0.3 < t >0.4) and (0.4 < t < 0.5).

And t=0.1, t=0.2... is not defined.

Check that, is an error you made several times.

User diamondx is right, you need a loop.

Cheers

 amr mobarez April 4, 2014 17:01

i fixed it and it worked and here is the right code in case someone needed it

#include "udf.h"

{
face_t f;
real tm = CURRENT_TIME;
{
if(tm < 0.1)
{
}
if(tm > 0.1)
{
}
if(tm > 0.2)
{
}
if(tm > 0.3)
{
}
if(tm > 0.4)
{