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/)
-   -   Need UDF code for time dependent temperature BC (https://www.cfd-online.com/Forums/fluent-udf/205670-need-udf-code-time-dependent-temperature-bc.html)

kr660170 August 23, 2018 04:34

Need UDF code for time dependent temperature BC
 
Hello Everyone,

Can someone write me a UDF code for time dependent temperature BC.

The hot wall temperature is initially at 298K and it raised linearly for 10K/min and make it steady after it reaches 348 K.

Step 1: at time = 0s, temp = 298K
Step 2: Should raise 10K/min
Step 3: Once it reached 348K, make it steady.

I hope somone will help me. Thanks in advance.

blackmask August 23, 2018 04:51

Something like the code below should do.
Code:

#include "udf.h"

DEFINE_PROFILE(time_dep_temp,th,i)
{
    face_t f;
    real flow_time = CURRENT_TIME;
    real K0=298.0, K1=348.0, rate = 10.0/60.0;
    real t0 = 0.0, t1 = t0 + (K1-K0)/rate;
    begin_f_loop(f,th)
    { 
        if(flow_time <= t1)
            F_PROFILE(f,th,i) = K0 + rate*(flow_time - t0);
        else
            F_PROFILE(f,th,i) = K1;
    } 
    end_f_loop(f,th);
}


kr660170 August 23, 2018 08:23

Thank you very much and it's working.


All times are GMT -4. The time now is 16:29.