CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   udf wont work unsteady flow (https://www.cfd-online.com/Forums/fluent-udf/150760-udf-wont-work-unsteady-flow.html)

elliot March 28, 2015 22:07

udf wont work unsteady flow
 
Hi all first time poster here so i'l keep it short and sweet.
Im trying to write a udf for a unsteady flow that varies with time step on a pipe in 2d, (I am having great difficulty). I have written a udf (below), however when I run it in fluent it only runs the last velocity and misses out the rest. Can anyone spot my mistake/s? Any help would be much appreciated.

#include "udf.h"
DEFINE_PROFILE(inlet_x_velocity, thread, position)
{
real x[ND_ND];
real y;
real t = RP_Get_Real("physical-time-step");
face_t f;
begin_f_loop(f, thread)
{if (t<=10);
F_CENTROID(x,f,thread);
y = x[1];
F_PROFILE(f, thread, position) = 1;
}
{if (t<=11 && t>10);
F_CENTROID(x,f,thread);
y = x[1];
F_PROFILE(f, thread, position) = 0.5;
}
{if (t<=12 && t>11);
F_CENTROID(x,f,thread);
y = x[1];
F_PROFILE(f, thread, position) = 3;
}
{if (t<=13 && t>12);
F_CENTROID(x,f,thread);
y = x[1];
if (y<=7)
F_PROFILE(f, thread, position) = 9;
}
if (t<=14 && t>13);
{
F_CENTROID(x,f,thread);
y = x[1];
F_PROFILE(f, thread, position) = 5;
}
end_f_loop(f, thread)
}

`e` March 28, 2015 22:16

Please don't double post topics, let's stay with your original topic as I've replied already.


All times are GMT -4. The time now is 02:04.