CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   UDF for time-dependent flow (http://www.cfd-online.com/Forums/fluent-udf/118466-udf-time-dependent-flow.html)

borhan_sd@yahoo.com May 28, 2013 08:35

UDF for time-dependent flow
 
Hi all ,Iím new in fluent and particularly UDF, I want to model a system that a gas is inlet and it flows for 3s and doesnít flow for 3s alternatively and continuously. In fact itís our respiration flow and the model is a respiratory mask.
How should I write UDF file? Probably CURRENT_TIMESTEP Macro should be used, Is it right?
Would you tell me please how should I write the UDF? This is very important for me.
Thank you very very much in advance.

blackmask May 29, 2013 04:50

Something looks like
Code:

#include "udf.h"

DEFINE_PROFILE(vel_in, thread, i)  {
    real y;
    face_t f;
    real t = CURRENT_TIME;
    int off = (int) (t/0.03+0.5) %2;
   
    begin_f_loop(f,thread)
    {
        if (!off)
            F_PROFILE(f,thread,i) = 1.0;
    }
    end_f_loop(f,thread)
}

Modify it to suit your needs.

borhan_sd@yahoo.com May 30, 2013 02:59

thank you very much for your quick reply

regards


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