UDF for Continuous Step Velocity Profile
Hi.
I want to apply a continuous step velocity profile for my inlet. I want it to keep fluctuating with period of 0.04 seconds until I stop iteration. Would you please let me know how to do it and whether the way I have written that is correct. Here is my UDF. #include "udf.h" DEFINE_PROFILE(Step_UDF,thread,position) { real x[ND_ND]; face_t f; real u,u0=0.4; real t; begin_f_loop(f,thread) { F_CENTROID(x,f,thread); t = RP_Get_Real("flow-time"); if ((fabs(t/0.04)%2)==0) u=u0; else u=u0*1.03; F_PROFILE(f,thread,position)=u; } end_f_loop(f,thread) } |
Since you already have a proposed solution:
-did you try it? -did it do what you wanted it to do? -if not, what was wrong? |
Well I tried and found that I have to mention before that both sides of % are integer.
I just found it through trial and error. I was actually hoping that someone give me a general solution. What I did is working for me now. Thank you :) |
All times are GMT -4. The time now is 14:02. |