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 (https://www.cfd-online.com/Forums/fluent-udf/148964-udf.html)

ramendra February 23, 2015 02:07

Udf
 
Dear friends,
i want to give some velocity(which is non zero at t=0,t=10,t=20..likewise other wise it's zero ) as a input in inlet boundary condition . Would you guys please have a look on my code ...one more doubt can we use int function in "udf.h"

#include "udf.h"

DEFINE_PROFILE(inlet_z_velocity, thread, position)
{
real t;
int t1,t3;
real t2;

/*float X; */
face_t f;


/*X=10.0;*/
begin_f_loop(f, thread)
{
t= RP_Get_Real("flow time");
/*t_step = RP_Get_Real("Physical-time-step"); */
/*tup =((t-(t%X))/X); */
t1 = (t/100);
t2 = (t/100.0)-t1;
t3 = t2*10;

if((t3==2) || (t3==4) || (t3==6) || (t3==8)|| (t3==0))
{
F_PROFILE(f, thread, position) = 0.0007967;
}
else
{
F_PROFILE(f, thread, position)= 0;
}
}
end_f_loop(f, thread)
}

pakk February 23, 2015 09:04

Before you can make your code, your problem definition should be clear. Right now, it contains a mistake.

"i want to give some velocity(which is non zero at t=0,t=10,t=20..likewise other wise it's zero )"

If I read this literally, the velocity should be non-zero only when the time is exactly a multiple of 10 seconds. So for example:

t=9 seconds: v=0
t=9.9 seconds: v=0
t=9.99 seconds: v=0
t=9.99999 seconds: v=0
t=9.999999999999 seconds: v=0
t=9.9999999999999999999999 seconds: v=0
t=10 seconds: v=100
t=10.000000000000000000001 seconds: v=0
and so on.

Although there is nothing wrong mathematically with this, physically it makes no sense to define it in this way. The velocity is non-zero for an infinitesimally small time, so effectively it will have the same effect as saying v=0 always. That is probably not what you want, otherwise you would have said that. What do you want?


All times are GMT -4. The time now is 05:27.